27 #ifndef fitExpModGaussian_hpp
28 #define fitExpModGaussian_hpp
31 #include "../func/expModGaussian.hpp"
40 template<
typename realT>
41 struct array2FitExpModGaussian;
65 template<
typename fitterT>
71 typedef typename fitterT::realT realT;
73 static const int nparams = fitterT::nparams;
99 static_assert( nparams==4 ,
"fitExpModGaussian: Wrong setGuess called for no location parameter.");
113 static_assert( nparams==3 ,
"fitExpModGaussian: Wrong setGuess called for no location parameter.");
120 void setArray(realT *data,
int n)
144 void sigma( realT ns )
150 void lambda( realT nl)
195 template<
typename realT>
213 template<
typename _realT>
216 typedef _realT realT;
218 static const int nparams = 3;
220 static void func(realT *p, realT *hx,
int m,
int n,
void *adata)
224 for(
int i=0;i<arr->
n; i++)
226 hx[i] = func::expModGaussian<realT>(i, p[0], p[1], p[2]) - arr->
data[i];
237 template<
typename _realT>
240 typedef _realT realT;
242 static const int nparams = 4;
244 static void func(realT *p, realT *hx,
int m,
int n,
void *adata)
248 for(
int i=0;i<arr->
n; i++)
250 hx[i] = p[3] + func::expModGaussian<realT>(i, p[0], p[1], p[2]) - arr->
data[i];
Class to manage fitting the Exponetially Modified Gaussian Distribution to data via the levmarInterfa...
void setGuess(realT mu, realT sigma, realT lambda)
Set the initial guess.
void setGuess(realT G0, realT mu, realT sigma, realT lambda)
Set the initial guess.
A templatized interface to the levmar package.
int fit()
Perform the fit.
void allocate_params()
Allocate parameters array based on previous call to nParams.
realT * p
Parameter array. On input is the initial estimates. On output has the estimated solution.
int n
I: measurement vector dimension.
void * adata
Pointer to possibly additional data, passed uninterpreted to func & jacf.
A c++ interface to the templatized levmar minimization routines..
Wrapper for a native array to pass to levmarInterface, with Exponentially Modified Gaussian details.
size_t n
dimension of the array
realT lambda
the denominator or 1/peak-scale
realT G0
the location parameter.
realT * data
Pointer to the array.
realT sigma
the scale parameter
realT mu
the shape parameter
levmarInterface fitter structure for the Exponentially Modified Gaussian with fixed constant level.
levmarInterface fitter structure for the Exponentially Modified Gaussian with arbitrary constant leve...