1#ifndef TTTRLIB_DECAYFIT_H
2#define TTTRLIB_DECAYFIT_H
35 auto s = std::stringstream();
36 s <<
"-- Correction factors:\n";
37 s <<
"-- g-factor: " <<
g << std::endl;
38 s <<
"-- l1, l2: " <<
l1 <<
", " <<
l2 << std::endl;
39 s <<
"-- period: " <<
period << std::endl;
72 auto s = std::stringstream();
73 s <<
"DECAYFITSETTINGS: " << std::endl;
74 s <<
"-- fixedrho: " <<
fixedrho << std::endl;
75 s <<
"-- softbifl: " <<
softbifl << std::endl;
77 s <<
"-- firstcall: " <<
firstcall << std::endl;
78 s <<
"-- penalty: " <<
penalty << std::endl;
115 return (
Sp - g *
Bp) / (1. - g);
127 return (
Ss - g *
Bs) / (1. - g);
134 double g = 1.0, l1 = 0.0, l2 = 0.0;
140 double nom = (fp - g * fs);
141 double denom = (fp * (1. - 3. * l2) + (2. - 3. * l1) * g * fs);
145 double rho(
double tau,
double r0){
146 double rh = tau / (r0 /
r() - 1.);
147 return std::max(rh, 1.e-4);
151 double g = 1.0, l1 = 0.0, l2 = 0.0;
157 return (
Sp - g *
Ss) / (
Sp * (1. - 3. * l2) + (2. - 3. * l1) * g *
Ss);
182 void normM(
double *M,
int Nchannels);
193 void normM(
double *M,
double s,
int Nchannels);
211 auto s = std::stringstream();
212 s <<
"-- Signals: " << std::endl;
213 s <<
"-- Bp, Bs: " <<
Bp <<
", " <<
Bs << std::endl;
214 s <<
"-- Sp, Ss: " <<
Sp <<
", " <<
Ss << std::endl;
215 s <<
"-- Fp, Fs: " <<
Fp() <<
", " <<
Fs() << std::endl;
216 s <<
"-- r: " <<
r() << std::endl;
Definition DecayFit.h:227
static double targetf(double *x, void *pv)
Target function (to minimize)
Definition DecayFit.h:268
static void correct_input(double *x, double *xm, LVDoubleArray *corrections, int return_r)
Definition DecayFit.h:297
static double fit(double *x, short *fixed, MParam *p)
Definition DecayFit.h:282
static int modelf(double *param, double *irf, double *bg, int Nchannels, double dt, double *corrections, double *mfunction)
Function to compute a model fluorescence decay.
Definition DecayFit.h:246
double l1
Definition DecayFit.h:20
std::string str()
Definition DecayFit.h:34
void set_gamma(double v)
Definition DecayFit.h:25
double g
Definition DecayFit.h:19
DecayFitCorrections(double gamma=0.0, double g=1.0, double l1=0.0, double l2=0.0, double period=1000, int convolution_stop=0)
Definition DecayFit.h:44
double period
Definition DecayFit.h:22
double l2
Definition DecayFit.h:21
int convolution_stop
Definition DecayFit.h:23
double gamma
Definition DecayFit.h:18
void normM(double *M, double s, int Nchannels)
double rho(double tau, double r0)
Definition DecayFit.h:145
void compute_signal_and_background(MParam *p)
double Ss
Total signal perpendicular.
Definition DecayFit.h:92
double Fs()
Definition DecayFit.h:119
double Bs
Total background signal perpendicular.
Definition DecayFit.h:98
double Fp()
Definition DecayFit.h:107
DecayFitIntegrateSignals(DecayFitCorrections *corrections=nullptr)
Definition DecayFit.h:220
double rs()
Definition DecayFit.h:150
double r()
Definition DecayFit.h:131
std::string str()
Definition DecayFit.h:210
void normM_p2s(double *M, int Nchannels)
DecayFitCorrections * corrections
Definition DecayFit.h:86
double Bp
Total background signal parallel.
Definition DecayFit.h:95
double Bexpected
expected corresponding to the mean Bg signal
Definition DecayFit.h:104
double B
Total background.
Definition DecayFit.h:101
double Sp
Total signal parallel.
Definition DecayFit.h:89
void normM(double *M, int Nchannels)
double penalty
Definition DecayFit.h:69
int firstcall
Definition DecayFit.h:68
int softbifl
Definition DecayFit.h:66
int p2s_twoIstar
Definition DecayFit.h:67
int fixedrho
Definition DecayFit.h:65
std::string str()
Definition DecayFit.h:71