SciDAVis  1.D4
Public Member Functions | Private Types | Private Member Functions | Private Attributes
PluginFit Class Reference

#include <PluginFit.h>

Inheritance diagram for PluginFit:
Fit Filter scripted

List of all members.

Public Member Functions

bool load (const QString &pluginName)
 PluginFit (ApplicationWindow *parent, Graph *g)
 PluginFit (ApplicationWindow *parent, Graph *g, const QString &curveTitle)
 PluginFit (ApplicationWindow *parent, Graph *g, const QString &curveTitle, double start, double end)
- Public Member Functions inherited from Fit
double chiSquare ()
 Returns the sum of squares of the residuals from the best-fit line.
MatrixcovarianceMatrix (const QString &matrixName)
double * errors ()
 Returns a vector with the standard deviations of the results.
double evaluate_d (const gsl_vector *x)
int evaluate_df (const gsl_vector *x, gsl_matrix *J)
int evaluate_f (const gsl_vector *x, gsl_vector *f)
 Fit (ApplicationWindow *parent, Graph *g=0, const char *name=0)
virtual void fit ()
 Actually does the fit. Should be reimplemented in derived classes.
QString formula ()
void generateFunction (bool yes, int points=100)
 Specifies weather the result of the fit is a function curve.
virtual void guessInitialValues ()
virtual QString legendInfo ()
 Output string added to the plot as a new legend.
int numParameters ()
TableparametersTable (const QString &tableName)
double * results ()
 Returns a vector with the fit results.
double rSquare ()
 Returns the coefficient of determination, R^2.
void scaleErrors (bool yes=true)
 Specifies wheather the errors must be scaled with sqrt(chi_2/dof)
void setAlgorithm (Algorithm s)
void setDataCurve (int curve, double start, double end)
void setInitialGuess (int parIndex, double val)
void setInitialGuesses (double *x_init)
bool setYErrorSource (ErrorSource err, const QString &colName=QString::null, bool fail_silently=false)
 Sets the data set to be used as source of Y errors.
 ~Fit ()
- Public Member Functions inherited from Filter
int dataSize ()
 Returns the size of the fitted data set.
bool error ()
 Filter (ApplicationWindow *parent, Table *t=0, const char *name=0)
 Filter (ApplicationWindow *parent, Graph *g=0, const char *name=0)
virtual bool run ()
 Actually does the job. Should be reimplemented in derived classes.
void setColor (int colorId)
 Sets the color of the output fit curve.
void setColor (const QString &colorName)
 Sets the color of the output fit curve. Provided for convenience. To be used in scripts only!
bool setDataFromCurve (const QString &curveTitle, Graph *g=0)
bool setDataFromCurve (const QString &curveTitle, double from, double to, Graph *g=0)
void setInterval (double from, double to)
 Changes the data range if the source curve was already assigned. Provided for convenience.
void setMaximumIterations (int iter)
 Sets the maximum number of iterations to be performed during an iterative session.
void setOutputPoints (int points)
 Sets the number of points in the output curve.
void setOutputPrecision (int digits)
 Sets the precision used for the output.
void setTolerance (double eps)
 Sets the tolerance used by the GSL routines.
virtual void showLegend ()
 Adds a new legend to the plot. Calls virtual legendInfo()
 ~Filter ()
- Public Member Functions inherited from scripted
 scripted (ScriptingEnv *env)
void scriptingChangeEvent (ScriptingChangeEvent *)
 ~scripted ()

Private Types

typedef double(* fitFunctionEval )(double, double *)

Private Member Functions

void calculateFitCurveData (double *par, double *X, double *Y)
 Calculates the data for the output fit curve and store itin the X an Y vectors.
void init ()

Private Attributes

fitFunctionEval f_eval

Additional Inherited Members

- Public Types inherited from Fit
enum  Algorithm { ScaledLevenbergMarquardt, UnscaledLevenbergMarquardt, NelderMeadSimplex }
enum  ErrorSource { UnknownErrors, AssociatedErrors, PoissonErrors, CustomErrors }
typedef int(* fit_function )(const gsl_vector *, void *, gsl_vector *)
typedef int(* fit_function_df )(const gsl_vector *, void *, gsl_matrix *)
typedef int(* fit_function_fdf )(const gsl_vector *, void *, gsl_vector *, gsl_matrix *)
typedef double(* fit_function_simplex )(const gsl_vector *, void *)
- Static Public Member Functions inherited from Fit
static double evaluate_df_helper (double x, void *param)
- Protected Slots inherited from Fit
void scriptError (const QString &message, const QString &script_name, int line_number)
- Protected Member Functions inherited from Fit
virtual void generateFitCurve (double *par)
 Adds the result curve to the plot.
void insertFitFunctionCurve (const QString &name, double *x, double *y, int penWidth=1)
 Adds the result curve as a FunctionCurve to the plot, if d_gen_function = true.
virtual QString logFitInfo (double *par, int iterations, int status, const QString &plotName)
 Output string added to the result log.
- Protected Member Functions inherited from Filter
QwtPlotCurve * addResultCurve (double *x, double *y)
 Adds the result curve to the target output plot window. Creates a hidden table and frees the input data from memory.
virtual void calculateOutputData (double *X, double *Y)
 Calculates the data for the output curve and store it in the X an Y vectors.
int curveIndex (const QString &curveTitle, Graph *g)
 Performs checks and returns the index of the source data curve if OK, -1 otherwise.
virtual bool isDataAcceptable ()
virtual QString logInfo ()
 Output string added to the log pannel of the application.
virtual void output ()
 Performs the data analysis and takes care of the output.
- Protected Attributes inherited from Fit
double chi_2
 The sum of squares of the residuals from the best-fit line.
gsl_matrix * covar
 Covariance matrix.
fit_function_df d_df
fit_function d_f
fit_function_fdf d_fdf
QString d_formula
 The fit formula.
fit_function_simplex d_fsimplex
bool d_gen_function
 Specifies weather the result curve is a FunctionCurve or a normal curve with the same x values as the fit data.
int d_p
 Number of fit parameters.
QStringList d_param_explain
 Stores a list of short explanations for the significance of the fit parameters.
gsl_vector * d_param_init
 Initial guesses for the fit parameters.
QStringList d_param_names
 Names of the fit parameters.
double * d_result_errors
 Stores standard deviations of the result parameters.
double * d_results
 Stores the result parameters.
bool d_scale_errors
 Specifies wheather the errors must be scaled with sqrt(chi_2/dof)
 Script used to evaluate user-defined functions.
Algorithm d_solver
 Algorithm type.
QString d_y_error_dataset
 The name of the dataset containing Y standard errors (if applicable).
ErrorSource d_y_error_source
 Where standard errors of the input data are taken from.
double * d_y_errors
 Standard deviations of Y input data.
bool is_non_linear
 Tells whether the fitter uses non-linear/simplex fitting with an initial parameters set, that must be freed in the destructor.
- Protected Attributes inherited from Filter
QwtPlotCurve * d_curve
 The curve to be analysed.
int d_curveColorIndex
 Color index of the result curve.
QString d_explanation
 String explaining the operation in the comment of the result table and in the project explorer.
double d_from
 Data interval.
 The graph where the result curve should be displayed.
bool d_init_err
 Error flag telling if something went wrong during the initialization phase.
int d_max_iterations
 Maximum number of iterations per fit.
int d_min_points
 Minimum number of data points necessary to perform the operation.
int d_n
 Size of the data arrays.
int d_points
 Number of result points to de calculated and displayed in the output curve.
int d_prec
 Precision (number of significant digits) used for the results output.
bool d_sort_data
 Specifies if the filter needs sorted data as input.
 A table source of data.
double d_to
double d_tolerance
 GSL Tolerance, if ever needed...
double * d_x
 x data set to be analysed
double * d_y
 y data set to be analysed
- Protected Attributes inherited from scripted

Member Typedef Documentation

typedef double(* PluginFit::fitFunctionEval)(double, double *)

Constructor & Destructor Documentation

PluginFit::PluginFit ( ApplicationWindow parent,
Graph g 

References init().

PluginFit::PluginFit ( ApplicationWindow parent,
Graph g,
const QString &  curveTitle 
PluginFit::PluginFit ( ApplicationWindow parent,
Graph g,
const QString &  curveTitle,
double  start,
double  end 

Member Function Documentation

void PluginFit::calculateFitCurveData ( double *  par,
double *  X,
double *  Y 

Calculates the data for the output fit curve and store itin the X an Y vectors.

Reimplemented from Fit.

References Fit::d_gen_function, Filter::d_n, Filter::d_points, Filter::d_x, and f_eval.

void PluginFit::init ( )

Reimplemented from Filter.

References Filter::d_explanation.

Referenced by PluginFit().

bool PluginFit::load ( const QString &  pluginName)

Member Data Documentation

fitFunctionEval PluginFit::f_eval

Referenced by calculateFitCurveData(), and load().

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