00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef MULTIPEAKFIT_H
00030 #define MULTIPEAKFIT_H
00031
00032 #include "Fit.h"
00033
00034 class MultiPeakFit : public Fit
00035 {
00036 Q_OBJECT
00037
00038 public:
00039 enum PeakProfile{Gauss, Lorentz};
00040 MultiPeakFit(ApplicationWindow *parent, Graph *g = 0, PeakProfile profile = Gauss, int peaks = 1);
00041
00042 int peaks(){return d_peaks;};
00043 void setNumPeaks(int n);
00044
00045 void enablePeakCurves(bool on){generate_peak_curves = on;};
00046 void setPeakCurvesColor(int colorIndex){d_peaks_color = colorIndex;};
00047
00048 static QString generateFormula(int order, PeakProfile profile);
00049 static QStringList generateParameterList(int order);
00050 static QStringList generateExplanationList(int order);
00051
00052 private:
00053 QString logFitInfo(double *par, int iterations, int status, const QString& plotName);
00054 void generateFitCurve(double *par);
00055 static QString peakFormula(int peakIndex, PeakProfile profile);
00057 void insertPeakFunctionCurve(double *x, double *y, int peak);
00058 void storeCustomFitResults(double *par);
00059
00061 void guessInitialValues();
00062
00064 int d_peaks;
00065
00067 bool generate_peak_curves;
00068
00070 int d_peaks_color;
00071
00073 PeakProfile d_profile;
00074 };
00075
00076 class LorentzFit : public MultiPeakFit
00077 {
00078 Q_OBJECT
00079
00080 public:
00081 LorentzFit(ApplicationWindow *parent, Graph *g);
00082 LorentzFit(ApplicationWindow *parent, Graph *g, const QString& curveTitle);
00083 LorentzFit(ApplicationWindow *parent, Graph *g, const QString& curveTitle, double start, double end);
00084
00085 private:
00086 void init();
00087 };
00088
00089 class GaussFit : public MultiPeakFit
00090 {
00091 Q_OBJECT
00092
00093 public:
00094 GaussFit(ApplicationWindow *parent, Graph *g);
00095 GaussFit(ApplicationWindow *parent, Graph *g, const QString& curveTitle);
00096 GaussFit(ApplicationWindow *parent, Graph *g, const QString& curveTitle, double start, double end);
00097
00098 private:
00099 void init();
00100 };
00101
00102 class GaussAmpFit : public Fit
00103 {
00104 Q_OBJECT
00105
00106 public:
00107 GaussAmpFit(ApplicationWindow *parent, Graph *g);
00108 GaussAmpFit(ApplicationWindow *parent, Graph *g, const QString& curveTitle);
00109 GaussAmpFit(ApplicationWindow *parent, Graph *g, const QString& curveTitle, double start, double end);
00110
00111 private:
00112 void init();
00113 void calculateFitCurveData(double *par, double *X, double *Y);
00114 };
00115 #endif