|
TPCCLIB
|
BFM for the sum of decaying exponential functions. More...
#include "tpcclibConfig.h"#include <stdio.h>#include <stdlib.h>#include <math.h>#include <time.h>#include <string.h>#include "tpcextensions.h"#include "tpclinopt.h"#include "tpcbfm.h"Go to the source code of this file.
Functions | |
| int | spectralDExp (const double *x, const double *y, double *w, const int snr, const double kmin, const double kmax, const int bnr, double *k, double *a, double *yfit, TPCSTATUS *status) |
| int | spectralKRange (double *k, double *a, const int n, double *kmin, double *kmax, TPCSTATUS *status) |
| int | spectralBFNr (double *k, double *a, const int n) |
| int | spectralBFExtract (double *k, double *a, const int n, double *ke, double *ae, const int ne) |
BFM for the sum of decaying exponential functions.
Definition in file bf_dexp.c.
| int spectralBFExtract | ( | double * | k, |
| double * | a, | ||
| const int | n, | ||
| double * | ke, | ||
| double * | ae, | ||
| const int | ne ) |
After spectral x,y-data fitting to the sum of decaying exponential functions, extract the zero-separated (positive a) basis functions we actually got.
The maximum number of basis function parameters to be extracted must be specified; if more are found, then the ones with smallest a are averaged. If less are found, then the rest of output arrays are filled with zeroes, and the returned actual number is smaller than the requested number.
| k | Pointer to k array of length n; must be sorted to either order, as those usually are. Contents are not modified. |
| a | Pointer to a array of length n; not modified. |
| n | Length of k and a arrays. |
| ke | Pointer to an allocated array of extracted k values of length ne. |
| ae | Pointer to an allocated array of extracted a values of length ne; not modified. |
| ne | Length of k and a arrays, and the maximum number of parameters to extract. |
Definition at line 227 of file bf_dexp.c.
| int spectralBFNr | ( | double * | k, |
| double * | a, | ||
| const int | n ) |
After spectral x,y-data fitting to the sum of decaying exponential functions, determine the number of zero-separated (positive a) basis functions we actually got.
| k | Pointer to k array of length n; does not need to be in specific order, although those usually are. Contents are not modified. |
| a | Pointer to a array of length n; not modified. |
| n | Length of k and a arrays. |
Definition at line 193 of file bf_dexp.c.
Referenced by spectralBFExtract().
| int spectralDExp | ( | const double * | x, |
| const double * | y, | ||
| double * | w, | ||
| const int | snr, | ||
| const double | kmin, | ||
| const double | kmax, | ||
| const int | bnr, | ||
| double * | k, | ||
| double * | a, | ||
| double * | yfit, | ||
| TPCSTATUS * | status ) |
Spectral x,y-data fitting to the sum of decaying exponential functions.
f(x) = a1*exp(-k1*x) + a2*exp(-k2*x) + a3*exp(-k3*x) + ... where aN>=0 and kN>0.
| x | Pointer to TAC x data (not modified). Data must be sorted by increasing x. Negative or missing x values are not allowed. |
| y | Pointer to TAC y data (not modified). Data must be sorted by increasing x. Missing y values are not allowed. |
| w | Pointer to TAC sample weights (not modified). Enter NULL if not needed. |
| snr | Number of samples in x[] and y[]; at least 3. |
| kmin | Minimum of k (set based on sample range and unit); must be >0. |
| kmax | Maximum of k (set based on sample range and unit); must be >kmin. |
| bnr | Number of basis functions to calculate; also the length of arrays k[] and a[]; at least 4. |
| k | Pointer to array of length bnr for k values, filled in by this function. |
| a | Pointer to array of length bnr for a values, filled in by this function; notice that most values may be set to zero. |
| yfit | Pointer to array for fitted y values. Enter NULL if not needed. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 28 of file bf_dexp.c.
| int spectralKRange | ( | double * | k, |
| double * | a, | ||
| const int | n, | ||
| double * | kmin, | ||
| double * | kmax, | ||
| TPCSTATUS * | status ) |
After spectral x,y-data fitting to the sum of decaying exponential functions, determine the min and max of k values with positive a value.
| k | Pointer to k array of length n; does not need to be in specific order, although those usually are. Contents are not modified. |
| a | Pointer to a array of length n; not modified. |
| n | Length of k and a arrays. |
| kmin | Pointer min k value. Enter NULL if not needed. |
| kmax | Pointer max k value. Enter NULL if not needed. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 145 of file bf_dexp.c.