SciDAVis
1.D4
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
scidavis
src
MultiPeakFit.h
Go to the documentation of this file.
1
/***************************************************************************
2
File : MultiPeakFit.h
3
Project : SciDAVis
4
--------------------------------------------------------------------
5
Copyright : (C) 2006 by Ion Vasilief, Tilman Benkert
6
Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net
7
Description : MultiPeakFit module with Lorentz and Gauss peak shapes
8
9
***************************************************************************/
10
11
/***************************************************************************
12
* *
13
* This program is free software; you can redistribute it and/or modify *
14
* it under the terms of the GNU General Public License as published by *
15
* the Free Software Foundation; either version 2 of the License, or *
16
* (at your option) any later version. *
17
* *
18
* This program is distributed in the hope that it will be useful, *
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21
* GNU General Public License for more details. *
22
* *
23
* You should have received a copy of the GNU General Public License *
24
* along with this program; if not, write to the Free Software *
25
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26
* Boston, MA 02110-1301 USA *
27
* *
28
***************************************************************************/
29
#ifndef MULTIPEAKFIT_H
30
#define MULTIPEAKFIT_H
31
32
#include "
Fit.h
"
33
34
class
MultiPeakFit
:
public
Fit
35
{
36
Q_OBJECT
37
38
public
:
39
enum
PeakProfile
{
Gauss
,
Lorentz
};
40
MultiPeakFit
(
ApplicationWindow
*parent,
Graph
*g = 0,
PeakProfile
profile =
Gauss
,
int
peaks
= 1);
41
42
int
peaks
(){
return
d_peaks
;};
43
void
setNumPeaks
(
int
n);
44
45
void
enablePeakCurves
(
bool
on){
generate_peak_curves
= on;};
46
void
setPeakCurvesColor
(
int
colorIndex){
d_peaks_color
= colorIndex;};
47
48
static
QString
generateFormula
(
int
order,
PeakProfile
profile);
49
static
QStringList
generateParameterList
(
int
order);
50
static
QStringList
generateExplanationList
(
int
order);
51
52
private
:
53
QString
logFitInfo
(
double
*par,
int
iterations,
int
status,
const
QString& plotName);
54
void
generateFitCurve
(
double
*par);
55
static
QString
peakFormula
(
int
peakIndex,
PeakProfile
profile);
57
void
insertPeakFunctionCurve
(
double
*x,
double
*y,
int
peak);
58
void
storeCustomFitResults
(
double
*par);
59
61
protected
:
62
void
guessInitialValues
();
63
private
:
65
int
d_peaks
;
66
68
bool
generate_peak_curves
;
69
71
int
d_peaks_color
;
72
74
PeakProfile
d_profile
;
75
};
76
77
class
LorentzFit
:
public
MultiPeakFit
78
{
79
Q_OBJECT
80
81
public
:
82
LorentzFit
(
ApplicationWindow
*parent,
Graph
*g);
83
LorentzFit
(
ApplicationWindow
*parent,
Graph
*g,
const
QString& curveTitle);
84
LorentzFit
(
ApplicationWindow
*parent,
Graph
*g,
const
QString& curveTitle,
double
start,
double
end);
85
86
private
:
87
void
init
();
88
};
89
90
class
GaussFit
:
public
MultiPeakFit
91
{
92
Q_OBJECT
93
94
public
:
95
GaussFit
(
ApplicationWindow
*parent,
Graph
*g);
96
GaussFit
(
ApplicationWindow
*parent,
Graph
*g,
const
QString& curveTitle);
97
GaussFit
(
ApplicationWindow
*parent,
Graph
*g,
const
QString& curveTitle,
double
start,
double
end);
98
99
private
:
100
void
init
();
101
};
102
103
class
GaussAmpFit
:
public
Fit
104
{
105
Q_OBJECT
106
107
public
:
108
GaussAmpFit
(
ApplicationWindow
*parent,
Graph
*g);
109
GaussAmpFit
(
ApplicationWindow
*parent,
Graph
*g,
const
QString& curveTitle);
110
GaussAmpFit
(
ApplicationWindow
*parent,
Graph
*g,
const
QString& curveTitle,
double
start,
double
end);
111
112
private
:
113
void
init
();
114
void
calculateFitCurveData
(
double
*par,
double
*X,
double
*Y);
115
};
116
#endif
Generated by
1.8.1