1 | /* |
---|
2 | This file is part of the SLIM-curve package for exponential curve fitting of spectral lifetime data. |
---|
3 | |
---|
4 | Copyright (c) 2010, 2011, Gray Institute University of Oxford & UW-Madison LOCI. |
---|
5 | |
---|
6 | This program is free software: you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation, either version 3 of the License, or |
---|
9 | (at your option) any later version. |
---|
10 | |
---|
11 | This program is distributed in the hope that it will be useful, |
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | GNU General Public License for more details. |
---|
15 | |
---|
16 | You should have received a copy of the GNU General Public License |
---|
17 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
18 | */ |
---|
19 | |
---|
20 | /* This is EcfInternal.h, the header file for internal functions in |
---|
21 | the 2003 version of the ECF library. */ |
---|
22 | |
---|
23 | #ifndef _GCI_ECF_INTERNAL |
---|
24 | #define _GCI_ECF_INTERNAL |
---|
25 | |
---|
26 | #include "Ecf.h" /* in case there's anything we need from there */ |
---|
27 | |
---|
28 | #define MAXFIT 20 /* The maximum number of parameters we'll ever try |
---|
29 | to fit; saves dynamic allocation of small arrays. |
---|
30 | If this is increased, then the arrays chisq50 etc. |
---|
31 | in ecf.c will need to be extended. The values can |
---|
32 | be calculated by using the test function at the end |
---|
33 | of the file. */ |
---|
34 | |
---|
35 | #define MAXITERS 80 |
---|
36 | #define MAXREFITS 10 |
---|
37 | #define MAXBINS 2048 /* Maximum number of lifetime bins; saves dynamic allocation of small arrays */ |
---|
38 | |
---|
39 | /* Functions from EcfSingle.c */ |
---|
40 | |
---|
41 | int GCI_marquardt_compute_fn(float x[], float y[], int ndata, |
---|
42 | noise_type noise, float sig[], |
---|
43 | float param[], int paramfree[], int nparam, |
---|
44 | void (*fitfunc)(float, float [], float *, float [], int), |
---|
45 | float yfit[], float dy[], |
---|
46 | float **alpha, float beta[], float *chisq, float old_chisq, |
---|
47 | float alambda); |
---|
48 | int GCI_marquardt_compute_fn_instr(float xincr, float y[], int ndata, |
---|
49 | int fit_start, int fit_end, |
---|
50 | float instr[], int ninstr, |
---|
51 | noise_type noise, float sig[], |
---|
52 | float param[], int paramfree[], int nparam, |
---|
53 | void (*fitfunc)(float, float [], float *, float [], int), |
---|
54 | float yfit[], float dy[], |
---|
55 | float **alpha, float beta[], float *chisq, float old_chisq, |
---|
56 | float alambda, |
---|
57 | float **pfnvals, float ***pdy_dparam_pure, float ***pdy_dparam_conv, |
---|
58 | int *pfnvals_len, int *pdy_dparam_nparam_size); |
---|
59 | int GCI_marquardt_compute_fn_final(float x[], float y[], int ndata, |
---|
60 | noise_type noise, float sig[], |
---|
61 | float param[], int paramfree[], int nparam, |
---|
62 | void (*fitfunc)(float, float [], float *, float [], int), |
---|
63 | float yfit[], float dy[], float *chisq); |
---|
64 | int GCI_marquardt_compute_fn_final_instr(float xincr, float y[], int ndata, |
---|
65 | int fit_start, int fit_end, |
---|
66 | float instr[], int ninstr, |
---|
67 | noise_type noise, float sig[], |
---|
68 | float param[], int paramfree[], int nparam, |
---|
69 | void (*fitfunc)(float, float [], float *, float [], int), |
---|
70 | float yfit[], float dy[], float *chisq, |
---|
71 | float **pfnvals, float ***pdy_dparam_pure, float ***pdy_dparam_conv, |
---|
72 | int *pfnvals_len, int *pdy_dparam_nparam_size); |
---|
73 | |
---|
74 | /* Functions from EcfGlobal.c */ |
---|
75 | |
---|
76 | |
---|
77 | /* Functions from EcfUtil.c */ |
---|
78 | |
---|
79 | int GCI_solve(float **a, int, float *b); |
---|
80 | int GCI_invert(float **a, int); |
---|
81 | void GCI_covar_sort(float **covar, int nparam, int paramfree[], int mfit); |
---|
82 | float ***GCI_ecf_matrix_array(long nblocks, long nrows, long ncols); |
---|
83 | void GCI_ecf_free_matrix_array(float ***marr); |
---|
84 | int check_ecf_params (float param[], int nparam, |
---|
85 | void (*fitfunc)(float, float [], float *, float [], int)); |
---|
86 | int check_ecf_user_params (float param[], int nparam, |
---|
87 | void (*fitfunc)(float, float [], float *, float [], int)); |
---|
88 | int GCI_chisq(int nu, float chisq, float *root); |
---|
89 | int multiexp_lambda_array(float xincr, float param[], |
---|
90 | float *y, float **dy_dparam, int nx, int nparam); |
---|
91 | int multiexp_tau_array(float xincr, float param[], |
---|
92 | float *y, float **dy_dparam, int nx, int nparam); |
---|
93 | int stretchedexp_array(float xincr, float param[], |
---|
94 | float *y, float **dy_dparam, int nx, int nparam); |
---|
95 | int ECF_Find_Float_Max (float data[], int np, float *max_val); |
---|
96 | |
---|
97 | /* For debugging printing */ |
---|
98 | extern int ECF_debug; /* defined in EcfUtil.c */ |
---|
99 | int dbgprintf(int dbg_level, const char *format, ...); |
---|
100 | |
---|
101 | // Vars for the export of params at each iteration |
---|
102 | int ecf_exportParams; |
---|
103 | char ecf_exportParams_path[256]; |
---|
104 | |
---|
105 | void ecf_ExportParams_OpenFile (void); |
---|
106 | void ecf_ExportParams_CloseFile (void); |
---|
107 | void ecf_ExportParams (float param[], int nparam, float chisq); |
---|
108 | |
---|
109 | #endif /* _GCI_ECF_INTERNAL */ |
---|
110 | |
---|
111 | |
---|
112 | // Emacs settings: |
---|
113 | // Local variables: |
---|
114 | // mode: c |
---|
115 | // c-basic-offset: 4 |
---|
116 | // tab-width: 4 |
---|
117 | // End: |
---|