|
SciDAVis
1.D4
|
#include <MultiPeakFit.h>
Public Types | |
| enum | PeakProfile { Gauss, Lorentz } |
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 *) |
Public Member Functions | |
| void | enablePeakCurves (bool on) |
| MultiPeakFit (ApplicationWindow *parent, Graph *g=0, PeakProfile profile=Gauss, int peaks=1) | |
| int | peaks () |
| void | setNumPeaks (int n) |
| void | setPeakCurvesColor (int colorIndex) |
Public Member Functions inherited from Fit | |
| double | chiSquare () |
| Returns the sum of squares of the residuals from the best-fit line. | |
| Matrix * | covarianceMatrix (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 QString | legendInfo () |
| Output string added to the plot as a new legend. | |
| int | numParameters () |
| Table * | parametersTable (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 () | |
Static Public Member Functions | |
| static QStringList | generateExplanationList (int order) |
| static QString | generateFormula (int order, PeakProfile profile) |
| static QStringList | generateParameterList (int order) |
Static Public Member Functions inherited from Fit | |
| static double | evaluate_df_helper (double x, void *param) |
Protected Member Functions | |
| void | guessInitialValues () |
| Used by the GaussFit and LorentzFit derived classes to calculate initial values for the parameters. | |
Protected Member Functions inherited from Fit | |
| 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. | |
| 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. | |
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. | |
Private Member Functions | |
| void | generateFitCurve (double *par) |
| Adds the result curve to the plot. | |
| void | insertPeakFunctionCurve (double *x, double *y, int peak) |
| Inserts a peak function curve into the plot. | |
| QString | logFitInfo (double *par, int iterations, int status, const QString &plotName) |
| Output string added to the result log. | |
| void | storeCustomFitResults (double *par) |
| Customs and stores the fit results according to the derived class specifications. Used by exponential fits. | |
Static Private Member Functions | |
| static QString | peakFormula (int peakIndex, PeakProfile profile) |
Private Attributes | |
| int | d_peaks |
| Number of peaks. | |
| int | d_peaks_color |
| Color index for the peak curves. | |
| PeakProfile | d_profile |
| The peak profile. | |
| bool | generate_peak_curves |
| Tells weather the peak curves should be displayed together with the best line fit. | |
Additional Inherited Members | |
Protected Slots inherited from Fit | |
| void | scriptError (const QString &message, const QString &script_name, int line_number) |
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 * | d_script |
| 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. | |
| Graph * | d_graph |
| 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. | |
| Table * | d_table |
| 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 | |
| ScriptingEnv * | scriptEnv |
| MultiPeakFit::MultiPeakFit | ( | ApplicationWindow * | parent, |
| Graph * | g = 0, |
||
| PeakProfile | profile = Gauss, |
||
| int | peaks = 1 |
||
| ) |
References Fit::covar, Fit::d_df, Fit::d_f, Fit::d_fdf, Fit::d_fsimplex, Fit::d_param_init, d_peaks_color, Fit::d_results, Gauss, gauss_multi_peak_d(), gauss_multi_peak_df(), gauss_multi_peak_f(), gauss_multi_peak_fdf(), generate_peak_curves, lorentz_multi_peak_d(), lorentz_multi_peak_df(), lorentz_multi_peak_f(), lorentz_multi_peak_fdf(), and setNumPeaks().
|
inline |
References generate_peak_curves.
Referenced by MultiPeakFitTool::MultiPeakFitTool().
|
static |
References peaks().
Referenced by setNumPeaks().
|
privatevirtual |
Adds the result curve to the plot.
Reimplemented from Fit.
References Graph::addFitCurve(), ColorBox::color(), Filter::d_curve, Filter::d_curveColorIndex, Filter::d_explanation, Fit::d_gen_function, Filter::d_graph, Filter::d_n, Fit::d_p, d_peaks, d_peaks_color, Filter::d_points, d_profile, Filter::d_x, Gauss, generate_peak_curves, ApplicationWindow::generateUniqueName(), Fit::insertFitFunctionCurve(), insertPeakFunctionCurve(), Graph::insertPlotItem(), Graph::Line, Table::name(), ApplicationWindow::newHiddenTable(), SciDAVis::Numeric, and Graph::replot().
|
static |
References Fit::formula(), Gauss, Lorentz, peakFormula(), and peaks().
Referenced by setNumPeaks(), and FitDialog::showExpression().
|
static |
References peaks().
Referenced by FitDialog::setFunction(), and setNumPeaks().
|
protectedvirtual |
Used by the GaussFit and LorentzFit derived classes to calculate initial values for the parameters.
Reimplemented from Fit.
References Filter::d_n, Fit::d_param_init, d_peaks, d_profile, Filter::d_x, Filter::d_y, Gauss, and Lorentz.
|
private |
Inserts a peak function curve into the plot.
References Graph::addFitCurve(), ColorBox::color(), Graph::curvesList(), Filter::d_graph, Filter::d_n, Fit::d_p, Fit::d_param_names, d_peaks_color, Filter::d_points, Filter::d_prec, d_profile, Fit::d_results, Filter::d_x, Fit::formula(), Graph::insertPlotItem(), Graph::Line, FunctionCurve::Normal, peakFormula(), FunctionCurve::setFormula(), and FunctionCurve::setRange().
Referenced by generateFitCurve().
|
privatevirtual |
Output string added to the result log.
Reimplemented from Fit.
References d_peaks, Filter::d_prec, d_profile, and Lorentz.
|
staticprivate |
References Fit::formula(), Gauss, and Lorentz.
Referenced by generateFormula(), and insertPeakFunctionCurve().
|
inline |
References d_peaks.
Referenced by generateExplanationList(), generateFormula(), and generateParameterList().
| void MultiPeakFit::setNumPeaks | ( | int | n | ) |
References Fit::covar, Filter::d_explanation, Fit::d_formula, Filter::d_min_points, Fit::d_p, Fit::d_param_explain, Fit::d_param_init, Fit::d_param_names, d_peaks, d_profile, Fit::d_results, Gauss, generateExplanationList(), generateFormula(), and generateParameterList().
Referenced by MultiPeakFit().
|
inline |
References d_peaks_color.
Referenced by MultiPeakFitTool::MultiPeakFitTool().
|
privatevirtual |
|
private |
Number of peaks.
Referenced by generateFitCurve(), guessInitialValues(), logFitInfo(), peaks(), setNumPeaks(), and storeCustomFitResults().
|
private |
Color index for the peak curves.
Referenced by generateFitCurve(), insertPeakFunctionCurve(), MultiPeakFit(), and setPeakCurvesColor().
|
private |
The peak profile.
Referenced by generateFitCurve(), guessInitialValues(), insertPeakFunctionCurve(), logFitInfo(), setNumPeaks(), and storeCustomFitResults().
|
private |
Tells weather the peak curves should be displayed together with the best line fit.
Referenced by enablePeakCurves(), generateFitCurve(), and MultiPeakFit().
1.8.1