TPCCLIB
|
Setting and checking fit parameter constraints and limits. More...
#include "libtpcmodel.h"
Go to the source code of this file.
Functions | |
int | modelCheckParameters (int par_nr, double *lower_p, double *upper_p, double *test_p, double *accept_p, double *penalty) |
int | modelCheckLimits (int par_nr, double *lower_p, double *upper_p, double *test_p) |
int | fitExpDecayNNLS (double *x, double *y, int n, double fittime, double kmin, double kmax, int pnr, double *a, double *k, int *fnr, int verbose) |
Estimate initial values for sum of exponentials to be fitted on decaying x,y-data. | |
Setting and checking fit parameter constraints and limits.
Definition in file constraints.c.
int fitExpDecayNNLS | ( | double * | x, |
double * | y, | ||
int | n, | ||
double | fittime, | ||
double | kmin, | ||
double | kmax, | ||
int | pnr, | ||
double * | a, | ||
double * | k, | ||
int * | fnr, | ||
int | verbose ) |
Estimate initial values for sum of exponentials to be fitted on decaying x,y-data.
x | Pointer to array of x values; must not contain NaNs; data is not changed; samples must be sorted by increasing x. |
y | Pointer to array of y values; must not contain NaNs; data is not changed. |
n | Nr of x and y samples (x and y array lengths); data is not changed. |
fittime | Fittime is usually set to <=0 or a very high value to start the search for the best line fit from the last x,y sample towards the first sample; However, to exclude the end phase you may want to set fittime to include only certain time range from the beginning. |
kmin | Minimum eigenvalue, must be >0; for example, 1.0E-06. |
kmax | Maximum eigenvalue; for example, 1.0E+03. |
pnr | Max number of exp functions to save; length of a[] and k[] arrays. |
a | Pointer to an array of length pnr where exp function coefficients will be written; enter NULL if not needed. |
k | Pointer to an array of length pnr where exp function eigenvalues will be written; enter NULL if not needed. |
fnr | The number of fitted exponentials will be written in here; note that this number may be higher than pnr; enter NULL if not needed. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout |
Definition at line 100 of file constraints.c.
int modelCheckLimits | ( | int | par_nr, |
double * | lower_p, | ||
double * | upper_p, | ||
double * | test_p ) |
Check if model parameters have collided with given limits.
If parameter is fixed (equal lower and upper limit) then it is not counted as collision.
par_nr | Nr of parameters |
lower_p | Lower limits |
upper_p | Upper limits |
test_p | Parameters to test |
Definition at line 59 of file constraints.c.
int modelCheckParameters | ( | int | par_nr, |
double * | lower_p, | ||
double * | upper_p, | ||
double * | test_p, | ||
double * | accept_p, | ||
double * | penalty ) |
Check that model parameters are within given limits. If not, then compute a penalty factor.
par_nr | Nr of parameters |
lower_p | Lower limits |
upper_p | Upper limits |
test_p | Parameters to test |
accept_p | Pointer to corrected parameters (NULL if not needed) |
penalty | Pointer to variable in which the possible penalty factor will be written; 1 if no penalty, or >1. Set to NULL if not needed. |
Definition at line 15 of file constraints.c.