MultiPeakFit.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : MultiPeakFit.h
00003     Project              : QtiPlot
00004     --------------------------------------------------------------------
00005     Copyright            : (C) 2006 by Ion Vasilief, Tilman Hoener zu Siederdissen
00006     Email (use @ for *)  : ion_vasilief*yahoo.fr, thzs*gmx.net
00007     Description          : MultiPeakFit module with Lorentz and Gauss peak shapes
00008                            
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *  This program is free software; you can redistribute it and/or modify   *
00014  *  it under the terms of the GNU General Public License as published by   *
00015  *  the Free Software Foundation; either version 2 of the License, or      *
00016  *  (at your option) any later version.                                    *
00017  *                                                                         *
00018  *  This program is distributed in the hope that it will be useful,        *
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00021  *  GNU General Public License for more details.                           *
00022  *                                                                         *
00023  *   You should have received a copy of the GNU General Public License     *
00024  *   along with this program; if not, write to the Free Software           *
00025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
00026  *   Boston, MA  02110-1301  USA                                           *
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

Generated on Mon Oct 15 06:11:42 2007 for QtiPlot by  doxygen 1.5.3