Fit Class Reference

#include <Fit.h>

Inheritance diagram for Fit:

Filter ExponentialFit GaussAmpFit LinearFit MultiPeakFit NonLinearFit PluginFit PolynomialFit SigmoidalFit ThreeExpFit TwoExpFit

List of all members.


Detailed Description

Fit base class.

Public Types

enum  Algorithm { ScaledLevenbergMarquardt, UnscaledLevenbergMarquardt, NelderMeadSimplex }
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 *)
enum  WeightingMethod { NoWeighting, Instrumental, Statistical, Dataset }

Public Member Functions

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.
virtual void fit ()
 Actually does the fit. Should be reimplemented in derived classes.
 Fit (ApplicationWindow *parent, Graph *g=0, const char *name=0)
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 R^2.
virtual bool run ()
 Actually does the job. Should be reimplemented in derived classes.
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 setWeightingData (WeightingMethod w, const QString &colName=QString::null)
 Sets the data set to be used for weighting.
 ~Fit ()

Protected Member Functions

virtual void calculateFitCurveData (double *par, double *X, double *Y)
 Calculates the data for the output fit curve and store itin the X an Y vectors.
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 Attributes

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
double * d_errors
 Stores standard deviations of the result parameters.
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_results
 Stores the result parameters.
bool d_scale_errors
 Specifies wheather the errors must be scaled with sqrt(chi_2/dof).
Algorithm d_solver
 Algorithm type.
double * d_w
 weighting data set used for the fit
WeightingMethod d_weihting
 The kind of weighting to be performed on the 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.
QString weighting_dataset
 The name of the weighting dataset.

Private Member Functions

gsl_multifit_fdfsolver * fitGSL (gsl_multifit_function_fdf f, int &iterations, int &status)
 Pointer to the GSL multifit solver.
gsl_multimin_fminimizer * fitSimplex (gsl_multimin_function f, int &iterations, int &status)
 Pointer to the GSL multifit minimizer (for simplex algorithm).
virtual void storeCustomFitResults (double *par)
 Customs and stores the fit results according to the derived class specifications. Used by exponential fits.

Member Typedef Documentation

typedef int(* Fit::fit_function)(const gsl_vector *, void *, gsl_vector *)

typedef int(* Fit::fit_function_df)(const gsl_vector *, void *, gsl_matrix *)

typedef int(* Fit::fit_function_fdf)(const gsl_vector *, void *, gsl_vector *, gsl_matrix *)

typedef double(* Fit::fit_function_simplex)(const gsl_vector *, void *)


Member Enumeration Documentation

enum Fit::Algorithm

Enumerator:
ScaledLevenbergMarquardt 
UnscaledLevenbergMarquardt 
NelderMeadSimplex 

enum Fit::WeightingMethod

Enumerator:
NoWeighting 
Instrumental 
Statistical 
Dataset 


Constructor & Destructor Documentation

Fit::Fit ( ApplicationWindow parent,
Graph g = 0,
const char *  name = 0 
)

Fit::~Fit (  ) 


Member Function Documentation

virtual void Fit::calculateFitCurveData ( double *  par,
double *  X,
double *  Y 
) [inline, protected, virtual]

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

Reimplemented in ExponentialFit, TwoExpFit, ThreeExpFit, GaussAmpFit, NonLinearFit, PluginFit, PolynomialFit, LinearFit, and SigmoidalFit.

double Fit::chiSquare (  )  [inline]

Returns the sum of squares of the residuals from the best-fit line.

Matrix * Fit::covarianceMatrix ( const QString &  matrixName  ) 

double * Fit::errors (  ) 

Returns a vector with the standard deviations of the results.

void Fit::fit (  )  [virtual]

Actually does the fit. Should be reimplemented in derived classes.

Reimplemented in PolynomialFit, and LinearFit.

gsl_multifit_fdfsolver * Fit::fitGSL ( gsl_multifit_function_fdf  f,
int &  iterations,
int &  status 
) [private]

Pointer to the GSL multifit solver.

gsl_multimin_fminimizer * Fit::fitSimplex ( gsl_multimin_function  f,
int &  iterations,
int &  status 
) [private]

Pointer to the GSL multifit minimizer (for simplex algorithm).

QString Fit::formula (  )  [inline]

void Fit::generateFitCurve ( double *  par  )  [protected, virtual]

Adds the result curve to the plot.

Reimplemented in MultiPeakFit.

void Fit::generateFunction ( bool  yes,
int  points = 100 
)

Specifies weather the result of the fit is a function curve.

virtual void Fit::guessInitialValues (  )  [inline, virtual]

Reimplemented in MultiPeakFit, and SigmoidalFit.

void Fit::insertFitFunctionCurve ( const QString &  name,
double *  x,
double *  y,
int  penWidth = 1 
) [protected]

Adds the result curve as a FunctionCurve to the plot, if d_gen_function = true.

QString Fit::legendInfo (  )  [virtual]

Output string added to the plot as a new legend.

Reimplemented from Filter.

Reimplemented in PolynomialFit.

QString Fit::logFitInfo ( double *  par,
int  iterations,
int  status,
const QString &  plotName 
) [protected, virtual]

Output string added to the result log.

Reimplemented in MultiPeakFit.

int Fit::numParameters (  )  [inline]

Table * Fit::parametersTable ( const QString &  tableName  ) 

double* Fit::results (  )  [inline]

Returns a vector with the fit results.

double Fit::rSquare (  ) 

Returns R^2.

virtual bool Fit::run (  )  [inline, virtual]

Actually does the job. Should be reimplemented in derived classes.

Reimplemented from Filter.

void Fit::scaleErrors ( bool  yes = true  )  [inline]

Specifies wheather the errors must be scaled with sqrt(chi_2/dof).

void Fit::setAlgorithm ( Algorithm  s  )  [inline]

void Fit::setDataCurve ( int  curve,
double  start,
double  end 
) [virtual]

Reimplemented from Filter.

void Fit::setInitialGuess ( int  parIndex,
double  val 
) [inline]

void Fit::setInitialGuesses ( double *  x_init  ) 

bool Fit::setWeightingData ( WeightingMethod  w,
const QString &  colName = QString::null 
)

Sets the data set to be used for weighting.

void Fit::storeCustomFitResults ( double *  par  )  [private, virtual]

Customs and stores the fit results according to the derived class specifications. Used by exponential fits.

Reimplemented in ExponentialFit, TwoExpFit, ThreeExpFit, and MultiPeakFit.


Member Data Documentation

double Fit::chi_2 [protected]

The sum of squares of the residuals from the best-fit line.

gsl_matrix* Fit::covar [protected]

Covariance matrix.

fit_function_df Fit::d_df [protected]

double* Fit::d_errors [protected]

Stores standard deviations of the result parameters.

fit_function Fit::d_f [protected]

fit_function_fdf Fit::d_fdf [protected]

QString Fit::d_formula [protected]

The fit formula.

fit_function_simplex Fit::d_fsimplex [protected]

bool Fit::d_gen_function [protected]

Specifies weather the result curve is a FunctionCurve or a normal curve with the same x values as the fit data.

int Fit::d_p [protected]

Number of fit parameters.

QStringList Fit::d_param_explain [protected]

Stores a list of short explanations for the significance of the fit parameters.

gsl_vector* Fit::d_param_init [protected]

Initial guesses for the fit parameters.

QStringList Fit::d_param_names [protected]

Names of the fit parameters.

double* Fit::d_results [protected]

Stores the result parameters.

bool Fit::d_scale_errors [protected]

Specifies wheather the errors must be scaled with sqrt(chi_2/dof).

Algorithm Fit::d_solver [protected]

Algorithm type.

double* Fit::d_w [protected]

weighting data set used for the fit

WeightingMethod Fit::d_weihting [protected]

The kind of weighting to be performed on the data.

bool Fit::is_non_linear [protected]

Tells whether the fitter uses non-linear/simplex fitting with an initial parameters set, that must be freed in the destructor.

QString Fit::weighting_dataset [protected]

The name of the weighting dataset.


The documentation for this class was generated from the following files:
Generated on Mon Oct 15 06:11:43 2007 for QtiPlot by  doxygen 1.5.3