Logo Search packages:      
Sourcecode: scidavis version File versions  Download package

AbstractFit Class Reference

#include <AbstractFit.h>

Inheritance diagram for AbstractFit:

AbstractFilter AbstractAspect

List of all members.


Detailed Description

Base class for doing fits using the algorithms provided by GSL.

Implementations of AbstractFit essentially provide methods to compute a specific function to be fitted, its derivatives with respect to the fit parameters and sensible estimates for the parameters (given the data to be fitted).

Input is accepted on two ports: X and Y. Y is assumed to be a function of X, which is approximated by the function specified by the implementation of AbstractFit being used.

On its output ports, AbstractFit provides (in order) the current values of the parameters, their names, and textual descriptions. Current values can be initial values specified by the user, automated estimates made by the implementation, or the results of the fit. You only ever get to see the first two when you haven't connected the input ports of AbstractFit yet, because after the first connect (and possibly subsequent calls to setInitialValue()), the fit is automatically recomputed. After calling setAutoRefit(), it is also recomputed whenever the input data changes.

Definition at line 58 of file AbstractFit.h.


Reimplemented from AbstractFilter

virtual int inputCount () const
 Return the number of input ports supported by the filter or -1 if any number of inputs is acceptable.
virtual QString inputName (int port) const
virtual int outputCount () const
 Return the number of output ports provided by the filter.
virtual void dataChanged (AbstractDataSource *)

serialize/deserialize

virtual bool load (XmlStreamReader *)
 Load from XML.
virtual void save (QXmlStreamWriter *) const
 Save as XML.
bool readBasicAttributes (XmlStreamReader *reader)
 Load name, creation time and caption spec from XML.
bool readCommentElement (XmlStreamReader *reader)
 Load comment from an XML element.
void writeBasicAttributes (QXmlStreamWriter *writer) const
 Save name, creation time and caption spec to XML.
void writeCommentElement (QXmlStreamWriter *writer) const
 Save the comment to XML.

Public Types

enum  Algorithm { ScaledLevenbergMarquardt, UnscaledLevenbergMarquardt, NelderMeadSimplex }
enum  Weighting { NoWeighting, Poisson, Dataset }
 Possible sources for weighting data. More...

Public Slots

virtual void remove ()
 Remove me from my parent's list of children.
void setCaptionSpec (const QString &value)
 Set the specification string used for constructing the caption().
void setComment (const QString &value)
void setName (const QString &value)
QString uniqueNameFor (const QString &current_name) const
 Make the specified name unique among my children by incrementing a trailing number.

Signals

void aspectAboutToBeAdded (const AbstractAspect *parent, int index)
 Emit this when a parent aspect is about to get a new child inserted.
void aspectAboutToBeRemoved (const AbstractAspect *parent, int index)
 Emit this from a parent before removing its child.
void aspectAboutToBeRemoved (const AbstractAspect *aspect)
 Emit this from an aspect about to be removed from its parent's children.
void aspectAdded (const AbstractAspect *parent, int index)
 Emit this from a parent after adding a new child to it.
void aspectAdded (const AbstractAspect *aspect)
 Emit this from a newly added aspect.
void aspectDescriptionAboutToChange (const AbstractAspect *aspect)
 Emit this before the name, comment or caption spec is changed.
void aspectDescriptionChanged (const AbstractAspect *aspect)
 Emit this when the name, comment or caption spec changed.
void aspectRemoved (const AbstractAspect *parent, int index)
 Emit this from the parent after removing a child.
void statusInfo (const QString &text)
 Emit this to give status information to the user.

Public Member Functions

void addChild (AbstractAspect *child)
 Add the given Aspect to my list of children.
QString caption () const
QString captionSpec () const
 Return the specification string used for constructing the caption().
AbstractAspectchild (int index) const
 Get a child by its position in my list of children.
int childCount () const
 Return the number of child Aspects.
QString comment () const
virtual QMenu * createContextMenu () const
 Return a new context menu.
QDateTime creationTime () const
QList< AbstractAspect * > descendantsThatInherit (const char *class_name)
 Get all descendents that inherit the given class.
future::Folderfolder ()
 Return the folder the Aspect is contained in or 0 if not.
int highestConnectedInput () const
 Return the index of the highest input port that is connected.
virtual QIcon icon () const
 Return an icon to be used for decorating my views.
void importV0x0001XXCreationTime (const QString &str)
int index () const
 Return my position in my parent's list of children.
int indexOfChild (const AbstractAspect *child) const
 Return the position of child in my list of children.
const AbstractColumninput (int port) const
 Return the input currently connected to the specified port, or 0.
bool input (const AbstractFilter *sources)
 Connect all outputs of the provided filter to the corresponding inputs of this filter.
bool input (int port, const AbstractColumn *source)
 Connect the provided data source to the specified input port.
virtual QString inputLabel (int port) const
 Return the label associated to the given input port.
void insertChild (AbstractAspect *child, int index)
 Insert the given Aspect at a specific position in my list of children.
bool isDescendantOf (AbstractAspect *other)
 Return whether the there is a path upwards to the given aspect.
bool isOutdated () const
void moveChild (int from, int to)
 Change the positon of a child in my list of children.
QString name () const
virtual const AbstractColumnoutput (int port=0) const =0
 Overloaded method for const access.
virtual AbstractColumnoutput (int port=0)=0
 Get the data source associated with the specified output port.
AbstractAspectparentAspect () const
 Return my parent Aspect or 0 if I currently don't have one.
virtual QString path () const
 Return the path that leads from the top-most Aspect (usually a Project) to me.
int portIndexOf (const AbstractColumn *column)
 Return the input port to which the column is connected or -1 if it's not connected.
virtual Projectproject ()
 Return the Project this Aspect belongs to, or 0 if it is currently not part of one.
virtual const Projectproject () const
 Return the Project this Aspect belongs to, or 0 if it is currently not part of one.
virtual void removeAllChildAspects ()
 Remove all child aspects.
void removeChild (int index)
 Remove the Aspect at the given index from my list of children.
void removeChild (AbstractAspect *child, bool detach=false)
 Remove the given Aspect from my list of children.
void reparentChild (AbstractAspect *new_parent, AbstractAspect *child)
 Move a child to another aspect and transfer ownership.
void reparentChild (AbstractAspect *new_parent, AbstractAspect *child, int d_new_index)
 Move a child to another aspect and transfer ownership.
void setAlgorithm (Algorithm a)
void setAutoRefit (bool auto_refit=true)
undo related
void beginMacro (const QString &text)
 Begin an undo stack macro (series of commands).
void endMacro ()
 End the undo stack macro.
void exec (QUndoCommand *command)
 Execute the given command, pushing it on the undoStack() if available.
virtual QUndoStack * undoStack () const
 Return the undo stack of the Project, or 0 if this Aspect is not part of a Project.
Handling of fit parameters
virtual void guessInitialValues ()=0
void setInitialValue (int parameter, double value)

Static Public Member Functions

static QVariant global (const QString &key)
 Retrieve a global setting.
static QString nameOf (Weighting weighting)
static QString nameOf (Algorithm algo)
static void setGlobal (const QString &key, const QVariant &value)
 Update a global setting.
static void setGlobalDefault (const QString &key, const QVariant &value)
 Set default value for a global setting.

Protected Slots

signal handlers
void inputAboutToBeDestroyed (const AbstractColumn *source)
virtual void inputAboutToBeReplaced (const AbstractColumn *source, const AbstractColumn *replacement)
 An input is about to be replaced.
virtual void inputDataAboutToChange (const AbstractColumn *source)
 The data of an input is about to change.
virtual void inputDataChanged (const AbstractColumn *source)
 The data of an input has changed.
void inputDescriptionAboutToChange (const AbstractAspect *aspect)
virtual void inputDescriptionAboutToChange (const AbstractColumn *source)
 Name and/or comment of an input will be changed.
void inputDescriptionChanged (const AbstractAspect *aspect)
virtual void inputDescriptionChanged (const AbstractColumn *source)
 Name and/or comment of an input changed.
virtual void inputMaskingAboutToChange (const AbstractColumn *source)
virtual void inputMaskingChanged (const AbstractColumn *source)
virtual void inputModeAboutToChange (const AbstractColumn *source)
 The display mode and possibly the data type of an input is about to change.
virtual void inputModeChanged (const AbstractColumn *source)
 The display mode and possibly the data type has changed.
virtual void inputPlotDesignationAboutToChange (const AbstractColumn *source)
 The plot designation of an input is about to change.
virtual void inputPlotDesignationChanged (const AbstractColumn *source)
 The plot designation of an input changed.
virtual void inputRowsAboutToBeInserted (const AbstractColumn *source, int before, int count)
virtual void inputRowsAboutToBeRemoved (const AbstractColumn *source, int first, int count)
virtual void inputRowsInserted (const AbstractColumn *source, int before, int count)
virtual void inputRowsRemoved (const AbstractColumn *source, int first, int count)

Protected Member Functions

virtual void completeAspectInsertion (AbstractAspect *aspect, int index)
 Called after a new child has been inserted or added.
void info (const QString &text)
 Implementations should call this whenever status information should be given to the user.
virtual void inputAboutToBeDisconnected (const AbstractColumn *source)
 Called whenever an input is disconnected or deleted.
virtual bool inputAcceptable (int port, const AbstractColumn *source)
 Give implementations a chance to reject connections to their input ports.
virtual void prepareAspectRemoval (AbstractAspect *aspect)
 Called before a child is removed.
void setCreationTime (const QDateTime &time)
 Set the creation time.

Static Protected Member Functions

static virtual int fitFunction (const gsl_vector *, void *, gsl_vector *)=0
static virtual int fitFunctionDf (const gsl_vector *, void *, gsl_matrix *)=0
static virtual int fitFunctionFdf (const gsl_vector *, void *, gsl_vector *, gsl_matrix *)
static virtual double fitFunctionSimplex (const gsl_vector *, void *)=0

Protected Attributes

QVector< const AbstractColumn * > d_inputs
 The data sources connected to my input ports.

Private Attributes

Algorithm d_algorithm
 Fit algorithm to use.
bool d_auto_refit
 Whether to redo the fit each time input data changes.
int d_maxiter
 The maximum number of iterations to do before declaring the fit to have failed.
bool d_outdated
 If d_auto_refit is false, this is true when the input data has changed since the last fit.
double d_tolerance
 The tolerance ("epsilon") to be used for deciding when the fit was successful.
WeightingMethod d_weighting
 Where to take weights from.

Friends

class FitSetAlgorithmCmd
class Private

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index