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