00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031
00032
00033
00034
00035
00036 #include <cpl.h>
00037 #include <xsh_msg.h>
00038 #include <xsh_utils_table.h>
00039 #include "xsh_model_io.h"
00040 #include "xsh_dfs.h"
00041 #include "xsh_error.h"
00042 #include "xsh_data_spectralformat.h"
00043 #include "xsh_model_arm_constants.h"
00044
00045
00046
00047
00048
00049 static int xsh_table_check_column(const cpl_table *, const char *) ;
00050
00051
00055
00056
00059 void
00060 xsh_model_io_dump(xsh_xs_3 * p_xs_3){
00061 int i=0;
00062
00063 xsh_msg("temper=%g",p_xs_3->temper);
00064 xsh_msg("arm=%d", p_xs_3->arm);
00065 xsh_msg("t_ir_p2=%g", p_xs_3->t_ir_p2);
00066 xsh_msg("t_ir_p3=%g", p_xs_3->t_ir_p3);
00067 xsh_msg("es_x=%g", p_xs_3->es_x);
00068 xsh_msg("es_y=%g", p_xs_3->es_y);
00069 xsh_msg("mues=%g", p_xs_3->mues);
00070 xsh_msg("nues=%g", p_xs_3->nues);
00071 xsh_msg("taues=%g",p_xs_3->taues);
00072 xsh_msg("slit_scale=%g",p_xs_3->slit_scale);
00073 xsh_msg("es_s=%g",p_xs_3->es_s);
00074 xsh_msg("es_w=%g",p_xs_3->es_w);
00075 xsh_msg("fcol=%g",p_xs_3->fcol);
00076 xsh_msg("cmup1=%g",p_xs_3->cmup1);
00077 xsh_msg("mup1=%g", p_xs_3->mup1);
00078 xsh_msg("nup1=%g", p_xs_3->nup1);
00079 xsh_msg("taup1=%g",p_xs_3->taup1);
00080 xsh_msg("mup2=%g", p_xs_3->mup2);
00081 xsh_msg("nup2=%g", p_xs_3->nup2);
00082 xsh_msg("taup2=%g", p_xs_3->taup2);
00083 xsh_msg("mup3=%g", p_xs_3->mup3);
00084 xsh_msg("nup3=%g", p_xs_3->nup3);
00085 xsh_msg("taup3=%g",p_xs_3->taup3);
00086 xsh_msg("mup4=%g", p_xs_3->mup4);
00087 xsh_msg("nup4=%g", p_xs_3->nup4);
00088 xsh_msg("taup4=%g", p_xs_3->taup4);
00089 xsh_msg("mup5=%g",p_xs_3->mup5);
00090 xsh_msg("nup5=%g", p_xs_3->nup5);
00091 xsh_msg("taup5=%g", p_xs_3->taup5);
00092 xsh_msg("mup6=%g", p_xs_3->mup6);
00093 xsh_msg("nup6=%g", p_xs_3->nup6);
00094 xsh_msg("taup6=%g",p_xs_3->taup6);
00095 xsh_msg("mug=%g",p_xs_3->mug);
00096 xsh_msg("nug=%g",p_xs_3->nug);
00097 xsh_msg("taug=%g", p_xs_3->taug);
00098 xsh_msg("sg=%g", p_xs_3->sg);
00099 xsh_msg("fdet=%g", p_xs_3->fdet);
00100 xsh_msg("mud=%g", p_xs_3->mud);
00101 xsh_msg("nud=%g", p_xs_3->nud);
00102 xsh_msg("taud=%g",p_xs_3->taud);
00103 xsh_msg("pix=%g", p_xs_3->pix);
00104 xsh_msg("chipx=%g",p_xs_3->chipx);
00105 xsh_msg("chipy=%g",p_xs_3->chipy);
00106 xsh_msg("chiprot=%g", p_xs_3->chiprot);
00107 xsh_msg("pc_x_xx=%g", p_xs_3->pc_x_xx);
00108 xsh_msg("pc_x_x1=%g", p_xs_3->pc_x_x1);
00109 xsh_msg("pc_x_yy=%g", p_xs_3->pc_x_yy);
00110 xsh_msg("pc_x_y1=%g", p_xs_3->pc_x_y1);
00111 xsh_msg("pc_x_xy=%g", p_xs_3->pc_x_xy);
00112 xsh_msg("pc_x_x3=%g", p_xs_3->pc_x_x3);
00113 xsh_msg("pc_x_x2y=%g", p_xs_3->pc_x_x2y);
00114 xsh_msg("pc_x_y2x=%g", p_xs_3->pc_x_y2x);
00115 xsh_msg("pc_x_y3=%g", p_xs_3->pc_x_y3);
00116 xsh_msg("pc_y_xx=%g", p_xs_3->pc_y_xx);
00117 xsh_msg("pc_y_x1=%g", p_xs_3->pc_y_x1);
00118 xsh_msg("pc_y_yy=%g", p_xs_3->pc_y_yy);
00119 xsh_msg("pc_y_y1=%g", p_xs_3->pc_y_y1);
00120 xsh_msg("pc_y_xy=%g", p_xs_3->pc_y_xy);
00121 xsh_msg("pc_y_x3=%g", p_xs_3->pc_y_x3);
00122 xsh_msg("pc_y_x2y=%g", p_xs_3->pc_y_x2y);
00123 xsh_msg("pc_y_y2x=%g", p_xs_3->pc_y_y2x);
00124 xsh_msg("pc_y_y3=%g", p_xs_3->pc_y_y3);
00125 xsh_msg("pc4_x_xy3=%g", p_xs_3->pc4_x_xy3);
00126 xsh_msg("pc4_x_x3y=%g",p_xs_3->pc4_x_x3y);
00127 xsh_msg("pc4_x_x2y2=%g",p_xs_3->pc4_x_x2y2);
00128 xsh_msg("pc4_x_x4=%g", p_xs_3->pc4_x_x4);
00129 xsh_msg("pc4_x_y4=%g", p_xs_3->pc4_x_y4);
00130 xsh_msg("pc4_y_xy3=%g",p_xs_3->pc4_y_xy3);
00131 xsh_msg("pc4_y_x3y=%g", p_xs_3->pc4_y_x3y);
00132 xsh_msg("pc4_y_x2y2=%g", p_xs_3->pc4_y_x2y2);
00133 xsh_msg("pc4_y_x4=%g", p_xs_3->pc4_y_x4);
00134 xsh_msg("pc4_y_y4=%g", p_xs_3->pc4_y_y4);
00135 xsh_msg("ca_x0=%g", p_xs_3->ca_x0);
00136 xsh_msg("ca_x=%g1", p_xs_3->ca_x1);
00137 xsh_msg("ca_y0=%g", p_xs_3->ca_y0);
00138 xsh_msg("ca_y1=%g", p_xs_3->ca_y1);
00139 xsh_msg("d2_x1=%g", p_xs_3->d2_x1);
00140 xsh_msg("d2_x=%g2", p_xs_3->d2_x2);
00141 xsh_msg("d2_x3=%g", p_xs_3->d2_x3);
00142 xsh_msg("d2_y1x0=%g", p_xs_3->d2_y1x0);
00143 xsh_msg("d2_y1x1=%g", p_xs_3->d2_y1x1);
00144 xsh_msg("d2_y1x2=%g", p_xs_3->d2_y1x2);
00145 xsh_msg("d2_y1x3=%g", p_xs_3->d2_y1x3);
00146 xsh_msg("d2_y2x0=%g", p_xs_3->d2_y2x0);
00147 xsh_msg("d2_y2x1=%g", p_xs_3->d2_y2x1);
00148 xsh_msg("d2_y2x2=%g", p_xs_3->d2_y2x2);
00149 xsh_msg("d2_y2x3=%g", p_xs_3->d2_y2x3);
00150 xsh_msg("d2_y3x0=%g", p_xs_3->d2_y3x0);
00151 xsh_msg("d2_y3x1=%g", p_xs_3->d2_y3x1);
00152 xsh_msg("d2_y3x2=%g", p_xs_3->d2_y3x2);
00153 xsh_msg("d2_y3x3=%g", p_xs_3->d2_y3x3);
00154 xsh_msg("offx=%g", p_xs_3->offx);
00155 xsh_msg("offy=%g", p_xs_3->offy);
00156 xsh_msg("flipx=%g", p_xs_3->flipx);
00157 xsh_msg("flipy=%g", p_xs_3->flipy);
00158 for(i=0;i<9;i++){
00159 xsh_msg("slit=%g", p_xs_3->slit[i]);
00160 }
00161
00162 return;
00163
00164 }
00165
00172
00173 cpl_error_code
00174 xsh_model_config_load_best(
00175 cpl_frame * config_frame,
00176 xsh_xs_3 * p_xs_3)
00177 {
00178 cpl_table * tab = NULL;
00179 int nlines ;
00180 char * name ;
00181 int i;
00182 const char * config=NULL;
00183 const char * tag=NULL;
00184 XSH_INSTRCONFIG* instr_config=NULL;
00185
00186 xsh_instrument* instr = NULL;
00187
00188 instr = xsh_instrument_new();
00189
00190 XSH_ASSURE_NOT_NULL( config_frame);
00191 XSH_ASSURE_NOT_NULL( p_xs_3);
00192 check( config=cpl_frame_get_filename(config_frame));
00193 check( tag=cpl_frame_get_tag(config_frame));
00194 xsh_msg_dbg_high("file %s tag=%s",config,tag);
00195
00196 check( tab = xsh_load_table_check(config,tag));
00197 XSH_ASSURE_NOT_NULL( tab);
00198 check( nlines = cpl_table_get_nrow(tab));
00199
00200 p_xs_3->config_mjd=0.0;
00201
00202
00203
00204 p_xs_3->pc_x_x1=1.0;
00205 p_xs_3->pc_y_y1=1.0;
00206 p_xs_3->pc_x_xx=0.0;
00207 p_xs_3->pc_x_xy=0.0;
00208 p_xs_3->pc_x_x3=0.0;
00209 p_xs_3->pc_x_y1=0.0;
00210 p_xs_3->pc_x_yy=0.0;
00211 p_xs_3->pc_x_y3=0.0;
00212 p_xs_3->pc_x_x2y=0.0;
00213 p_xs_3->pc_x_y2x=0.0;
00214 p_xs_3->pc_y_xx=0.0;
00215 p_xs_3->pc_y_xy=0.0;
00216 p_xs_3->pc_y_x3=0.0;
00217 p_xs_3->pc_y_x1=0.0;
00218 p_xs_3->pc_y_yy=0.0;
00219 p_xs_3->pc_y_y3=0.0;
00220 p_xs_3->pc_y_x2y=0.0;
00221 p_xs_3->pc_y_y2x=0.0;
00222
00223 p_xs_3->d2_x1=0.0;
00224 p_xs_3->d2_x2=0.0;
00225 p_xs_3->d2_x3=0.0;
00226 p_xs_3->d2_y1x0=0.0;
00227 p_xs_3->d2_y1x1=0.0;
00228 p_xs_3->d2_y1x2=0.0;
00229 p_xs_3->d2_y1x3=0.0;
00230 p_xs_3->d2_y2x0=0.0;
00231 p_xs_3->d2_y2x1=0.0;
00232 p_xs_3->d2_y2x2=0.0;
00233 p_xs_3->d2_y2x3=0.0;
00234 p_xs_3->d2_y3x0=0.0;
00235 p_xs_3->d2_y3x1=0.0;
00236 p_xs_3->d2_y3x2=0.0;
00237 p_xs_3->d2_y3x3=0.0;
00238 p_xs_3->pc4_x_x3y=0.0;
00239 p_xs_3->pc4_x_xy3=0.0;
00240 p_xs_3->pc4_x_x2y2=0.0;
00241 p_xs_3->pc4_x_x4=0.0;
00242 p_xs_3->pc4_x_y4=0.0;
00243 p_xs_3->pc4_y_xy3=0.0;
00244 p_xs_3->pc4_y_x3y=0.0;
00245 p_xs_3->pc4_y_x2y2=0.0;
00246 p_xs_3->pc4_y_x4=0.0;
00247 p_xs_3->pc4_y_y4=0.0;
00248 p_xs_3->ca_x0=0.0;
00249 p_xs_3->ca_x1=0.0;
00250 p_xs_3->ca_y0=0.0;
00251 p_xs_3->ca_y1=0.0;
00252 p_xs_3->offx=0.0;
00253 p_xs_3->offy=0.0;
00254
00255 if (strncmp(tag,XSH_MOD_CFG_NIR,16)==0 ||
00256 strncmp(tag,XSH_MOD_CFG_TAB_NIR,20)==0) {
00257 p_xs_3->pc4_x_x3y=0.0;
00258 p_xs_3->pc4_x_xy3=0.0;
00259 p_xs_3->pc4_x_x2y2=0.0;
00260 p_xs_3->pc4_x_x4=0.0;
00261 p_xs_3->pc4_x_y4=0.0;
00262 p_xs_3->pc4_y_xy3=0.0;
00263 p_xs_3->pc4_y_x3y=0.0;
00264 p_xs_3->pc4_y_x2y2=0.0;
00265 p_xs_3->pc4_y_x4=0.0;
00266 p_xs_3->pc4_y_y4=0.0;
00267 p_xs_3->ca_x0=0.0;
00268 p_xs_3->ca_x1=0.0;
00269 p_xs_3->ca_y0=0.0;
00270 p_xs_3->ca_y1=0.0;
00271 p_xs_3->offx=0.0;
00272 p_xs_3->offy=0.0;
00273 }
00274 else if (strncmp(tag,XSH_MOD_CFG_VIS,16)==0 ||
00275 strncmp(tag,XSH_MOD_CFG_TAB_VIS,20)==0) {
00276 p_xs_3->d2_x1=0.00287311525385538;
00277 p_xs_3->d2_x2=1.55125984130817E-05;
00278 p_xs_3->d2_x3=-4.00980399239143E-05;
00279 }
00280 else if (strncmp(tag,XSH_MOD_CFG_UVB,16)==0 ||
00281 strncmp(tag,XSH_MOD_CFG_TAB_UVB,20)==0) {
00282 p_xs_3->d2_x1=0.0;
00283 p_xs_3->d2_x2=0.0;
00284 p_xs_3->d2_x3=0.0;
00285 }
00286
00287
00288
00289 for (i=0 ; i<nlines ; i++) {
00290 name = (char*) cpl_table_get_string(tab, XSH_COL_MODEL_CONF_NAME, i);
00291
00292
00293 if (!strcmp("temper", name)) p_xs_3->temper =
00294 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00295 else if (!strcmp("arm", name)) p_xs_3->arm =
00296 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00297 else if (!strcmp("config_mjd", name)) p_xs_3->config_mjd =
00298 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00299 else if (!strcmp("t_ir_p2", name)) p_xs_3->t_ir_p2 =
00300 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00301 else if (!strcmp("t_ir_p3", name)) p_xs_3->t_ir_p3 =
00302 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00303 else if (!strcmp("es_x", name)) p_xs_3->es_x =
00304 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00305 else if (!strcmp("es_y", name)) p_xs_3->es_y =
00306 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00307 else if (!strcmp("mues", name)) p_xs_3->mues =
00308 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00309 else if (!strcmp("nues", name)) p_xs_3->nues =
00310 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00311 else if (!strcmp("taues", name)) p_xs_3->taues =
00312 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00313 else if (!strcmp("slit_scale", name)) p_xs_3->slit_scale =
00314 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00315 else if (!strcmp("es_s", name)) p_xs_3->es_s =
00316 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00317 else if (!strcmp("es_w", name)) p_xs_3->es_w =
00318 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00319 else if (!strcmp("fcol", name)) p_xs_3->fcol =
00320 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00321 else if (!strcmp("cmup1", name)) p_xs_3->cmup1 =
00322 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00323 else if (!strcmp("mup1", name)) p_xs_3->mup1 =
00324 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00325 else if (!strcmp("nup1", name)) p_xs_3->nup1 =
00326 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00327 else if (!strcmp("taup1", name)) p_xs_3->taup1 =
00328 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00329 else if (!strcmp("mup2", name)) p_xs_3->mup2 =
00330 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00331 else if (!strcmp("nup2", name)) p_xs_3->nup2 =
00332 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00333 else if (!strcmp("taup2", name)) p_xs_3->taup2 =
00334 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00335 else if (!strcmp("mup3", name)) p_xs_3->mup3 =
00336 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00337 else if (!strcmp("nup3", name)) p_xs_3->nup3 =
00338 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00339 else if (!strcmp("taup3", name)) p_xs_3->taup3 =
00340 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00341 else if (!strcmp("mup4", name)) p_xs_3->mup4 =
00342 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00343 else if (!strcmp("nup4", name)) p_xs_3->nup4 =
00344 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00345 else if (!strcmp("taup4", name)) p_xs_3->taup4 =
00346 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00347 else if (!strcmp("mup5", name)) p_xs_3->mup5 =
00348 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00349 else if (!strcmp("nup5", name)) p_xs_3->nup5 =
00350 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00351 else if (!strcmp("taup5", name)) p_xs_3->taup5 =
00352 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00353 else if (!strcmp("mup6", name)) p_xs_3->mup6 =
00354 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00355 else if (!strcmp("nup6", name)) p_xs_3->nup6 =
00356 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00357 else if (!strcmp("taup6", name)) p_xs_3->taup6 =
00358 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00359 else if (!strcmp("mug", name)) p_xs_3->mug =
00360 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00361 else if (!strcmp("nug", name)) p_xs_3->nug =
00362 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00363 else if (!strcmp("taug", name)) p_xs_3->taug =
00364 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00365 else if (!strcmp("sg", name)) p_xs_3->sg =
00366 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00367 else if (!strcmp("fdet", name)) p_xs_3->fdet =
00368 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00369 else if (!strcmp("mud", name)) p_xs_3->mud =
00370 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00371 else if (!strcmp("nud", name)) p_xs_3->nud =
00372 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00373 else if (!strcmp("taud", name)) p_xs_3->taud =
00374 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00375 else if (!strcmp("pix", name)) p_xs_3->pix =
00376 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00377 else if (!strcmp("chipx", name)) p_xs_3->chipx=
00378 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00379 else if (!strcmp("chipy", name)) p_xs_3->chipy=
00380 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00381 else if (!strcmp("chiprot", name)) p_xs_3->chiprot =
00382 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00383 else if (!strcmp("pc_x_xx", name)) p_xs_3->pc_x_xx=
00384 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00385 else if (!strcmp("pc_x_x1", name)) p_xs_3->pc_x_x1=
00386 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00387 else if (!strcmp("pc_x_yy", name)) p_xs_3->pc_x_yy=
00388 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00389 else if (!strcmp("pc_x_y1", name)) p_xs_3->pc_x_y1=
00390 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00391 else if (!strcmp("pc_x_xy", name)) p_xs_3->pc_x_xy=
00392 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00393 else if (!strcmp("pc_x_x3", name)) p_xs_3->pc_x_x3=
00394 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00395 else if (!strcmp("pc_x_x2y", name)) p_xs_3->pc_x_x2y=
00396 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00397 else if (!strcmp("pc_x_y2x", name)) p_xs_3->pc_x_y2x=
00398 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00399 else if (!strcmp("pc_x_y3", name)) p_xs_3->pc_x_y3=
00400 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00401 else if (!strcmp("pc_y_xx", name)) p_xs_3->pc_y_xx=
00402 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00403 else if (!strcmp("pc_y_x1", name)) p_xs_3->pc_y_x1=
00404 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00405 else if (!strcmp("pc_y_yy", name)) p_xs_3->pc_y_yy=
00406 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00407 else if (!strcmp("pc_y_y1", name)) p_xs_3->pc_y_y1=
00408 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00409 else if (!strcmp("pc_y_xy", name)) p_xs_3->pc_y_xy=
00410 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00411 else if (!strcmp("pc_y_x3", name)) p_xs_3->pc_y_x3=
00412 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00413 else if (!strcmp("pc_y_x2y", name)) p_xs_3->pc_y_x2y=
00414 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00415 else if (!strcmp("pc_y_y2x", name)) p_xs_3->pc_y_y2x=
00416 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00417 else if (!strcmp("pc_y_y3", name)) p_xs_3->pc_y_y3=
00418 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00419 else if (!strcmp("pc4_x_xy3", name)) p_xs_3->pc4_x_xy3=
00420 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00421 else if (!strcmp("pc4_x_x3y", name)) p_xs_3->pc4_x_x3y=
00422 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00423 else if (!strcmp("pc4_x_x2y2", name)) p_xs_3->pc4_x_x2y2=
00424 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00425 else if (!strcmp("pc4_x_x4", name)) p_xs_3->pc4_x_x4=
00426 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00427 else if (!strcmp("pc4_x_y4", name)) p_xs_3->pc4_x_y4=
00428 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00429 else if (!strcmp("pc4_y_xy3", name)) p_xs_3->pc4_y_xy3=
00430 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00431 else if (!strcmp("pc4_y_x3y", name)) p_xs_3->pc4_y_x3y=
00432 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00433 else if (!strcmp("pc4_y_x2y2", name)) p_xs_3->pc4_y_x2y2=
00434 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00435 else if (!strcmp("pc4_y_x4", name)) p_xs_3->pc4_y_x4=
00436 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00437 else if (!strcmp("pc4_y_y4", name)) p_xs_3->pc4_y_y4=
00438 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00439 else if (!strcmp("ca_x0", name)) p_xs_3->ca_x0=
00440 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00441 else if (!strcmp("ca_x1", name)) p_xs_3->ca_x1=
00442 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00443 else if (!strcmp("ca_y0", name)) p_xs_3->ca_y0=
00444 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00445 else if (!strcmp("ca_y1", name)) p_xs_3->ca_y1=
00446 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00447 else if (!strcmp("d2_x1", name)) p_xs_3->d2_x1=
00448 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00449 else if (!strcmp("d2_x2", name)) p_xs_3->d2_x2=
00450 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00451 else if (!strcmp("d2_x3", name)) p_xs_3->d2_x3=
00452 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00453 else if (!strcmp("d2_y1x0", name)) p_xs_3->d2_y1x0=
00454 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00455 else if (!strcmp("d2_y1x1", name)) p_xs_3->d2_y1x1=
00456 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00457 else if (!strcmp("d2_y1x2", name)) p_xs_3->d2_y1x2=
00458 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00459 else if (!strcmp("d2_y1x3", name)) p_xs_3->d2_y1x3=
00460 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00461 else if (!strcmp("d2_y2x0", name)) p_xs_3->d2_y2x0=
00462 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00463 else if (!strcmp("d2_y2x1", name)) p_xs_3->d2_y2x1=
00464 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00465 else if (!strcmp("d2_y2x2", name)) p_xs_3->d2_y2x2=
00466 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00467 else if (!strcmp("d2_y2x3", name)) p_xs_3->d2_y2x3=
00468 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00469 else if (!strcmp("d2_y3x0", name)) p_xs_3->d2_y3x0=
00470 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00471 else if (!strcmp("d2_y3x1", name)) p_xs_3->d2_y3x1=
00472 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00473 else if (!strcmp("d2_y3x2", name)) p_xs_3->d2_y3x2=
00474 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00475 else if (!strcmp("d2_y3x3", name)) p_xs_3->d2_y3x3=
00476 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00477 else if (!strcmp("offx", name)) p_xs_3->offx =
00478 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00479 else if (!strcmp("offy", name)) p_xs_3->offy =
00480 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00481 else if (!strcmp("flipx", name)) p_xs_3->flipx =
00482 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00483 else if (!strcmp("flipy", name)) p_xs_3->flipy =
00484 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00485 else if (!strncmp("slit", name,4)){
00486 int islit;
00487 for(islit=0; islit <9; islit++){
00488 char temp[10];
00489
00490 sprintf(temp,"slit[%d]",islit);
00491 if (!strcmp(name, temp)){
00492 p_xs_3->slit[islit]=
00493 cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST, i, NULL) ;
00494 }
00495 }
00496 }
00497 }
00498 p_xs_3->pix_X=p_xs_3->pix_Y=p_xs_3->pix;
00499 if (p_xs_3->arm==0) {
00500 p_xs_3->morder=UVB_morder;
00501 p_xs_3->blaze_pad=UVB_blaze_pad;
00502 xsh_instrument_set_arm(instr, XSH_ARM_UVB);
00503 p_xs_3->xsize_corr=UVB_xsize_corr;
00504 p_xs_3->ysize_corr=UVB_ysize_corr;
00505 }
00506 else if (p_xs_3->arm==1) {
00507 p_xs_3->morder=VIS_morder;
00508 p_xs_3->blaze_pad=VIS_blaze_pad;
00509 xsh_instrument_set_arm(instr, XSH_ARM_VIS);
00510 p_xs_3->xsize_corr=VIS_xsize_corr;
00511 p_xs_3->ysize_corr=VIS_ysize_corr;
00512 }
00513 else if (p_xs_3->arm==2) {
00514 p_xs_3->morder=NIR_morder;
00515 p_xs_3->blaze_pad=NIR_blaze_pad;
00516 xsh_instrument_set_arm(instr, XSH_ARM_NIR);
00517 p_xs_3->xsize_corr=NIR_xsize_corr;
00518 p_xs_3->ysize_corr=NIR_ysize_corr;
00519 }
00520 else {
00521 return CPL_ERROR_UNSUPPORTED_MODE;
00522 }
00523 instr_config=xsh_instrument_get_config(instr);
00524 p_xs_3->BSIZE=instr_config->ny;
00525 p_xs_3->ASIZE=instr_config->nx;
00526 p_xs_3->SIZE=p_xs_3->BSIZE;
00527 p_xs_3->chipypix=(float)(p_xs_3->BSIZE);
00528 p_xs_3->chipxpix=(float)(p_xs_3->ASIZE);
00529 p_xs_3->morder_min=instr_config->order_min;
00530 p_xs_3->morder_max=instr_config->order_max;
00531
00532
00533 p_xs_3->mues *= DEG2RAD ;
00534 p_xs_3->nues *= DEG2RAD ;
00535 p_xs_3->taues *= DEG2RAD ;
00536 p_xs_3->cmup1 *= DEG2RAD ;
00537 p_xs_3->mup1 *= DEG2RAD ;
00538 p_xs_3->nup1 *= DEG2RAD ;
00539 p_xs_3->taup1 *= DEG2RAD ;
00540 p_xs_3->mup2 *= DEG2RAD ;
00541 p_xs_3->nup2 *= DEG2RAD ;
00542 p_xs_3->taup2 *= DEG2RAD ;
00543 p_xs_3->mup3 *= DEG2RAD ;
00544 p_xs_3->nup3 *= DEG2RAD ;
00545 p_xs_3->taup3 *= DEG2RAD ;
00546 p_xs_3->mup4 *= DEG2RAD ;
00547 p_xs_3->nup4 *= DEG2RAD ;
00548 p_xs_3->taup4 *= DEG2RAD ;
00549 p_xs_3->mup5 *= DEG2RAD ;
00550 p_xs_3->nup5 *= DEG2RAD ;
00551 p_xs_3->taup5 *= DEG2RAD ;
00552 p_xs_3->mup6 *= DEG2RAD ;
00553 p_xs_3->nup6 *= DEG2RAD ;
00554 p_xs_3->taup6 *= DEG2RAD ;
00555 p_xs_3->mug *= DEG2RAD ;
00556 p_xs_3->nug *= DEG2RAD ;
00557 p_xs_3->taug *= DEG2RAD ;
00558 p_xs_3->mud *= DEG2RAD ;
00559 p_xs_3->nud *= DEG2RAD ;
00560 p_xs_3->taud *= DEG2RAD ;
00561 p_xs_3->chiprot *= DEG2RAD ;
00562
00563 cleanup:
00564 XSH_TABLE_FREE( tab) ;
00565 xsh_instrument_free(&instr);
00566 return cpl_error_get_code();
00567
00568 }
00569
00570 int xsh_model_readfits(double * abest,double * amin,
00571 double * amax, int * aname,
00572 const char * xs_config_file,
00573 const char* xs_config_tag,
00574 struct xs_3 *p_xs_3,
00575 ann_all_par *p_all_par)
00576 {
00577 int ii,jj,kk,compa, par_found, indlen;
00578 char tempstr[10];
00579 double d2r;
00580
00581 cpl_table * tab ;
00582 int nlines ;
00583 XSH_INSTRCONFIG* instr_config=NULL;
00584 xsh_instrument* instr = NULL;
00585
00586 instr = xsh_instrument_new();
00587 p_xs_3->config_mjd=0.0;
00588
00589 p_xs_3->pc_x_x1=1.0;
00590 p_xs_3->pc_y_y1=1.0;
00591 p_xs_3->pc_x_xx=0.0;
00592 p_xs_3->pc_x_xy=0.0;
00593 p_xs_3->pc_x_x3=0.0;
00594 p_xs_3->pc_x_y1=0.0;
00595 p_xs_3->pc_x_yy=0.0;
00596 p_xs_3->pc_x_y3=0.0;
00597 p_xs_3->pc_x_x2y=0.0;
00598 p_xs_3->pc_x_y2x=0.0;
00599 p_xs_3->pc_y_xx=0.0;
00600 p_xs_3->pc_y_xy=0.0;
00601 p_xs_3->pc_y_x3=0.0;
00602 p_xs_3->pc_y_x1=0.0;
00603 p_xs_3->pc_y_yy=0.0;
00604 p_xs_3->pc_y_y3=0.0;
00605 p_xs_3->pc_y_x2y=0.0;
00606 p_xs_3->pc_y_y2x=0.0;
00607 p_xs_3->pc4_x_x3y=0.0;
00608 p_xs_3->pc4_x_xy3=0.0;
00609 p_xs_3->pc4_x_x2y2=0.0;
00610 p_xs_3->pc4_x_x4=0.0;
00611 p_xs_3->pc4_x_y4=0.0;
00612 p_xs_3->pc4_y_xy3=0.0;
00613 p_xs_3->pc4_y_x3y=0.0;
00614 p_xs_3->pc4_y_x2y2=0.0;
00615 p_xs_3->pc4_y_x4=0.0;
00616 p_xs_3->pc4_y_y4=0.0;
00617 p_xs_3->ca_x0=0.0;
00618 p_xs_3->ca_x1=0.0;
00619 p_xs_3->ca_y0=0.0;
00620 p_xs_3->ca_y1=0.0;
00621 p_xs_3->d2_x1=0.0;
00622 p_xs_3->d2_x2=0.0;
00623 p_xs_3->d2_x3=0.0;
00624 p_xs_3->d2_y1x0=0.0;
00625 p_xs_3->d2_y1x1=0.0;
00626 p_xs_3->d2_y1x2=0.0;
00627 p_xs_3->d2_y1x3=0.0;
00628 p_xs_3->d2_y2x0=0.0;
00629 p_xs_3->d2_y2x1=0.0;
00630 p_xs_3->d2_y2x2=0.0;
00631 p_xs_3->d2_y2x3=0.0;
00632 p_xs_3->d2_y3x0=0.0;
00633 p_xs_3->d2_y3x1=0.0;
00634 p_xs_3->d2_y3x2=0.0;
00635 p_xs_3->d2_y3x3=0.0;
00636 p_xs_3->offx=0.0;
00637 p_xs_3->offy=0.0;
00638
00639 if (strncmp(xs_config_tag,XSH_MOD_CFG_NIR,16)==0 ||
00640 strncmp(xs_config_tag,XSH_MOD_CFG_TAB_NIR,20)==0) {
00641 p_xs_3->pc4_x_x3y=0.0;
00642 p_xs_3->pc4_x_xy3=0.0;
00643 p_xs_3->pc4_x_x2y2=0.0;
00644 p_xs_3->pc4_x_x4=0.0;
00645 p_xs_3->pc4_x_y4=0.0;
00646 p_xs_3->pc4_y_xy3=0.0;
00647 p_xs_3->pc4_y_x3y=0.0;
00648 p_xs_3->pc4_y_x2y2=0.0;
00649 p_xs_3->pc4_y_x4=0.0;
00650 p_xs_3->pc4_y_y4=0.0;
00651 p_xs_3->ca_x0=0.0;
00652 p_xs_3->ca_x1=0.0;
00653 p_xs_3->ca_y0=0.0;
00654 p_xs_3->ca_y1=0.0;
00655 p_xs_3->offx=0.0;
00656 p_xs_3->offy=0.0;
00657 }
00658 else if (strncmp(xs_config_tag,XSH_MOD_CFG_VIS,16)==0 ||
00659 strncmp(xs_config_tag,XSH_MOD_CFG_TAB_VIS,20)==0) {
00660 p_xs_3->d2_x1=0.00287311525385538;
00661 p_xs_3->d2_x2=1.55125984130817E-05;
00662 p_xs_3->d2_x3=-4.00980399239143E-05;
00663 }
00664 else if (strncmp(xs_config_tag,XSH_MOD_CFG_UVB,16)==0 ||
00665 strncmp(xs_config_tag,XSH_MOD_CFG_TAB_UVB,20)==0) {
00666 p_xs_3->d2_x1=0.0;
00667 p_xs_3->d2_x2=0.0;
00668 p_xs_3->d2_x3=0.0;
00669 }
00670
00671
00672
00673 xsh_msg("tag=%s",xs_config_tag);
00674
00675
00676 if ((tab = xsh_load_table_check(xs_config_file,xs_config_tag)) == NULL) {
00677 cpl_msg_error(__func__, "Cannot load the config table") ;
00678 return -1 ;
00679 }
00680 nlines = cpl_table_get_nrow(tab) ;
00681
00682 for (ii=0 ; ii<nlines ; ii++) {
00683 (p_all_par+ii)->best=cpl_table_get_double(tab, XSH_COL_MODEL_CONF_BEST,
00684 ii, NULL) ;
00685 (p_all_par+ii)->min = cpl_table_get_double(tab, XSH_COL_MODEL_CONF_LOW,
00686 ii, NULL) ;
00687 (p_all_par+ii)->max = cpl_table_get_double(tab,XSH_COL_MODEL_CONF_HIGH,
00688 ii, NULL) ;
00689 (p_all_par+ii)->flag = cpl_table_get_int(tab, XSH_COL_MODEL_CONF_FLAG,
00690 ii, NULL) ;
00691 sprintf((p_all_par+ii)->name, (char*)cpl_table_get_string(tab,
00692 XSH_COL_MODEL_CONF_NAME, ii));
00693 if ((p_all_par+ii)->flag==1) {
00694 if ((p_all_par+ii)->best<(p_all_par+ii)->min ||
00695 (p_all_par+ii)->best>(p_all_par+ii)->max) {
00696 printf("limits wrong in config file for parameter: %s \n",
00697 (p_all_par+ii)->name);
00698 exit (EXIT_FAILURE);
00699 }
00700 }
00701 }
00702 xsh_free_table(&tab);
00703 jj=0;
00704 for (ii=0 ; ii<nlines ; ii++) {
00705 d2r=1.0;
00706 par_found=0;
00707
00708 compa=strncmp((p_all_par+ii)->name,"arm",3);
00709 if (compa==0) {
00710 p_xs_3->arm=(p_all_par+ii)->best;
00711 par_found=1;
00712 }
00713 compa=strncmp((p_all_par+ii)->name,"temper",6);
00714 if (compa==0) {
00715 p_xs_3->temper=(p_all_par+ii)->best;
00716 par_found=1;
00717 }
00718 compa=strncmp((p_all_par+ii)->name,"arm",3);
00719 if (compa==0) {
00720 p_xs_3->arm=(p_all_par+ii)->best;
00721 par_found=1;
00722 }
00723 compa=strncmp((p_all_par+ii)->name,"config_mjd",10);
00724 if (compa==0) {
00725 p_xs_3->config_mjd=(p_all_par+ii)->best;
00726 par_found=1;
00727 }
00728 compa=strncmp((p_all_par+ii)->name,"t_ir_p2",7);
00729 if (compa==0) {
00730 p_xs_3->t_ir_p2=(p_all_par+ii)->best;
00731 par_found=1;
00732 }
00733 compa=strncmp((p_all_par+ii)->name,"t_ir_p3",7);
00734 if (compa==0) {
00735 p_xs_3->t_ir_p3=(p_all_par+ii)->best;
00736 par_found=1;
00737 }
00738 compa=strncmp((p_all_par+ii)->name,"es_x",4);
00739 if (compa==0) {
00740 p_xs_3->es_x=(p_all_par+ii)->best;
00741 par_found=1;
00742 }
00743 compa=strncmp((p_all_par+ii)->name,"es_y",4);
00744 if (compa==0) {
00745 p_xs_3->es_y=(p_all_par+ii)->best;
00746 par_found=1;
00747 }
00748 compa=strncmp((p_all_par+ii)->name,"mues",4);
00749 if (compa==0) {
00750 d2r=DEG2RAD;
00751 p_xs_3->mues=(p_all_par+ii)->best*d2r;
00752 par_found=1;
00753 }
00754 compa=strncmp((p_all_par+ii)->name,"nues",4);
00755 if (compa==0) {
00756 d2r=DEG2RAD;
00757 p_xs_3->nues=(p_all_par+ii)->best*d2r;
00758 par_found=1;
00759 }
00760 compa=strncmp((p_all_par+ii)->name,"taues",5);
00761 if (compa==0) {
00762 d2r=DEG2RAD;
00763 p_xs_3->taues=(p_all_par+ii)->best*d2r;
00764 par_found=1;
00765 }
00766 compa=strncmp((p_all_par+ii)->name,"slit_scale",10);
00767 if (compa==0) {
00768 d2r=DEG2RAD;
00769 p_xs_3->slit_scale=(p_all_par+ii)->best;
00770 par_found=1;
00771 }
00772 compa=strncmp((p_all_par+ii)->name,"es_s",4);
00773 if (compa==0) {
00774 p_xs_3->es_s=(p_all_par+ii)->best;
00775 par_found=1;
00776 }
00777 compa=strncmp((p_all_par+ii)->name,"es_w",4);
00778 if (compa==0) {
00779 p_xs_3->es_w=(p_all_par+ii)->best;
00780 par_found=1;
00781 }
00782 compa=strncmp((p_all_par+ii)->name,"fcol",4);
00783 if (compa==0) {
00784 p_xs_3->fcol=(p_all_par+ii)->best;
00785 par_found=1;
00786 }
00787 compa=strncmp((p_all_par+ii)->name,"cmup1",5);
00788 if (compa==0) {
00789 d2r=DEG2RAD;
00790 p_xs_3->cmup1=(p_all_par+ii)->best*d2r;
00791 par_found=1;
00792 }
00793 compa=strncmp((p_all_par+ii)->name,"mup1",4);
00794 if (compa==0) {
00795 d2r=DEG2RAD;
00796 p_xs_3->mup1=(p_all_par+ii)->best*d2r;
00797 par_found=1;
00798 }
00799 compa=strncmp((p_all_par+ii)->name,"nup1",4);
00800 if (compa==0) {
00801 d2r=DEG2RAD;
00802 p_xs_3->nup1=(p_all_par+ii)->best*d2r;
00803 par_found=1;
00804 }
00805 compa=strncmp((p_all_par+ii)->name,"taup1",5);
00806 if (compa==0) {
00807 d2r=DEG2RAD;
00808 p_xs_3->taup1=(p_all_par+ii)->best*d2r;
00809 par_found=1;
00810 }
00811 compa=strncmp((p_all_par+ii)->name,"mup2",4);
00812 if (compa==0) {
00813 d2r=DEG2RAD;
00814 p_xs_3->mup2=(p_all_par+ii)->best*d2r;
00815 par_found=1;
00816 }
00817 compa=strncmp((p_all_par+ii)->name,"nup2",4);
00818 if (compa==0) {
00819 d2r=DEG2RAD;
00820 p_xs_3->nup2=(p_all_par+ii)->best*d2r;
00821 par_found=1;
00822 }
00823 compa=strncmp((p_all_par+ii)->name,"taup2",5);
00824 if (compa==0) {
00825 d2r=DEG2RAD;
00826 p_xs_3->taup2=(p_all_par+ii)->best*d2r;
00827 par_found=1;
00828 }
00829 compa=strncmp((p_all_par+ii)->name,"mup3",4);
00830 if (compa==0) {
00831 d2r=DEG2RAD;
00832 p_xs_3->mup3=(p_all_par+ii)->best*d2r;
00833 par_found=1;
00834 }
00835 compa=strncmp((p_all_par+ii)->name,"nup3",4);
00836 if (compa==0) {
00837 d2r=DEG2RAD;
00838 p_xs_3->nup3=(p_all_par+ii)->best*d2r;
00839 par_found=1;
00840 }
00841 compa=strncmp((p_all_par+ii)->name,"taup3",5);
00842 if (compa==0) {
00843 d2r=DEG2RAD;
00844 p_xs_3->taup3=(p_all_par+ii)->best*d2r;
00845 par_found=1;
00846 }
00847 compa=strncmp((p_all_par+ii)->name,"mup4",4);
00848 if (compa==0) {
00849 d2r=DEG2RAD;
00850 p_xs_3->mup4=(p_all_par+ii)->best*d2r;
00851 par_found=1;
00852 }
00853 compa=strncmp((p_all_par+ii)->name,"nup4",4);
00854 if (compa==0) {
00855 d2r=DEG2RAD;
00856 p_xs_3->nup4=(p_all_par+ii)->best*d2r;
00857 par_found=1;
00858 }
00859 compa=strncmp((p_all_par+ii)->name,"taup4",5);
00860 if (compa==0) {
00861 d2r=DEG2RAD;
00862 p_xs_3->taup4=(p_all_par+ii)->best*d2r;
00863 par_found=1;
00864 }
00865 compa=strncmp((p_all_par+ii)->name,"mup5",4);
00866 if (compa==0) {
00867 d2r=DEG2RAD;
00868 p_xs_3->mup5=(p_all_par+ii)->best*d2r;
00869 par_found=1;
00870 }
00871 compa=strncmp((p_all_par+ii)->name,"nup5",4);
00872 if (compa==0) {
00873 d2r=DEG2RAD;
00874 p_xs_3->nup5=(p_all_par+ii)->best*d2r;
00875 par_found=1;
00876 }
00877 compa=strncmp((p_all_par+ii)->name,"taup5",5);
00878 if (compa==0) {
00879 d2r=DEG2RAD;
00880 p_xs_3->taup5=(p_all_par+ii)->best*d2r;
00881 par_found=1;
00882 }
00883 compa=strncmp((p_all_par+ii)->name,"mup6",4);
00884 if (compa==0) {
00885 d2r=DEG2RAD;
00886 p_xs_3->mup6=(p_all_par+ii)->best*d2r;
00887 par_found=1;
00888 }
00889 compa=strncmp((p_all_par+ii)->name,"nup6",4);
00890 if (compa==0) {
00891 d2r=DEG2RAD;
00892 p_xs_3->nup6=(p_all_par+ii)->best*d2r;
00893 par_found=1;
00894 }
00895 compa=strncmp((p_all_par+ii)->name,"taup6",5);
00896 if (compa==0) {
00897 d2r=DEG2RAD;
00898 p_xs_3->taup6=(p_all_par+ii)->best*d2r;
00899 par_found=1;
00900 }
00901 compa=strncmp((p_all_par+ii)->name,"mug",3);
00902 if (compa==0) {
00903 d2r=DEG2RAD;
00904 p_xs_3->mug=(p_all_par+ii)->best*d2r;
00905 par_found=1;
00906 }
00907 compa=strncmp((p_all_par+ii)->name,"nug",3);
00908 if (compa==0) {
00909 d2r=DEG2RAD;
00910 p_xs_3->nug=(p_all_par+ii)->best*d2r;
00911 par_found=1;
00912 }
00913 compa=strncmp((p_all_par+ii)->name,"taug",4);
00914 if (compa==0) {
00915 d2r=DEG2RAD;
00916 p_xs_3->taug=(p_all_par+ii)->best*d2r;
00917 par_found=1;
00918 }
00919 compa=strncmp((p_all_par+ii)->name,"sg",2);
00920 if (compa==0) {
00921 p_xs_3->sg=(p_all_par+ii)->best;
00922 par_found=1;
00923 }
00924 compa=strncmp((p_all_par+ii)->name,"fdet",4);
00925 if (compa==0) {
00926 p_xs_3->fdet=(p_all_par+ii)->best;
00927 par_found=1;
00928 }
00929 compa=strncmp((p_all_par+ii)->name,"mud",3);
00930 if (compa==0) {
00931 d2r=DEG2RAD;
00932 p_xs_3->mud=(p_all_par+ii)->best*d2r;
00933 par_found=1;
00934 }
00935 compa=strncmp((p_all_par+ii)->name,"nud",3);
00936 if (compa==0) {
00937 d2r=DEG2RAD;
00938 p_xs_3->nud=(p_all_par+ii)->best*d2r;
00939 par_found=1;
00940 }
00941 compa=strncmp((p_all_par+ii)->name,"taud",4);
00942 if (compa==0) {
00943 d2r=DEG2RAD;
00944 p_xs_3->taud=(p_all_par+ii)->best*d2r;
00945 par_found=1;
00946 }
00947 compa=strncmp((p_all_par+ii)->name,"pix",3);
00948 if (compa==0) {
00949 p_xs_3->pix=(p_all_par+ii)->best;
00950 par_found=1;
00951 }
00952 compa=strncmp((p_all_par+ii)->name,"chipx",5);
00953 if (compa==0) {
00954 p_xs_3->chipx=(p_all_par+ii)->best;
00955 par_found=1;
00956 }
00957 compa=strncmp((p_all_par+ii)->name,"chipy",5);
00958 if (compa==0) {
00959 p_xs_3->chipy=(p_all_par+ii)->best;
00960 par_found=1;
00961 }
00962 compa=strncmp((p_all_par+ii)->name,"chiprot",7);
00963 if (compa==0) {
00964 d2r=DEG2RAD;
00965 p_xs_3->chiprot=(p_all_par+ii)->best*d2r;
00966 par_found=1;
00967 }
00968 compa=strncmp((p_all_par+ii)->name,"pc_x_xx",7);
00969 if (compa==0) {
00970 p_xs_3->pc_x_xx=(p_all_par+ii)->best;
00971 par_found=1;
00972 }
00973 compa=strncmp((p_all_par+ii)->name,"pc_x_x1",7);
00974 if (compa==0) {
00975 p_xs_3->pc_x_x1=(p_all_par+ii)->best;
00976 par_found=1;
00977 }
00978 compa=strncmp((p_all_par+ii)->name,"pc_x_yy",7);
00979 if (compa==0) {
00980 p_xs_3->pc_x_yy=(p_all_par+ii)->best;
00981 par_found=1;
00982 }
00983 compa=strncmp((p_all_par+ii)->name,"pc_x_y1",7);
00984 if (compa==0) {
00985 p_xs_3->pc_x_y1=(p_all_par+ii)->best;
00986 par_found=1;
00987 }
00988 compa=strncmp((p_all_par+ii)->name,"pc_x_xy",7);
00989 if (compa==0) {
00990 p_xs_3->pc_x_xy=(p_all_par+ii)->best;
00991 par_found=1;
00992 }
00993 compa=strncmp((p_all_par+ii)->name,"pc_x_x3",7);
00994 if (compa==0) {
00995 p_xs_3->pc_x_x3=(p_all_par+ii)->best;
00996 par_found=1;
00997 }
00998 compa=strncmp((p_all_par+ii)->name,"pc_x_x2y",8);
00999 if (compa==0) {
01000 p_xs_3->pc_x_x2y=(p_all_par+ii)->best;
01001 par_found=1;
01002 }
01003 compa=strncmp((p_all_par+ii)->name,"pc_x_y2x",8);
01004 if (compa==0) {
01005 p_xs_3->pc_x_y2x=(p_all_par+ii)->best;
01006 par_found=1;
01007 }
01008 compa=strncmp((p_all_par+ii)->name,"pc_x_y3",7);
01009 if (compa==0) {
01010 p_xs_3->pc_x_y3=(p_all_par+ii)->best;
01011 par_found=1;
01012 }
01013 compa=strncmp((p_all_par+ii)->name,"pc_y_xx",7);
01014 if (compa==0) {
01015 p_xs_3->pc_y_xx=(p_all_par+ii)->best;
01016 par_found=1;
01017 }
01018 compa=strncmp((p_all_par+ii)->name,"pc_y_x1",7);
01019 if (compa==0) {
01020 p_xs_3->pc_y_x1=(p_all_par+ii)->best;
01021 par_found=1;
01022 }
01023 compa=strncmp((p_all_par+ii)->name,"pc_y_yy",7);
01024 if (compa==0) {
01025 p_xs_3->pc_y_yy=(p_all_par+ii)->best;
01026 par_found=1;
01027 }
01028 compa=strncmp((p_all_par+ii)->name,"pc_y_y1",7);
01029 if (compa==0) {
01030 p_xs_3->pc_y_y1=(p_all_par+ii)->best;
01031 par_found=1;
01032 }
01033 compa=strncmp((p_all_par+ii)->name,"pc_y_xy",7);
01034 if (compa==0) {
01035 p_xs_3->pc_y_xy=(p_all_par+ii)->best;
01036 par_found=1;
01037 }
01038 compa=strncmp((p_all_par+ii)->name,"pc_y_x3",7);
01039 if (compa==0) {
01040 p_xs_3->pc_y_x3=(p_all_par+ii)->best;
01041 par_found=1;
01042 }
01043 compa=strncmp((p_all_par+ii)->name,"pc_y_x2y",8);
01044 if (compa==0) {
01045 p_xs_3->pc_y_x2y=(p_all_par+ii)->best;
01046 par_found=1;
01047 }
01048 compa=strncmp((p_all_par+ii)->name,"pc_y_y2x",8);
01049 if (compa==0) {
01050 p_xs_3->pc_y_y2x=(p_all_par+ii)->best;
01051 par_found=1;
01052 }
01053 compa=strncmp((p_all_par+ii)->name,"pc_y_y3",7);
01054 if (compa==0) {
01055 p_xs_3->pc_y_y3=(p_all_par+ii)->best;
01056 par_found=1;
01057 }
01058 compa=strncmp((p_all_par+ii)->name,"pc4_x_xy3",9);
01059 if (compa==0) {
01060 p_xs_3->pc4_x_xy3=(p_all_par+ii)->best;
01061 par_found=1;
01062 }
01063 compa=strncmp((p_all_par+ii)->name,"pc4_x_x3y",9);
01064 if (compa==0) {
01065 p_xs_3->pc4_x_x3y=(p_all_par+ii)->best;
01066 par_found=1;
01067 }
01068 compa=strncmp((p_all_par+ii)->name,"pc4_x_x2y2",10);
01069 if (compa==0) {
01070 p_xs_3->pc4_x_x2y2=(p_all_par+ii)->best;
01071 par_found=1;
01072 }
01073 compa=strncmp((p_all_par+ii)->name,"pc4_x_x4",8);
01074 if (compa==0) {
01075 p_xs_3->pc4_x_x4=(p_all_par+ii)->best;
01076 par_found=1;
01077 }
01078 compa=strncmp((p_all_par+ii)->name,"pc4_x_y4",8);
01079 if (compa==0) {
01080 p_xs_3->pc4_x_y4=(p_all_par+ii)->best;
01081 par_found=1;
01082 }
01083 compa=strncmp((p_all_par+ii)->name,"pc4_y_xy3",9);
01084 if (compa==0) {
01085 p_xs_3->pc4_y_xy3=(p_all_par+ii)->best;
01086 par_found=1;
01087 }
01088 compa=strncmp((p_all_par+ii)->name,"pc4_y_x3y",9);
01089 if (compa==0) {
01090 p_xs_3->pc4_y_x3y=(p_all_par+ii)->best;
01091 par_found=1;
01092 }
01093 compa=strncmp((p_all_par+ii)->name,"pc4_y_x2y2",10);
01094 if (compa==0) {
01095 p_xs_3->pc4_y_x2y2=(p_all_par+ii)->best;
01096 par_found=1;
01097 }
01098 compa=strncmp((p_all_par+ii)->name,"pc4_y_x4",8);
01099 if (compa==0) {
01100 p_xs_3->pc4_y_x4=(p_all_par+ii)->best;
01101 par_found=1;
01102 }
01103 compa=strncmp((p_all_par+ii)->name,"pc4_y_y4",8);
01104 if (compa==0) {
01105 p_xs_3->pc4_y_y4=(p_all_par+ii)->best;
01106 par_found=1;
01107 }
01108 compa=strncmp((p_all_par+ii)->name,"ca_x0",5);
01109 if (compa==0) {
01110 p_xs_3->ca_x0=(p_all_par+ii)->best;
01111 par_found=1;
01112 }
01113 compa=strncmp((p_all_par+ii)->name,"ca_x1",5);
01114 if (compa==0) {
01115 p_xs_3->ca_x1=(p_all_par+ii)->best;
01116 par_found=1;
01117 }
01118 compa=strncmp((p_all_par+ii)->name,"ca_y0",5);
01119 if (compa==0) {
01120 p_xs_3->ca_y0=(p_all_par+ii)->best;
01121 par_found=1;
01122 }
01123 compa=strncmp((p_all_par+ii)->name,"ca_y1",5);
01124 if (compa==0) {
01125 p_xs_3->ca_y1=(p_all_par+ii)->best;
01126 par_found=1;
01127 }
01128 compa=strncmp((p_all_par+ii)->name,"d2_x1",5);
01129 if (compa==0) {
01130 p_xs_3->d2_x1=(p_all_par+ii)->best;
01131 par_found=1;
01132 }
01133 compa=strncmp((p_all_par+ii)->name,"d2_x2",5);
01134 if (compa==0) {
01135 p_xs_3->d2_x2=(p_all_par+ii)->best;
01136 par_found=1;
01137 }
01138 compa=strncmp((p_all_par+ii)->name,"d2_x3",5);
01139 if (compa==0) {
01140 p_xs_3->d2_x3=(p_all_par+ii)->best;
01141 par_found=1;
01142 }
01143 compa=strncmp((p_all_par+ii)->name,"d2_y1x0",7);
01144 if (compa==0) {
01145 p_xs_3->d2_y1x0=(p_all_par+ii)->best;
01146 par_found=1;
01147 }
01148 compa=strncmp((p_all_par+ii)->name,"d2_y1x1",7);
01149 if (compa==0) {
01150 p_xs_3->d2_y1x1=(p_all_par+ii)->best;
01151 par_found=1;
01152 }
01153 compa=strncmp((p_all_par+ii)->name,"d2_y1x2",7);
01154 if (compa==0) {
01155 p_xs_3->d2_y1x2=(p_all_par+ii)->best;
01156 par_found=1;
01157 }
01158 compa=strncmp((p_all_par+ii)->name,"d2_y1x3",7);
01159 if (compa==0) {
01160 p_xs_3->d2_y1x3=(p_all_par+ii)->best;
01161 par_found=1;
01162 }
01163 compa=strncmp((p_all_par+ii)->name,"d2_y2x0",7);
01164 if (compa==0) {
01165 p_xs_3->d2_y2x0=(p_all_par+ii)->best;
01166 par_found=1;
01167 }
01168 compa=strncmp((p_all_par+ii)->name,"d2_y2x1",7);
01169 if (compa==0) {
01170 p_xs_3->d2_y2x1=(p_all_par+ii)->best;
01171 par_found=1;
01172 }
01173 compa=strncmp((p_all_par+ii)->name,"d2_y2x2",7);
01174 if (compa==0) {
01175 p_xs_3->d2_y2x2=(p_all_par+ii)->best;
01176 par_found=1;
01177 }
01178 compa=strncmp((p_all_par+ii)->name,"d2_y2x3",7);
01179 if (compa==0) {
01180 p_xs_3->d2_y2x3=(p_all_par+ii)->best;
01181 par_found=1;
01182 }
01183 compa=strncmp((p_all_par+ii)->name,"d2_y3x0",7);
01184 if (compa==0) {
01185 p_xs_3->d2_y3x0=(p_all_par+ii)->best;
01186 par_found=1;
01187 }
01188 compa=strncmp((p_all_par+ii)->name,"d2_y3x1",7);
01189 if (compa==0) {
01190 p_xs_3->d2_y3x1=(p_all_par+ii)->best;
01191 par_found=1;
01192 }
01193 compa=strncmp((p_all_par+ii)->name,"d2_y3x2",7);
01194 if (compa==0) {
01195 p_xs_3->d2_y3x2=(p_all_par+ii)->best;
01196 par_found=1;
01197 }
01198 compa=strncmp((p_all_par+ii)->name,"d2_y3x3",7);
01199 if (compa==0) {
01200 p_xs_3->d2_y3x3=(p_all_par+ii)->best;
01201 par_found=1;
01202 }
01203 compa=strncmp((p_all_par+ii)->name,"offx",4);
01204 if (compa==0) {
01205 p_xs_3->offx=(p_all_par+ii)->best;
01206 par_found=1;
01207 }
01208 compa=strncmp((p_all_par+ii)->name,"offy",4);
01209 if (compa==0) {
01210 p_xs_3->offy=(p_all_par+ii)->best;
01211 par_found=1;
01212 }
01213 compa=strncmp((p_all_par+ii)->name,"flipx",5);
01214 if (compa==0) {
01215 p_xs_3->flipx=(p_all_par+ii)->best;
01216 par_found=1;
01217 }
01218 compa=strncmp((p_all_par+ii)->name,"flipy",5);
01219 if (compa==0) {
01220 p_xs_3->flipy=(p_all_par+ii)->best;
01221 par_found=1;
01222 }
01223 for (kk=0;kk<9;kk++) {
01224 sprintf(tempstr,"slit[%d]",kk);
01225 indlen=strlen(tempstr);
01226 compa=strncmp((p_all_par+ii)->name,tempstr,indlen);
01227 if (compa==0) {
01228 p_xs_3->slit[kk]=(p_all_par+ii)->best;
01229 par_found=1;
01230 }
01231 }
01232 if (par_found==1) {
01233 if ((p_all_par+ii)->flag!=0) {
01234 abest[jj]=(p_all_par+ii)->best;
01235 amin[jj]=(p_all_par+ii)->min;
01236 amax[jj]=(p_all_par+ii)->max;
01237 aname[jj]=ii;
01238 printf("%d %s %d \n", ii, (p_all_par+ii)->name, jj);
01239 jj++;
01240 }
01241 }
01242 }
01243 if (p_xs_3->arm==0) {
01244 p_xs_3->morder=UVB_morder;
01245 p_xs_3->blaze_pad=UVB_blaze_pad;
01246 xsh_instrument_set_arm(instr, XSH_ARM_UVB);
01247 p_xs_3->xsize_corr=UVB_xsize_corr;
01248 p_xs_3->ysize_corr=UVB_ysize_corr;
01249 }
01250 else if (p_xs_3->arm==1) {
01251 p_xs_3->morder=VIS_morder;
01252 p_xs_3->blaze_pad=VIS_blaze_pad;
01253 xsh_instrument_set_arm(instr, XSH_ARM_VIS);
01254 p_xs_3->xsize_corr=VIS_xsize_corr;
01255 p_xs_3->ysize_corr=VIS_ysize_corr;
01256 }
01257 else if (p_xs_3->arm==2) {
01258 p_xs_3->morder=NIR_morder;
01259 p_xs_3->blaze_pad=NIR_blaze_pad;
01260 xsh_instrument_set_arm(instr, XSH_ARM_NIR);
01261 p_xs_3->xsize_corr=NIR_xsize_corr;
01262 p_xs_3->ysize_corr=NIR_ysize_corr;
01263 }
01264 else {
01265 return -1;
01266 }
01267 instr_config=xsh_instrument_get_config(instr);
01268 p_xs_3->BSIZE=instr_config->ny;
01269 p_xs_3->ASIZE=instr_config->nx;
01270 p_xs_3->SIZE=p_xs_3->BSIZE;
01271 p_xs_3->chipypix=(float)(p_xs_3->BSIZE);
01272 p_xs_3->chipxpix=(float)(p_xs_3->ASIZE);
01273 p_xs_3->morder_min=instr_config->order_min;
01274 p_xs_3->morder_max=instr_config->order_max;
01275
01276 p_xs_3->pix_X=p_xs_3->pix_Y=p_xs_3->pix;
01277
01278 xsh_instrument_free(&instr);
01279
01280 return jj;
01281 }
01282
01283 #define xsh_model_config_enter(name, val, index, units) \
01284 cpl_table_set_string(tab, XSH_COL_MODEL_CONF_NAME, index, name) ; \
01285 cpl_table_set_double(tab, XSH_COL_MODEL_CONF_BEST, index, val) ; \
01286 cpl_table_set_double(tab, XSH_COL_MODEL_CONF_LOW, index, val) ; \
01287 cpl_table_set_double(tab, XSH_COL_MODEL_CONF_HIGH, index, val) ; \
01288 cpl_table_set_int(tab, XSH_COL_MODEL_CONF_FLAG, index, 0) ; \
01289 cpl_table_set_string(tab, XSH_COL_MODEL_CONF_UNITS, index, units) ;
01290
01291 cpl_table * xsh_model_io_output_cfg(struct xs_3 *p_xs_3)
01292 {
01293 cpl_table * tab ;
01294 char tempstr[10];
01295 int nb_parameters ;
01296 int i, j ;
01297
01298
01299 nb_parameters = 91 ;
01300
01301
01302 tab = cpl_table_new(nb_parameters) ;
01303 cpl_table_new_column(tab, XSH_COL_MODEL_CONF_BEST, CPL_TYPE_DOUBLE) ;
01304 cpl_table_new_column(tab, XSH_COL_MODEL_CONF_LOW, CPL_TYPE_DOUBLE) ;
01305 cpl_table_new_column(tab, XSH_COL_MODEL_CONF_HIGH, CPL_TYPE_DOUBLE) ;
01306 cpl_table_new_column(tab, XSH_COL_MODEL_CONF_FLAG, CPL_TYPE_INT) ;
01307 cpl_table_new_column(tab, XSH_COL_MODEL_CONF_NAME, CPL_TYPE_STRING) ;
01308 cpl_table_new_column(tab, XSH_COL_MODEL_CONF_UNITS, CPL_TYPE_STRING) ;
01309
01310 i = 0 ;
01311 xsh_model_config_enter("arm", p_xs_3->arm, i, NULL) ; i++ ;
01312 xsh_model_config_enter("temper", p_xs_3->temper, i,"K") ; i++ ;
01313 xsh_model_config_enter("t_ir_p2", p_xs_3->t_ir_p2, i,"K") ; i++ ;
01314 xsh_model_config_enter("t_ir_p3", p_xs_3->t_ir_p3, i,"K") ; i++ ;
01315 xsh_model_config_enter("es_x", p_xs_3->es_x, i,"mm") ; i++ ;
01316 xsh_model_config_enter("es_y", p_xs_3->es_y, i,"mm") ; i++ ;
01317 xsh_model_config_enter("mues", p_xs_3->mues/DEG2RAD, i,"deg") ; i++ ;
01318 xsh_model_config_enter("nues", p_xs_3->nues/DEG2RAD, i,"deg") ; i++ ;
01319 xsh_model_config_enter("taues", p_xs_3->taues/DEG2RAD,i,"deg") ; i++ ;
01320 xsh_model_config_enter("slit_scale", p_xs_3->slit_scale,i,"mm/\"") ; i++ ;
01321 xsh_model_config_enter("es_s", p_xs_3->es_s, i,"mm") ; i++ ;
01322 xsh_model_config_enter("es_w", p_xs_3->es_w, i,"mm") ; i++ ;
01323 xsh_model_config_enter("fcol", p_xs_3->fcol, i,"mm") ; i++ ;
01324 xsh_model_config_enter("cmup1", p_xs_3->cmup1/DEG2RAD, i,"deg") ; i++ ;
01325 xsh_model_config_enter("mup1", p_xs_3->mup1/DEG2RAD, i,"deg") ; i++ ;
01326 xsh_model_config_enter("nup1", p_xs_3->nup1/DEG2RAD, i,"deg") ; i++ ;
01327 xsh_model_config_enter("taup1", p_xs_3->taup1/DEG2RAD, i,"deg") ; i++ ;
01328 xsh_model_config_enter("mup2", p_xs_3->mup2/DEG2RAD, i,"deg") ; i++ ;
01329 xsh_model_config_enter("nup2", p_xs_3->nup2/DEG2RAD, i,"deg") ; i++ ;
01330 xsh_model_config_enter("taup2", p_xs_3->taup2/DEG2RAD, i,"deg") ; i++ ;
01331 xsh_model_config_enter("mup3", p_xs_3->mup3/DEG2RAD, i,"deg") ; i++ ;
01332 xsh_model_config_enter("nup3", p_xs_3->nup3/DEG2RAD, i,"deg") ; i++ ;
01333 xsh_model_config_enter("taup3", p_xs_3->taup3/DEG2RAD, i,"deg") ; i++ ;
01334 xsh_model_config_enter("mup4", p_xs_3->mup4/DEG2RAD, i,"deg") ; i++ ;
01335 xsh_model_config_enter("nup4", p_xs_3->nup4/DEG2RAD, i,"deg") ; i++ ;
01336 xsh_model_config_enter("taup4", p_xs_3->taup4/DEG2RAD, i,"deg") ; i++ ;
01337 xsh_model_config_enter("mup5", p_xs_3->mup5/DEG2RAD, i,"deg") ; i++ ;
01338 xsh_model_config_enter("nup5", p_xs_3->nup5/DEG2RAD, i,"deg") ; i++ ;
01339 xsh_model_config_enter("taup5", p_xs_3->taup5/DEG2RAD, i,"deg") ; i++ ;
01340 xsh_model_config_enter("mup6", p_xs_3->mup6/DEG2RAD, i,"deg") ; i++ ;
01341 xsh_model_config_enter("nup6", p_xs_3->nup6/DEG2RAD, i,"deg") ; i++ ;
01342 xsh_model_config_enter("taup6", p_xs_3->taup6/DEG2RAD, i,"deg") ; i++ ;
01343 xsh_model_config_enter("mug", p_xs_3->mug/DEG2RAD, i,"deg") ; i++ ;
01344 xsh_model_config_enter("nug", p_xs_3->nug/DEG2RAD, i,"deg") ; i++ ;
01345 xsh_model_config_enter("taug", p_xs_3->taug/DEG2RAD, i,"deg") ; i++ ;
01346 xsh_model_config_enter("sg", p_xs_3->sg, i,"mm-1") ; i++ ;
01347 xsh_model_config_enter("fdet", p_xs_3->fdet, i,"mm") ; i++ ;
01348 xsh_model_config_enter("mud", p_xs_3->mud/DEG2RAD, i,"deg") ; i++ ;
01349 xsh_model_config_enter("nud", p_xs_3->nud/DEG2RAD, i,"deg") ; i++ ;
01350 xsh_model_config_enter("taud", p_xs_3->taud/DEG2RAD, i,"deg") ; i++ ;
01351 xsh_model_config_enter("pix", p_xs_3->pix, i,"mm") ; i++ ;
01352 xsh_model_config_enter("chipx", p_xs_3->chipx, i,"mm") ; i++ ;
01353 xsh_model_config_enter("chipy", p_xs_3->chipy, i,"mm") ; i++ ;
01354 xsh_model_config_enter("chiprot", p_xs_3->chiprot/DEG2RAD,i,"deg");i++;
01355 xsh_model_config_enter("pc_x_xx", p_xs_3->pc_x_xx, i,NULL) ; i++ ;
01356 xsh_model_config_enter("pc_x_x1", p_xs_3->pc_x_x1, i,NULL) ; i++ ;
01357 xsh_model_config_enter("pc_x_yy", p_xs_3->pc_x_yy, i,NULL) ; i++ ;
01358 xsh_model_config_enter("pc_x_y1", p_xs_3->pc_x_y1, i,NULL) ; i++ ;
01359 xsh_model_config_enter("pc_x_xy", p_xs_3->pc_x_xy, i,NULL) ; i++ ;
01360 xsh_model_config_enter("pc_x_x3", p_xs_3->pc_x_x3, i,NULL) ; i++ ;
01361 xsh_model_config_enter("pc_x_x2y", p_xs_3->pc_x_x2y, i,NULL) ; i++ ;
01362 xsh_model_config_enter("pc_x_y2x", p_xs_3->pc_x_y2x, i,NULL) ; i++ ;
01363 xsh_model_config_enter("pc_x_y3", p_xs_3->pc_x_y3, i,NULL) ; i++ ;
01364 xsh_model_config_enter("pc_y_xx", p_xs_3->pc_y_xx, i,NULL) ; i++ ;
01365 xsh_model_config_enter("pc_y_x1", p_xs_3->pc_y_x1, i,NULL) ; i++ ;
01366 xsh_model_config_enter("pc_y_yy", p_xs_3->pc_y_yy, i,NULL) ; i++ ;
01367 xsh_model_config_enter("pc_y_y1", p_xs_3->pc_y_y1, i,NULL) ; i++ ;
01368 xsh_model_config_enter("pc_y_xy", p_xs_3->pc_y_xy, i,NULL) ; i++ ;
01369 xsh_model_config_enter("pc_y_x3", p_xs_3->pc_y_x3, i,NULL) ; i++ ;
01370 xsh_model_config_enter("pc_y_x2y", p_xs_3->pc_y_x2y, i,NULL) ; i++ ;
01371 xsh_model_config_enter("pc_y_y2x", p_xs_3->pc_y_y2x, i,NULL) ; i++ ;
01372 xsh_model_config_enter("pc_y_y3", p_xs_3->pc_y_y3, i,NULL) ; i++ ;
01373 if (p_xs_3->arm==2 && p_xs_3->d2_y1x0==0.0) {
01374 xsh_model_config_enter("pc4_x_xy3", p_xs_3->pc4_x_xy3, i,NULL) ; i++ ;
01375 xsh_model_config_enter("pc4_x_x3y", p_xs_3->pc4_x_x3y, i,NULL) ; i++ ;
01376 xsh_model_config_enter("pc4_x_x2y2", p_xs_3->pc4_x_x2y2, i,NULL) ; i++ ;
01377 xsh_model_config_enter("pc4_x_x4", p_xs_3->pc4_x_x4, i,NULL) ; i++ ;
01378 xsh_model_config_enter("pc4_x_y4", p_xs_3->pc4_x_y4, i,NULL) ; i++ ;
01379 xsh_model_config_enter("pc4_y_xy3", p_xs_3->pc4_y_xy3, i,NULL) ; i++ ;
01380 xsh_model_config_enter("pc4_y_x3y", p_xs_3->pc4_y_x3y, i,NULL) ; i++ ;
01381 xsh_model_config_enter("pc4_y_x2y2", p_xs_3->pc4_y_x2y2, i,NULL) ; i++ ;
01382 xsh_model_config_enter("pc4_y_x4", p_xs_3->pc4_y_x4, i,NULL) ; i++ ;
01383 xsh_model_config_enter("pc4_y_y4", p_xs_3->pc4_y_y4, i,NULL) ; i++ ;
01384 xsh_model_config_enter("ca_x0", p_xs_3->ca_x0, i,NULL) ; i++ ;
01385 xsh_model_config_enter("ca_x1", p_xs_3->ca_x1, i,NULL) ; i++ ;
01386 xsh_model_config_enter("ca_y0", p_xs_3->ca_y0, i,NULL) ; i++ ;
01387 xsh_model_config_enter("ca_y1", p_xs_3->ca_y1, i,NULL) ; i++ ;
01388 }
01389 else {
01390 xsh_model_config_enter("d2_y1x0", p_xs_3->d2_y1x0, i,NULL) ; i++ ;
01391 xsh_model_config_enter("d2_y1x1", p_xs_3->d2_y1x1, i,NULL) ; i++ ;
01392 xsh_model_config_enter("d2_y1x2", p_xs_3->d2_y1x2, i,NULL) ; i++ ;
01393 xsh_model_config_enter("d2_y1x3", p_xs_3->d2_y1x3, i,NULL) ; i++ ;
01394 xsh_model_config_enter("d2_y2x0", p_xs_3->d2_y2x0, i,NULL) ; i++ ;
01395 xsh_model_config_enter("d2_y2x1", p_xs_3->d2_y2x1, i,NULL) ; i++ ;
01396 xsh_model_config_enter("d2_y2x2", p_xs_3->d2_y2x2, i,NULL) ; i++ ;
01397 xsh_model_config_enter("d2_y2x3", p_xs_3->d2_y2x3, i,NULL) ; i++ ;
01398 xsh_model_config_enter("d2_y3x0", p_xs_3->d2_y3x0, i,NULL) ; i++ ;
01399 xsh_model_config_enter("d2_y3x1", p_xs_3->d2_y3x1, i,NULL) ; i++ ;
01400 xsh_model_config_enter("d2_y3x2", p_xs_3->d2_y3x2, i,NULL) ; i++ ;
01401 xsh_model_config_enter("d2_y3x3", p_xs_3->d2_y3x3, i,NULL) ; i++ ;
01402 xsh_model_config_enter("offx", p_xs_3->offx, i,"pix") ; i++ ;
01403 xsh_model_config_enter("offy", p_xs_3->offy, i,"pix") ; i++ ;
01404 }
01405 xsh_model_config_enter("d2_x1", p_xs_3->d2_x1, i,NULL) ; i++ ;
01406 xsh_model_config_enter("d2_x2", p_xs_3->d2_x2, i,NULL) ; i++ ;
01407 xsh_model_config_enter("d2_x3", p_xs_3->d2_x3, i,NULL) ; i++ ;
01408
01409 xsh_model_config_enter("flipx", p_xs_3->flipx, i,NULL) ; i++ ;
01410 xsh_model_config_enter("flipy", p_xs_3->flipy, i,NULL) ; i++ ;
01411 for (j=0 ; j<9 ; j++) {
01412 sprintf(tempstr, "slit[%d]", j) ;
01413 xsh_model_config_enter(tempstr, p_xs_3->slit[j], i,"\"") ; i++ ;
01414 }
01415 xsh_model_config_enter("config_mjd", p_xs_3->config_mjd, i,"days") ; i++ ;
01416
01417 return tab ;
01418 }
01419
01420
01421
01422
01425 cpl_table * xsh_load_table_check(
01426 const char * in,
01427 const char * procatg)
01428 {
01429 cpl_table * out ;
01430 int nok ;
01431
01432
01433 if (in == NULL) return NULL ;
01434 if (procatg == NULL) return NULL ;
01435
01436
01437
01438 if ((out = cpl_table_load(in, 1, 0)) == NULL) {
01439 cpl_msg_error(__func__, "Cannot load %s as a table", in) ;
01440 return NULL ;
01441 }
01442
01443
01444 nok = 0 ;
01445
01446
01447 if (
01448 !strcmp(procatg, XSH_MOD_CFG_TAB_UVB) ||
01449 !strcmp(procatg, XSH_MOD_CFG_TAB_VIS) ||
01450 !strcmp(procatg, XSH_MOD_CFG_TAB_NIR) ||
01451 !strcmp(procatg, XSH_MOD_CFG_OPT_AFC_UVB) ||
01452 !strcmp(procatg, XSH_MOD_CFG_OPT_AFC_VIS) ||
01453 !strcmp(procatg, XSH_MOD_CFG_OPT_AFC_NIR) ||
01454
01455 !strcmp(procatg, XSH_MOD_CFG_OPT_REC_UVB) ||
01456 !strcmp(procatg, XSH_MOD_CFG_OPT_REC_VIS) ||
01457 !strcmp(procatg, XSH_MOD_CFG_OPT_REC_NIR) ||
01458
01459
01460 !strcmp(procatg, XSH_MOD_CFG_OPT_FMT_UVB) ||
01461 !strcmp(procatg, XSH_MOD_CFG_OPT_FMT_VIS) ||
01462 !strcmp(procatg, XSH_MOD_CFG_OPT_FMT_NIR) ||
01463
01464
01465 !strcmp(procatg, XSH_MOD_CFG_OPT_2D_UVB) ||
01466 !strcmp(procatg, XSH_MOD_CFG_OPT_2D_VIS) ||
01467 !strcmp(procatg, XSH_MOD_CFG_OPT_2D_NIR) ||
01468
01469 !strcmp(procatg, XSH_MOD_CFG_OPT_WAV_SLIT_UVB) ||
01470 !strcmp(procatg, XSH_MOD_CFG_OPT_WAV_SLIT_VIS) ||
01471 !strcmp(procatg, XSH_MOD_CFG_OPT_WAV_SLIT_NIR) ||
01472
01473 !strcmp(procatg, XSH_MOD_CFG_OPT_WAV_IFU_UVB) ||
01474 !strcmp(procatg, XSH_MOD_CFG_OPT_WAV_IFU_VIS) ||
01475 !strcmp(procatg, XSH_MOD_CFG_OPT_WAV_IFU_NIR) ||
01476
01477 !strcmp(procatg, XSH_MOD_CFG_UVB) ||
01478 !strcmp(procatg, XSH_MOD_CFG_VIS) ||
01479 !strcmp(procatg, XSH_MOD_CFG_NIR) ||
01480 !strcmp(procatg, XSH_MOD_CFG_FAN_UVB) ||
01481 !strcmp(procatg, XSH_MOD_CFG_FAN_VIS) ||
01482 !strcmp(procatg, XSH_MOD_CFG_FAN_NIR) ||
01483 !strcmp(procatg, XSH_MOD_CFG_OPEN_UVB) ||
01484 !strcmp(procatg, XSH_MOD_CFG_OPEN_VIS) ||
01485 !strcmp(procatg, XSH_MOD_CFG_OPEN_NIR)) {
01486
01487 nok += xsh_table_check_column(out, XSH_COL_MODEL_CONF_NAME) ;
01488 nok += xsh_table_check_column(out, XSH_COL_MODEL_CONF_BEST) ;
01489 nok += xsh_table_check_column(out, XSH_COL_MODEL_CONF_LOW) ;
01490 nok += xsh_table_check_column(out, XSH_COL_MODEL_CONF_HIGH) ;
01491 nok += xsh_table_check_column(out, XSH_COL_MODEL_CONF_FLAG) ;
01492 } else {
01493 cpl_msg_error(__func__, "Unsupported PRO.CATG: %s", procatg) ;
01494 cpl_table_delete(out) ;
01495 return NULL ;
01496 }
01497
01498
01499 if (nok > 0) {
01500 xsh_msg_error("%d",cpl_error_get_code());
01501 xsh_msg_error("%s",cpl_error_get_where());
01502 cpl_table_delete(out) ;
01503 return NULL ;
01504 }
01505
01506 return out ;
01507 }
01508
01509
01510 static int xsh_table_check_column(
01511 const cpl_table * tab,
01512 const char * col)
01513 {
01514 int ret ;
01515 if (!cpl_table_has_column(tab, col)) {
01516 cpl_msg_error(__func__, "Column %s is missing", col) ;
01517 ret = 1 ;
01518 } else ret = 0 ;
01519 return ret ;
01520 }
01521
01522 void xsh_model_io_output_cfg_txt(struct xs_3 *p_xs_3)
01523 {
01524 FILE * tempcfg;
01525 char tempstr[10];
01526 int jj;
01527
01528
01529 tempcfg=fopen("xsh_temp.cfg","w");
01530
01531 fprintf(tempcfg,"%lf %lf %lf %d temper\n", p_xs_3->temper,p_xs_3->temper,p_xs_3->temper,0);
01532 fprintf(tempcfg,"%lf %lf %lf %d t_ir_p2\n", p_xs_3->t_ir_p2,p_xs_3->t_ir_p2,p_xs_3->t_ir_p2,0);
01533 fprintf(tempcfg,"%lf %lf %lf %d t_ir_p3\n", p_xs_3->t_ir_p3,p_xs_3->t_ir_p3,p_xs_3->t_ir_p3,0);
01534 fprintf(tempcfg,"%lf %lf %lf %d es_x\n", p_xs_3->es_x,p_xs_3->es_x,p_xs_3->es_x,0);
01535 fprintf(tempcfg,"%lf %lf %lf %d es_y\n", p_xs_3->es_y,p_xs_3->es_y,p_xs_3->es_y,0);
01536 fprintf(tempcfg,"%lf es_y_tot\n", p_xs_3->es_y_tot);
01537 fprintf(tempcfg,"%lf %lf %lf %d mues\n", p_xs_3->mues/DEG2RAD,p_xs_3->mues/DEG2RAD,p_xs_3->mues/DEG2RAD,0);
01538 fprintf(tempcfg,"%lf %lf %lf %d nues\n", p_xs_3->nues/DEG2RAD,p_xs_3->nues/DEG2RAD,p_xs_3->nues/DEG2RAD,0);
01539 fprintf(tempcfg,"%lf %lf %lf %d taues\n", p_xs_3->taues/DEG2RAD,p_xs_3->taues/DEG2RAD,p_xs_3->taues/DEG2RAD,0);
01540 fprintf(tempcfg,"%lf %lf %lf %d slit_scale\n", p_xs_3->slit_scale,p_xs_3->slit_scale,p_xs_3->slit_scale,0);
01541 fprintf(tempcfg,"%lf %lf %lf %d es_s\n", p_xs_3->es_s,p_xs_3->es_s,p_xs_3->es_s,0);
01542 fprintf(tempcfg,"%lf %lf %lf %d es_w\n", p_xs_3->es_w,p_xs_3->es_w,p_xs_3->es_w,0);
01543 fprintf(tempcfg,"%lf %lf %lf %d fcol\n", p_xs_3->fcol,p_xs_3->fcol,p_xs_3->fcol,0);
01544 fprintf(tempcfg,"%lf %lf %lf %d cmup1\n", p_xs_3->cmup1/DEG2RAD,p_xs_3->cmup1/DEG2RAD,p_xs_3->cmup1/DEG2RAD,0);
01545 fprintf(tempcfg,"%lf %lf %lf %d mup1\n", p_xs_3->mup1/DEG2RAD,p_xs_3->mup1/DEG2RAD,p_xs_3->mup1/DEG2RAD,0);
01546 fprintf(tempcfg,"%lf %lf %lf %d nup1\n", p_xs_3->nup1/DEG2RAD,p_xs_3->nup1/DEG2RAD,p_xs_3->nup1/DEG2RAD,0);
01547 fprintf(tempcfg,"%lf %lf %lf %d taup1\n", p_xs_3->taup1/DEG2RAD,p_xs_3->taup1/DEG2RAD,p_xs_3->taup1/DEG2RAD,0);
01548 fprintf(tempcfg,"%lf %lf %lf %d mup2\n", p_xs_3->mup2/DEG2RAD,p_xs_3->mup2/DEG2RAD,p_xs_3->mup2/DEG2RAD,0);
01549 fprintf(tempcfg,"%lf %lf %lf %d nup2\n", p_xs_3->nup2/DEG2RAD,p_xs_3->nup2/DEG2RAD,p_xs_3->nup2/DEG2RAD,0);
01550 fprintf(tempcfg,"%lf %lf %lf %d taup2\n", p_xs_3->taup2/DEG2RAD,p_xs_3->taup2/DEG2RAD,p_xs_3->taup2/DEG2RAD,0);
01551 fprintf(tempcfg,"%lf %lf %lf %d mup3\n", p_xs_3->mup3/DEG2RAD,p_xs_3->mup3/DEG2RAD,p_xs_3->mup3/DEG2RAD,0);
01552 fprintf(tempcfg,"%lf %lf %lf %d nup3\n", p_xs_3->nup3/DEG2RAD,p_xs_3->nup3/DEG2RAD,p_xs_3->nup3/DEG2RAD,0);
01553 fprintf(tempcfg,"%lf %lf %lf %d taup3\n", p_xs_3->taup3/DEG2RAD,p_xs_3->taup3/DEG2RAD,p_xs_3->taup3/DEG2RAD,0);
01554 fprintf(tempcfg,"%lf %lf %lf %d mup4\n", p_xs_3->mup4/DEG2RAD,p_xs_3->mup4/DEG2RAD,p_xs_3->mup4/DEG2RAD,0);
01555 fprintf(tempcfg,"%lf %lf %lf %d nup4\n", p_xs_3->nup4/DEG2RAD,p_xs_3->nup4/DEG2RAD,p_xs_3->nup4/DEG2RAD,0);
01556 fprintf(tempcfg,"%lf %lf %lf %d taup4\n", p_xs_3->taup4/DEG2RAD,p_xs_3->taup4/DEG2RAD,p_xs_3->taup4/DEG2RAD,0);
01557 fprintf(tempcfg,"%lf %lf %lf %d mup5\n", p_xs_3->mup5/DEG2RAD,p_xs_3->mup5/DEG2RAD,p_xs_3->mup5/DEG2RAD,0);
01558 fprintf(tempcfg,"%lf %lf %lf %d nup5\n", p_xs_3->nup5/DEG2RAD,p_xs_3->nup5/DEG2RAD,p_xs_3->nup5/DEG2RAD,0);
01559 fprintf(tempcfg,"%lf %lf %lf %d taup5\n", p_xs_3->taup5/DEG2RAD,p_xs_3->taup5/DEG2RAD,p_xs_3->taup5/DEG2RAD,0);
01560 fprintf(tempcfg,"%lf %lf %lf %d mup6\n", p_xs_3->mup6/DEG2RAD,p_xs_3->mup6/DEG2RAD,p_xs_3->mup6/DEG2RAD,0);
01561 fprintf(tempcfg,"%lf %lf %lf %d nup6\n", p_xs_3->nup6/DEG2RAD,p_xs_3->nup6/DEG2RAD,p_xs_3->nup6/DEG2RAD,0);
01562 fprintf(tempcfg,"%lf %lf %lf %d taup6\n", p_xs_3->taup6/DEG2RAD,p_xs_3->taup6/DEG2RAD,p_xs_3->taup6/DEG2RAD,0);
01563 fprintf(tempcfg,"%lf %lf %lf %d mug\n", p_xs_3->mug/DEG2RAD,p_xs_3->mug/DEG2RAD,p_xs_3->mug/DEG2RAD,0);
01564 fprintf(tempcfg,"%lf %lf %lf %d nug\n", p_xs_3->nug/DEG2RAD,p_xs_3->nug/DEG2RAD,p_xs_3->nug/DEG2RAD,0);
01565 fprintf(tempcfg,"%lf %lf %lf %d taug\n", p_xs_3->taug/DEG2RAD,p_xs_3->taug/DEG2RAD,p_xs_3->taug/DEG2RAD,0);
01566 fprintf(tempcfg,"%lf %lf %lf %d sg\n", p_xs_3->sg,p_xs_3->sg,p_xs_3->sg,0);
01567 fprintf(tempcfg,"%lf %lf %lf %d fdet\n", p_xs_3->fdet,p_xs_3->fdet,p_xs_3->fdet,0);
01568 fprintf(tempcfg,"%lf %lf %lf %d mud\n", p_xs_3->mud/DEG2RAD,p_xs_3->mud/DEG2RAD,p_xs_3->mud/DEG2RAD,0);
01569 fprintf(tempcfg,"%lf %lf %lf %d nud\n", p_xs_3->nud/DEG2RAD,p_xs_3->nud/DEG2RAD,p_xs_3->nud/DEG2RAD,0);
01570 fprintf(tempcfg,"%lf %lf %lf %d taud\n", p_xs_3->taud/DEG2RAD,p_xs_3->taud/DEG2RAD,p_xs_3->taud/DEG2RAD,0);
01571 fprintf(tempcfg,"%lf %lf %lf %d pix\n", p_xs_3->pix,p_xs_3->pix,p_xs_3->pix,0);
01572 fprintf(tempcfg,"%lf %lf %lf %d chipx\n", p_xs_3->chipx,p_xs_3->chipx,p_xs_3->chipx,0);
01573 fprintf(tempcfg,"%lf %lf %lf %d chipy\n", p_xs_3->chipy,p_xs_3->chipy,p_xs_3->chipy,0);
01574 fprintf(tempcfg,"%lf %lf %lf %d chiprot\n", p_xs_3->chiprot/DEG2RAD,p_xs_3->chiprot/DEG2RAD,p_xs_3->chiprot/DEG2RAD,0);
01575 fprintf(tempcfg,"%lf %lf %lf %d pc_x_xx\n", p_xs_3->pc_x_xx,p_xs_3->pc_x_xx,p_xs_3->pc_x_xx,0);
01576 fprintf(tempcfg,"%lf %lf %lf %d pc_x_x1\n", p_xs_3->pc_x_x1,p_xs_3->pc_x_x1,p_xs_3->pc_x_x1,0);
01577 fprintf(tempcfg,"%lf %lf %lf %d pc_x_yy\n", p_xs_3->pc_x_yy,p_xs_3->pc_x_yy,p_xs_3->pc_x_yy,0);
01578 fprintf(tempcfg,"%lf %lf %lf %d pc_x_y1\n", p_xs_3->pc_x_y1,p_xs_3->pc_x_y1,p_xs_3->pc_x_y1,0);
01579 fprintf(tempcfg,"%lf %lf %lf %d pc_x_xy\n", p_xs_3->pc_x_xy,p_xs_3->pc_x_xy,p_xs_3->pc_x_xy,0);
01580 fprintf(tempcfg,"%lf %lf %lf %d pc_x_x3\n", p_xs_3->pc_x_x3,p_xs_3->pc_x_x3,p_xs_3->pc_x_x3,0);
01581 fprintf(tempcfg,"%lf %lf %lf %d pc_x_x2y\n", p_xs_3->pc_x_x2y,p_xs_3->pc_x_x2y,p_xs_3->pc_x_x2y,0);
01582 fprintf(tempcfg,"%lf %lf %lf %d pc_x_y2x\n", p_xs_3->pc_x_y2x,p_xs_3->pc_x_y2x,p_xs_3->pc_x_y2x,0);
01583 fprintf(tempcfg,"%lf %lf %lf %d pc_x_y3\n", p_xs_3->pc_x_y3,p_xs_3->pc_x_y3,p_xs_3->pc_x_y3,0);
01584 fprintf(tempcfg,"%lf %lf %lf %d pc_y_xx\n", p_xs_3->pc_y_xx,p_xs_3->pc_y_xx,p_xs_3->pc_y_xx,0);
01585 fprintf(tempcfg,"%lf %lf %lf %d pc_y_x1\n", p_xs_3->pc_y_x1,p_xs_3->pc_y_x1,p_xs_3->pc_y_x1,0);
01586 fprintf(tempcfg,"%lf %lf %lf %d pc_y_yy\n", p_xs_3->pc_y_yy,p_xs_3->pc_y_yy,p_xs_3->pc_y_yy,0);
01587 fprintf(tempcfg,"%lf %lf %lf %d pc_y_y1\n", p_xs_3->pc_y_y1,p_xs_3->pc_y_y1,p_xs_3->pc_y_y1,0);
01588 fprintf(tempcfg,"%lf %lf %lf %d pc_y_xy\n", p_xs_3->pc_y_xy,p_xs_3->pc_y_xy,p_xs_3->pc_y_xy,0);
01589 fprintf(tempcfg,"%lf %lf %lf %d pc_y_x3\n", p_xs_3->pc_y_x3,p_xs_3->pc_y_x3,p_xs_3->pc_y_x3,0);
01590 fprintf(tempcfg,"%lf %lf %lf %d pc_y_x2y\n", p_xs_3->pc_y_x2y,p_xs_3->pc_y_x2y,p_xs_3->pc_y_x2y,0);
01591 fprintf(tempcfg,"%lf %lf %lf %d pc_y_y2x\n", p_xs_3->pc_y_y2x,p_xs_3->pc_y_y2x,p_xs_3->pc_y_y2x,0);
01592 fprintf(tempcfg,"%lf %lf %lf %d pc_y_y3\n", p_xs_3->pc_y_y3,p_xs_3->pc_y_y3,p_xs_3->pc_y_y3,0);
01593 fprintf(tempcfg,"%lf %lf %lf %d pc4_x_xy3\n", p_xs_3->pc4_x_xy3,p_xs_3->pc4_x_xy3,p_xs_3->pc4_x_xy3,0);
01594 fprintf(tempcfg,"%lf %lf %lf %d pc4_x_x3y\n", p_xs_3->pc4_x_x3y,p_xs_3->pc4_x_x3y,p_xs_3->pc4_x_x3y,0);
01595 fprintf(tempcfg,"%lf %lf %lf %d pc4_x_x2y2\n", p_xs_3->pc4_x_x2y2,p_xs_3->pc4_x_x2y2,p_xs_3->pc4_x_x2y2,0);
01596 fprintf(tempcfg,"%lf %lf %lf %d pc4_x_x4\n", p_xs_3->pc4_x_x4,p_xs_3->pc4_x_x4,p_xs_3->pc4_x_x4,0);
01597 fprintf(tempcfg,"%lf %lf %lf %d pc4_x_y4\n", p_xs_3->pc4_x_y4,p_xs_3->pc4_x_y4,p_xs_3->pc4_x_x4,0);
01598 fprintf(tempcfg,"%lf %lf %lf %d pc4_y_xy3\n", p_xs_3->pc4_y_xy3,p_xs_3->pc4_y_xy3,p_xs_3->pc4_y_xy3,0);
01599 fprintf(tempcfg,"%lf %lf %lf %d pc4_y_x3y\n", p_xs_3->pc4_y_x3y,p_xs_3->pc4_y_x3y,p_xs_3->pc4_y_x3y,0);
01600 fprintf(tempcfg,"%lf %lf %lf %d pc4_y_x2y2\n", p_xs_3->pc4_y_x2y2,p_xs_3->pc4_y_x2y2,p_xs_3->pc4_y_x2y2,0);
01601 fprintf(tempcfg,"%lf %lf %lf %d pc4_y_x4\n", p_xs_3->pc4_y_x4,p_xs_3->pc4_y_x4,p_xs_3->pc4_y_x4,0);
01602 fprintf(tempcfg,"%lf %lf %lf %d pc4_y_y4\n", p_xs_3->pc4_y_y4,p_xs_3->pc4_y_y4,p_xs_3->pc4_y_x4,0);
01603 fprintf(tempcfg,"%lf %lf %lf %d ca_x0\n", p_xs_3->ca_x0,p_xs_3->ca_x0,p_xs_3->ca_x0,0);
01604 fprintf(tempcfg,"%lf %lf %lf %d ca_x1\n", p_xs_3->ca_x1,p_xs_3->ca_x1,p_xs_3->ca_x1,0);
01605 fprintf(tempcfg,"%lf %lf %lf %d ca_y0\n", p_xs_3->ca_y0,p_xs_3->ca_y0,p_xs_3->ca_y0,0);
01606 fprintf(tempcfg,"%lf %lf %lf %d ca_y1\n", p_xs_3->ca_y1,p_xs_3->ca_y1,p_xs_3->ca_y1,0);
01607 fprintf(tempcfg,"%lf %lf %lf %d d2_x1\n", p_xs_3->d2_x1,p_xs_3->d2_x1,p_xs_3->d2_x1,0);
01608 fprintf(tempcfg,"%lf %lf %lf %d d2_x2\n", p_xs_3->d2_x2,p_xs_3->d2_x2,p_xs_3->d2_x2,0);
01609 fprintf(tempcfg,"%lf %lf %lf %d d2_x3\n", p_xs_3->d2_x3,p_xs_3->d2_x3,p_xs_3->d2_x3,0);
01610 fprintf(tempcfg,"%lf %lf %lf %d d2_y1x0\n", p_xs_3->d2_y1x0,p_xs_3->d2_y1x0,p_xs_3->d2_y1x0,0);
01611 fprintf(tempcfg,"%lf %lf %lf %d d2_y1x1\n", p_xs_3->d2_y1x1,p_xs_3->d2_y1x1,p_xs_3->d2_y1x1,0);
01612 fprintf(tempcfg,"%lf %lf %lf %d d2_y1x2\n", p_xs_3->d2_y1x2,p_xs_3->d2_y1x2,p_xs_3->d2_y1x2,0);
01613 fprintf(tempcfg,"%lf %lf %lf %d d2_y1x3\n", p_xs_3->d2_y1x3,p_xs_3->d2_y1x3,p_xs_3->d2_y1x3,0);
01614 fprintf(tempcfg,"%lf %lf %lf %d d2_y2x0\n", p_xs_3->d2_y2x0,p_xs_3->d2_y2x0,p_xs_3->d2_y2x0,0);
01615 fprintf(tempcfg,"%lf %lf %lf %d d2_y2x1\n", p_xs_3->d2_y2x1,p_xs_3->d2_y2x1,p_xs_3->d2_y2x1,0);
01616 fprintf(tempcfg,"%lf %lf %lf %d d2_y2x2\n", p_xs_3->d2_y2x2,p_xs_3->d2_y2x2,p_xs_3->d2_y2x2,0);
01617 fprintf(tempcfg,"%lf %lf %lf %d d2_y2x3\n", p_xs_3->d2_y2x3,p_xs_3->d2_y2x3,p_xs_3->d2_y2x3,0);
01618 fprintf(tempcfg,"%lf %lf %lf %d d2_y3x0\n", p_xs_3->d2_y3x0,p_xs_3->d2_y3x0,p_xs_3->d2_y3x0,0);
01619 fprintf(tempcfg,"%lf %lf %lf %d d2_y3x1\n", p_xs_3->d2_y3x1,p_xs_3->d2_y3x1,p_xs_3->d2_y3x1,0);
01620 fprintf(tempcfg,"%lf %lf %lf %d d2_y3x2\n", p_xs_3->d2_y3x2,p_xs_3->d2_y3x2,p_xs_3->d2_y3x2,0);
01621 fprintf(tempcfg,"%lf %lf %lf %d d2_y3x3\n", p_xs_3->d2_y3x3,p_xs_3->d2_y3x3,p_xs_3->d2_y3x3,0);
01622 fprintf(tempcfg,"%lf %lf %lf %d offx\n", p_xs_3->offx,p_xs_3->offx,p_xs_3->offx,0);
01623 fprintf(tempcfg,"%lf %lf %lf %d offy\n", p_xs_3->offy,p_xs_3->offy,p_xs_3->offy,0);
01624 fprintf(tempcfg,"%lf %lf %lf %d flipx\n", p_xs_3->flipx,p_xs_3->flipx,p_xs_3->flipx,0);
01625 fprintf(tempcfg,"%lf %lf %lf %d flipy\n", p_xs_3->flipy,p_xs_3->flipy,p_xs_3->flipy,0);
01626 for (jj=0 ; jj<9 ; jj++) {
01627 sprintf(tempstr, "slit[%d]", jj) ;
01628 fprintf(tempcfg,"%lf %lf %lf %d %s \n",p_xs_3->slit[jj],p_xs_3->slit[jj],p_xs_3->slit[jj],0,tempstr);
01629 }
01630 fclose(tempcfg);
01631 return;
01632 }