GIRAFFE Pipeline Reference Manual

gimath_lm.h
1 /* $Id$
2  *
3  * This file is part of the GIRAFFE Pipeline
4  * Copyright (C) 2002-2006 European Southern Observatory
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 2 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, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author$
23  * $Date$
24  * $Revision$
25  * $Name$
26  */
27 
28 #ifndef GIMATH_LM_H
29 #define GIMATH_LM_H
30 
31 #include <cxtypes.h>
32 
33 #include <cpl_matrix.h>
34 
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 
41 #define LMRQ_DCHISQ 0.0001
42 #define LMRQ_ITERMAX 30
43 #define LMRQ_TESTMAX 7
44 #define LMRQ_NPARAMS 3
45 
46 #define DW_DEGREE 3
47 #define DW_LOG001 2.302585093 /* -log(0.1) */
48 
49 /* optical model inputs indices */
50 #define LMI_WLEN 0
51 #define LMI_XFIB 1
52 #define LMI_YFIB 2
53 
54 /* optical model parameters indices */
55 #define LMP_NX 0
56 #define LMP_NY 0
57 #define LMP_PXSIZ 1
58 #define LMP_FCOLL 2
59 #define LMP_CFACT 3
60 #define LMP_THETA 4
61 #define LMP_ORDER 5
62 #define LMP_SPACE 6
63 #define LMP_SOFFX 7
64 #define LMP_SOFFY 8
65 #define LMP_SPHI 9
66 
67 /* line model parameters indices */
68 #define LMP_AMPL 0
69 #define LMP_CENT 1
70 #define LMP_BACK 2
71 #define LMP_WID1 3
72 #define LMP_WID2 4
73 
74 /* locy model parameters indices */
75 #define LMP_TX 0
76 #define LMP_TY 1
77 #define LMP_CX 2
78 #define LMP_KY 3
79 #define LMP_TT 4
80 
81 /* locy model inputs indices */
82 #define LMI_XCCD 0
83 #define LMI_NX 1
84 #define LMI_STRX 2
85 #define LMI_NCOF 3
86 
93 typedef void (*fitted_func)(double[], double[], double[], double *, double[], int);
94 
100 struct lmrq_params {
101  cxint imax;
102  cxint tmax;
103  cxdouble dchsq;
104 };
105 
106 typedef struct lmrq_params lmrq_params;
107 
112 enum _lmrq_model_id_ {
113  LMRQ_GAUSSUM,
114  LMRQ_XOPTMOD,
115  LMRQ_XOPTMODGS,
116  LMRQ_XOPTMOD2,
117  LMRQ_PSFCOS,
118  LMRQ_PSFEXP,
119  LMRQ_YOPTMOD,
120  LMRQ_YOPTMOD2,
121  LMRQ_LOCYWARP,
122  LMRQ_PSFEXP2,
123  LMRQ_TEST,
124  LMRQ_UNDEFINED
125 };
126 
127 typedef enum _lmrq_model_id_ lmrq_model_id;
128 
133 enum lmrq_model_type {
134  LINE_MODEL,
135  XOPT_MODEL,
136  YOPT_MODEL,
137  LOCY_MODEL
138 };
139 
140 typedef enum lmrq_model_type lmrq_model_type;
141 
146 struct lmrq_model {
147  lmrq_model_id id;
148  fitted_func cfunc;
149  cxint nparams;
150  cxint ninputs;
151  cxchar name[256];
152  lmrq_model_type type;
153 };
154 
155 typedef struct lmrq_model lmrq_model; // aka FittedModel
156 
157 
158 cxint mrqnlfit(cpl_matrix *, cpl_matrix *, cpl_matrix *, cxint, cpl_matrix *,
159  cxdouble[], cxint[], cxint, cpl_matrix *, cxdouble *,
160  lmrq_params, fitted_func);
161 
162 cxint mymrqmin(cpl_matrix *, cpl_matrix *, cpl_matrix *, cxint, cpl_matrix *,
163  cxdouble[], cxint[], cxint, cpl_matrix *, cpl_matrix *,
164  cxdouble *, fitted_func, cxdouble *);
165 
166 cxint mymrqcof(cpl_matrix *, cpl_matrix *, cpl_matrix *, cxint, cpl_matrix *,
167  cxdouble[], cxint[], cxint, cpl_matrix *, cpl_matrix *,
168  cxdouble *, fitted_func);
169 
170 cxdouble r_squared(cxdouble, cpl_matrix *, cxint);
171 
172 
173 
174 void mrqgaussum(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
175  cxdouble[], cxint);
176 
177 void mrqxoptmod(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
178  cxdouble[], cxint);
179 
180 void mrqxoptmod2(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
181  cxdouble[], cxint);
182 
183 void mrqyoptmod(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
184  cxdouble[], cxint);
185 
186 void mrqyoptmod2(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
187  cxdouble[], cxint);
188 
189 void mrqpsfcos(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
190  cxdouble[], cxint);
191 
192 void mrqpsfexp(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
193  cxdouble[], cxint);
194 
195 void mrqpsfexp2(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
196  cxdouble[], cxint);
197 
198 void mrqlocywarp(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
199  cxdouble[], cxint);
200 
201 void mrqxoptmodGS(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
202  cxdouble[], cxint);
203 
204 void mrqtest(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
205  cxdouble[], cxint);
206 
207 extern lmrq_model lmrq_models[];
208 extern cxint nr_lmrq_models;
209 
210 
211 #ifdef __cplusplus
212 }
213 #endif
214 
215 #endif /* GIMATH_LM_H */

This file is part of the GIRAFFE Pipeline Reference Manual 2.12.
Documentation copyright © 2002-2006 European Southern Observatory.
Generated on Mon Mar 24 2014 11:43:52 by doxygen 1.8.2 written by Dimitri van Heesch, © 1997-2004