GIRAFFE Pipeline Reference Manual

gimath_lm.h

00001 /* $Id: gimath_lm.h,v 1.8 2007/03/12 12:53:23 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: 2007/03/12 12:53:23 $
00024  * $Revision: 1.8 $
00025  * $Name: giraffe-2_5_2 $
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 
00094 typedef void (*fitted_func)(double[], double[], double[], double *, double[], int);
00095 
00101 struct lmrq_params {
00102     cxint     imax;  
00103     cxint     tmax;  
00104     cxdouble  dchsq; 
00105 };
00106 
00107 typedef struct lmrq_params lmrq_params;
00108 
00113 enum _lmrq_model_id_ {
00114     LMRQ_GAUSSUM,    
00115     LMRQ_XOPTMOD,    
00116     LMRQ_XOPTMODGS,  
00117     LMRQ_XOPTMOD2,   
00118     LMRQ_PSFCOS,     
00119     LMRQ_PSFEXP,     
00120     LMRQ_YOPTMOD,    
00121     LMRQ_YOPTMOD2,   
00122     LMRQ_LOCYWARP,   
00123     LMRQ_PSFEXP2,    
00124     LMRQ_TEST,       
00125     LMRQ_UNDEFINED   
00126 };
00127 
00128 typedef enum _lmrq_model_id_ lmrq_model_id;
00129 
00134 enum lmrq_model_type {
00135     LINE_MODEL, 
00136     XOPT_MODEL, 
00137     YOPT_MODEL, 
00138     LOCY_MODEL  
00139 };
00140 
00141 typedef enum lmrq_model_type lmrq_model_type;
00142 
00147 struct lmrq_model {
00148     lmrq_model_id   id;         
00149     fitted_func     cfunc;      
00150     cxint           nparams;    
00151     cxint           ninputs;    
00152     cxchar          name[256];  
00153     lmrq_model_type type;       
00154 };
00155 
00156 typedef struct lmrq_model lmrq_model; // aka FittedModel
00157 
00158 
00159 cxint mrqnlfit(cpl_matrix *, cpl_matrix *, cpl_matrix *, cxint, cpl_matrix *,
00160                cxdouble[], cxint[], cxint, cpl_matrix *, cxdouble *,
00161                lmrq_params, fitted_func);
00162 
00163 cxint mymrqmin(cpl_matrix *, cpl_matrix *, cpl_matrix *, cxint, cpl_matrix *,
00164                cxdouble[], cxint[], cxint, cpl_matrix *, cpl_matrix *,
00165                cxdouble *, fitted_func, cxdouble *);
00166 
00167 cxint mymrqcof(cpl_matrix *, cpl_matrix *, cpl_matrix *, cxint,  cpl_matrix *,
00168                cxdouble[], cxint[], cxint, cpl_matrix *, cpl_matrix *,
00169                cxdouble *, fitted_func);
00170 
00171 cxdouble r_squared(cxdouble, cpl_matrix *, cxint);
00172 
00173 
00174 
00175 void mrqgaussum(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00176                 cxdouble[], cxint);
00177 
00178 void mrqxoptmod(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00179                 cxdouble[], cxint);
00180 
00181 void mrqxoptmod2(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00182                  cxdouble[], cxint);
00183 
00184 void mrqyoptmod(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00185                 cxdouble[], cxint);
00186 
00187 void mrqyoptmod2(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00188                  cxdouble[], cxint);
00189 
00190 void mrqpsfcos(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00191                cxdouble[], cxint);
00192 
00193 void mrqpsfexp(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00194                cxdouble[], cxint);
00195 
00196 void mrqpsfexp2(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00197                 cxdouble[], cxint);
00198 
00199 void mrqlocywarp(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00200                  cxdouble[], cxint);
00201 
00202 void mrqxoptmodGS(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00203                   cxdouble[], cxint);
00204 
00205 void mrqtest(cxdouble[], cxdouble[], cxdouble[], cxdouble *,
00206              cxdouble[], cxint);
00207 
00208 extern lmrq_model lmrq_models[];
00209 extern cxint nr_lmrq_models;
00210 
00211 
00212 #ifdef __cplusplus
00213 }
00214 #endif
00215 
00216 #endif /* GIMATH_LM_H */

This file is part of the GIRAFFE Pipeline Reference Manual 2.5.2.
Documentation copyright © 2002-2006 European Southern Observatory.
Generated on Fri Jun 13 14:36:22 2008 by doxygen 1.4.6 written by Dimitri van Heesch, © 1997-2004