GIRAFFE Pipeline Reference Manual

gimath_lm.h

00001 /* $Id: gimath_lm.h,v 1.9 2009/05/29 12:37:43 rpalsa Exp $
00002  *
00003  * This file is part of the GIRAFFE Pipeline
00004  * Copyright (C) 2002-2006 European Southern Observatory
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 /*
00022  * $Author: rpalsa $
00023  * $Date: 2009/05/29 12:37:43 $
00024  * $Revision: 1.9 $
00025  * $Name: giraffe-2_9 $
00026  */
00027 
00028 #ifndef GIMATH_LM_H
00029 #define GIMATH_LM_H
00030 
00031 #include <cxtypes.h>
00032 
00033 #include <cpl_matrix.h>
00034 
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 
00041 #define LMRQ_DCHISQ  0.0001
00042 #define LMRQ_ITERMAX 30
00043 #define LMRQ_TESTMAX 7
00044 #define LMRQ_NPARAMS 3
00045 
00046 #define DW_DEGREE 3
00047 #define DW_LOG001 2.302585093  /* -log(0.1) */
00048 
00049 /* optical model inputs indices */
00050 #define LMI_WLEN  0
00051 #define LMI_XFIB  1
00052 #define LMI_YFIB  2
00053 
00054 /* optical model parameters indices */
00055 #define LMP_NX    0
00056 #define LMP_NY    0
00057 #define LMP_PXSIZ 1
00058 #define LMP_FCOLL 2
00059 #define LMP_CFACT 3
00060 #define LMP_THETA 4
00061 #define LMP_ORDER 5
00062 #define LMP_SPACE 6
00063 #define LMP_SOFFX 7
00064 #define LMP_SOFFY 8
00065 #define LMP_SPHI  9
00066 
00067 /* line model parameters indices */
00068 #define LMP_AMPL  0
00069 #define LMP_CENT  1
00070 #define LMP_BACK  2
00071 #define LMP_WID1  3
00072 #define LMP_WID2  4
00073 
00074 /* locy model parameters indices */
00075 #define LMP_TX  0
00076 #define LMP_TY  1
00077 #define LMP_CX  2
00078 #define LMP_KY  3
00079 #define LMP_TT  4
00080 
00081 /* locy model inputs indices */
00082 #define LMI_XCCD  0
00083 #define LMI_NX    1
00084 #define LMI_STRX  2
00085 #define LMI_NCOF  3
00086 
00093 typedef void (*fitted_func)(double[], double[], double[], double *, double[], int);
00094 
00100 struct lmrq_params {
00101     cxint     imax;  
00102     cxint     tmax;  
00103     cxdouble  dchsq; 
00104 };
00105 
00106 typedef struct lmrq_params lmrq_params;
00107 
00112 enum _lmrq_model_id_ {
00113     LMRQ_GAUSSUM,    
00114     LMRQ_XOPTMOD,    
00115     LMRQ_XOPTMODGS,  
00116     LMRQ_XOPTMOD2,   
00117     LMRQ_PSFCOS,     
00118     LMRQ_PSFEXP,     
00119     LMRQ_YOPTMOD,    
00120     LMRQ_YOPTMOD2,   
00121     LMRQ_LOCYWARP,   
00122     LMRQ_PSFEXP2,    
00123     LMRQ_TEST,       
00124     LMRQ_UNDEFINED   
00125 };
00126 
00127 typedef enum _lmrq_model_id_ lmrq_model_id;
00128 
00133 enum lmrq_model_type {
00134     LINE_MODEL, 
00135     XOPT_MODEL, 
00136     YOPT_MODEL, 
00137     LOCY_MODEL  
00138 };
00139 
00140 typedef enum lmrq_model_type lmrq_model_type;
00141 
00146 struct lmrq_model {
00147     lmrq_model_id   id;         
00148     fitted_func     cfunc;      
00149     cxint           nparams;    
00150     cxint           ninputs;    
00151     cxchar          name[256];  
00152     lmrq_model_type type;       
00153 };
00154 
00155 typedef struct lmrq_model lmrq_model; // aka FittedModel
00156 
00157 
00158 cxint mrqnlfit(cpl_matrix *, cpl_matrix *, cpl_matrix *, cxint, cpl_matrix *,
00159                cxdouble[], cxint[], cxint, cpl_matrix *, cxdouble *,
00160                lmrq_params, fitted_func);
00161 
00162 cxint mymrqmin(cpl_matrix *, cpl_matrix *, cpl_matrix *, cxint, cpl_matrix *,
00163                cxdouble[], cxint[], cxint, cpl_matrix *, cpl_matrix *,
00164                cxdouble *, fitted_func, cxdouble *);
00165 
00166 cxint mymrqcof(cpl_matrix *, cpl_matrix *, cpl_matrix *, cxint,  cpl_matrix *,
00167                cxdouble[], cxint[], cxint, cpl_matrix *, cpl_matrix *,
00168                cxdouble *, fitted_func);
00169 
00170 cxdouble r_squared(cxdouble, cpl_matrix *, cxint);
00171 
00172 
00173 
00174 void mrqgaussum(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00175                 cxdouble[], cxint);
00176 
00177 void mrqxoptmod(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00178                 cxdouble[], cxint);
00179 
00180 void mrqxoptmod2(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00181                  cxdouble[], cxint);
00182 
00183 void mrqyoptmod(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00184                 cxdouble[], cxint);
00185 
00186 void mrqyoptmod2(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00187                  cxdouble[], cxint);
00188 
00189 void mrqpsfcos(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00190                cxdouble[], cxint);
00191 
00192 void mrqpsfexp(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00193                cxdouble[], cxint);
00194 
00195 void mrqpsfexp2(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00196                 cxdouble[], cxint);
00197 
00198 void mrqlocywarp(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00199                  cxdouble[], cxint);
00200 
00201 void mrqxoptmodGS(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00202                   cxdouble[], cxint);
00203 
00204 void mrqtest(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00205              cxdouble[], cxint);
00206 
00207 extern lmrq_model lmrq_models[];
00208 extern cxint nr_lmrq_models;
00209 
00210 
00211 #ifdef __cplusplus
00212 }
00213 #endif
00214 
00215 #endif /* GIMATH_LM_H */

This file is part of the GIRAFFE Pipeline Reference Manual 2.9.0.
Documentation copyright © 2002-2006 European Southern Observatory.
Generated on Thu Jan 26 14:20:28 2012 by doxygen 1.6.3 written by Dimitri van Heesch, © 1997-2004