175 cpl_frame * config_frame,
178 cpl_table * tab = NULL;
182 const char * config=NULL;
183 const char * tag=NULL;
192 check( config=cpl_frame_get_filename(config_frame));
193 check( tag=cpl_frame_get_tag(config_frame));
198 check( nlines = cpl_table_get_nrow(tab));
276 p_xs_3->
d2_x1=0.00287311525385538;
277 p_xs_3->
d2_x2=1.55125984130817E-05;
278 p_xs_3->
d2_x3=-4.00980399239143E-05;
289 for (i=0 ; i<nlines ; i++) {
293 if (!strcmp(
"temper", name)) p_xs_3->
temper =
295 else if (!strcmp(
"arm", name)) p_xs_3->
arm =
297 else if (!strcmp(
"config_mjd", name)) p_xs_3->
config_mjd =
299 else if (!strcmp(
"t_ir_p2", name)) p_xs_3->
t_ir_p2 =
301 else if (!strcmp(
"t_ir_p3", name)) p_xs_3->
t_ir_p3 =
303 else if (!strcmp(
"es_x", name)) p_xs_3->
es_x =
305 else if (!strcmp(
"es_y", name)) p_xs_3->
es_y =
307 else if (!strcmp(
"mues", name)) p_xs_3->
mues =
309 else if (!strcmp(
"nues", name)) p_xs_3->
nues =
311 else if (!strcmp(
"taues", name)) p_xs_3->
taues =
313 else if (!strcmp(
"slit_scale", name)) p_xs_3->
slit_scale =
315 else if (!strcmp(
"es_s", name)) p_xs_3->
es_s =
317 else if (!strcmp(
"es_w", name)) p_xs_3->
es_w =
319 else if (!strcmp(
"fcol", name)) p_xs_3->
fcol =
321 else if (!strcmp(
"cmup1", name)) p_xs_3->
cmup1 =
323 else if (!strcmp(
"mup1", name)) p_xs_3->
mup1 =
325 else if (!strcmp(
"nup1", name)) p_xs_3->
nup1 =
327 else if (!strcmp(
"taup1", name)) p_xs_3->
taup1 =
329 else if (!strcmp(
"mup2", name)) p_xs_3->
mup2 =
331 else if (!strcmp(
"nup2", name)) p_xs_3->
nup2 =
333 else if (!strcmp(
"taup2", name)) p_xs_3->
taup2 =
335 else if (!strcmp(
"mup3", name)) p_xs_3->
mup3 =
337 else if (!strcmp(
"nup3", name)) p_xs_3->
nup3 =
339 else if (!strcmp(
"taup3", name)) p_xs_3->
taup3 =
341 else if (!strcmp(
"mup4", name)) p_xs_3->
mup4 =
343 else if (!strcmp(
"nup4", name)) p_xs_3->
nup4 =
345 else if (!strcmp(
"taup4", name)) p_xs_3->
taup4 =
347 else if (!strcmp(
"mup5", name)) p_xs_3->
mup5 =
349 else if (!strcmp(
"nup5", name)) p_xs_3->
nup5 =
351 else if (!strcmp(
"taup5", name)) p_xs_3->
taup5 =
353 else if (!strcmp(
"mup6", name)) p_xs_3->
mup6 =
355 else if (!strcmp(
"nup6", name)) p_xs_3->
nup6 =
357 else if (!strcmp(
"taup6", name)) p_xs_3->
taup6 =
359 else if (!strcmp(
"mug", name)) p_xs_3->
mug =
361 else if (!strcmp(
"nug", name)) p_xs_3->
nug =
363 else if (!strcmp(
"taug", name)) p_xs_3->
taug =
365 else if (!strcmp(
"sg", name)) p_xs_3->
sg =
367 else if (!strcmp(
"fdet", name)) p_xs_3->
fdet =
369 else if (!strcmp(
"mud", name)) p_xs_3->
mud =
371 else if (!strcmp(
"nud", name)) p_xs_3->
nud =
373 else if (!strcmp(
"taud", name)) p_xs_3->
taud =
375 else if (!strcmp(
"pix", name)) p_xs_3->
pix =
377 else if (!strcmp(
"chipx", name)) p_xs_3->
chipx=
379 else if (!strcmp(
"chipy", name)) p_xs_3->
chipy=
381 else if (!strcmp(
"chiprot", name)) p_xs_3->
chiprot =
383 else if (!strcmp(
"pc_x_xx", name)) p_xs_3->
pc_x_xx=
385 else if (!strcmp(
"pc_x_x1", name)) p_xs_3->
pc_x_x1=
387 else if (!strcmp(
"pc_x_yy", name)) p_xs_3->
pc_x_yy=
389 else if (!strcmp(
"pc_x_y1", name)) p_xs_3->
pc_x_y1=
391 else if (!strcmp(
"pc_x_xy", name)) p_xs_3->
pc_x_xy=
393 else if (!strcmp(
"pc_x_x3", name)) p_xs_3->
pc_x_x3=
395 else if (!strcmp(
"pc_x_x2y", name)) p_xs_3->
pc_x_x2y=
397 else if (!strcmp(
"pc_x_y2x", name)) p_xs_3->
pc_x_y2x=
399 else if (!strcmp(
"pc_x_y3", name)) p_xs_3->
pc_x_y3=
401 else if (!strcmp(
"pc_y_xx", name)) p_xs_3->
pc_y_xx=
403 else if (!strcmp(
"pc_y_x1", name)) p_xs_3->
pc_y_x1=
405 else if (!strcmp(
"pc_y_yy", name)) p_xs_3->
pc_y_yy=
407 else if (!strcmp(
"pc_y_y1", name)) p_xs_3->
pc_y_y1=
409 else if (!strcmp(
"pc_y_xy", name)) p_xs_3->
pc_y_xy=
411 else if (!strcmp(
"pc_y_x3", name)) p_xs_3->
pc_y_x3=
413 else if (!strcmp(
"pc_y_x2y", name)) p_xs_3->
pc_y_x2y=
415 else if (!strcmp(
"pc_y_y2x", name)) p_xs_3->
pc_y_y2x=
417 else if (!strcmp(
"pc_y_y3", name)) p_xs_3->
pc_y_y3=
419 else if (!strcmp(
"pc4_x_xy3", name)) p_xs_3->
pc4_x_xy3=
421 else if (!strcmp(
"pc4_x_x3y", name)) p_xs_3->
pc4_x_x3y=
423 else if (!strcmp(
"pc4_x_x2y2", name)) p_xs_3->
pc4_x_x2y2=
425 else if (!strcmp(
"pc4_x_x4", name)) p_xs_3->
pc4_x_x4=
427 else if (!strcmp(
"pc4_x_y4", name)) p_xs_3->
pc4_x_y4=
429 else if (!strcmp(
"pc4_y_xy3", name)) p_xs_3->
pc4_y_xy3=
431 else if (!strcmp(
"pc4_y_x3y", name)) p_xs_3->
pc4_y_x3y=
433 else if (!strcmp(
"pc4_y_x2y2", name)) p_xs_3->
pc4_y_x2y2=
435 else if (!strcmp(
"pc4_y_x4", name)) p_xs_3->
pc4_y_x4=
437 else if (!strcmp(
"pc4_y_y4", name)) p_xs_3->
pc4_y_y4=
439 else if (!strcmp(
"ca_x0", name)) p_xs_3->
ca_x0=
441 else if (!strcmp(
"ca_x1", name)) p_xs_3->
ca_x1=
443 else if (!strcmp(
"ca_y0", name)) p_xs_3->
ca_y0=
445 else if (!strcmp(
"ca_y1", name)) p_xs_3->
ca_y1=
447 else if (!strcmp(
"d2_x1", name)) p_xs_3->
d2_x1=
449 else if (!strcmp(
"d2_x2", name)) p_xs_3->
d2_x2=
451 else if (!strcmp(
"d2_x3", name)) p_xs_3->
d2_x3=
453 else if (!strcmp(
"d2_y1x0", name)) p_xs_3->
d2_y1x0=
455 else if (!strcmp(
"d2_y1x1", name)) p_xs_3->
d2_y1x1=
457 else if (!strcmp(
"d2_y1x2", name)) p_xs_3->
d2_y1x2=
459 else if (!strcmp(
"d2_y1x3", name)) p_xs_3->
d2_y1x3=
461 else if (!strcmp(
"d2_y2x0", name)) p_xs_3->
d2_y2x0=
463 else if (!strcmp(
"d2_y2x1", name)) p_xs_3->
d2_y2x1=
465 else if (!strcmp(
"d2_y2x2", name)) p_xs_3->
d2_y2x2=
467 else if (!strcmp(
"d2_y2x3", name)) p_xs_3->
d2_y2x3=
469 else if (!strcmp(
"d2_y3x0", name)) p_xs_3->
d2_y3x0=
471 else if (!strcmp(
"d2_y3x1", name)) p_xs_3->
d2_y3x1=
473 else if (!strcmp(
"d2_y3x2", name)) p_xs_3->
d2_y3x2=
475 else if (!strcmp(
"d2_y3x3", name)) p_xs_3->
d2_y3x3=
477 else if (!strcmp(
"offx", name)) p_xs_3->
offx =
479 else if (!strcmp(
"offy", name)) p_xs_3->
offy =
481 else if (!strcmp(
"flipx", name)) p_xs_3->
flipx =
483 else if (!strcmp(
"flipy", name)) p_xs_3->
flipy =
485 else if (!strncmp(
"slit", name,4)){
487 for(islit=0; islit <9; islit++){
490 sprintf(temp,
"slit[%d]",islit);
491 if (!strcmp(name, temp)){
499 if (p_xs_3->
arm==0) {
506 else if (p_xs_3->
arm==1) {
513 else if (p_xs_3->
arm==2) {
521 return CPL_ERROR_UNSUPPORTED_MODE;
524 p_xs_3->
BSIZE=instr_config->
ny;
525 p_xs_3->
ASIZE=instr_config->
nx;
566 return cpl_error_get_code();
571 double * amax,
int * aname,
572 const char * xs_config_file,
573 const char* xs_config_tag,
577 int ii,jj,kk,compa, par_found, indlen;
660 p_xs_3->
d2_x1=0.00287311525385538;
661 p_xs_3->
d2_x2=1.55125984130817E-05;
662 p_xs_3->
d2_x3=-4.00980399239143E-05;
673 xsh_msg(
"tag=%s",xs_config_tag);
677 cpl_msg_error(__func__,
"Cannot load the config table") ;
680 nlines = cpl_table_get_nrow(tab) ;
682 for (ii=0 ; ii<nlines ; ii++) {
691 sprintf((p_all_par+ii)->name, (
char*)cpl_table_get_string(tab,
693 if ((p_all_par+ii)->flag==1) {
694 if ((p_all_par+ii)->best<(p_all_par+ii)->min ||
695 (p_all_par+ii)->best>(p_all_par+ii)->
max) {
696 printf(
"limits wrong in config file for parameter: %s \n",
697 (p_all_par+ii)->name);
704 for (ii=0 ; ii<nlines ; ii++) {
708 compa=strncmp((p_all_par+ii)->name,
"arm",3);
710 p_xs_3->
arm=(p_all_par+ii)->best;
713 compa=strncmp((p_all_par+ii)->name,
"temper",6);
715 p_xs_3->
temper=(p_all_par+ii)->best;
718 compa=strncmp((p_all_par+ii)->name,
"arm",3);
720 p_xs_3->
arm=(p_all_par+ii)->best;
723 compa=strncmp((p_all_par+ii)->name,
"config_mjd",10);
728 compa=strncmp((p_all_par+ii)->name,
"t_ir_p2",7);
730 p_xs_3->
t_ir_p2=(p_all_par+ii)->best;
733 compa=strncmp((p_all_par+ii)->name,
"t_ir_p3",7);
735 p_xs_3->
t_ir_p3=(p_all_par+ii)->best;
738 compa=strncmp((p_all_par+ii)->name,
"es_x",4);
740 p_xs_3->
es_x=(p_all_par+ii)->best;
743 compa=strncmp((p_all_par+ii)->name,
"es_y",4);
745 p_xs_3->
es_y=(p_all_par+ii)->best;
748 compa=strncmp((p_all_par+ii)->name,
"mues",4);
751 p_xs_3->
mues=(p_all_par+ii)->best*d2r;
754 compa=strncmp((p_all_par+ii)->name,
"nues",4);
757 p_xs_3->
nues=(p_all_par+ii)->best*d2r;
760 compa=strncmp((p_all_par+ii)->name,
"taues",5);
763 p_xs_3->
taues=(p_all_par+ii)->best*d2r;
766 compa=strncmp((p_all_par+ii)->name,
"slit_scale",10);
772 compa=strncmp((p_all_par+ii)->name,
"es_s",4);
774 p_xs_3->
es_s=(p_all_par+ii)->best;
777 compa=strncmp((p_all_par+ii)->name,
"es_w",4);
779 p_xs_3->
es_w=(p_all_par+ii)->best;
782 compa=strncmp((p_all_par+ii)->name,
"fcol",4);
784 p_xs_3->
fcol=(p_all_par+ii)->best;
787 compa=strncmp((p_all_par+ii)->name,
"cmup1",5);
790 p_xs_3->
cmup1=(p_all_par+ii)->best*d2r;
793 compa=strncmp((p_all_par+ii)->name,
"mup1",4);
796 p_xs_3->
mup1=(p_all_par+ii)->best*d2r;
799 compa=strncmp((p_all_par+ii)->name,
"nup1",4);
802 p_xs_3->
nup1=(p_all_par+ii)->best*d2r;
805 compa=strncmp((p_all_par+ii)->name,
"taup1",5);
808 p_xs_3->
taup1=(p_all_par+ii)->best*d2r;
811 compa=strncmp((p_all_par+ii)->name,
"mup2",4);
814 p_xs_3->
mup2=(p_all_par+ii)->best*d2r;
817 compa=strncmp((p_all_par+ii)->name,
"nup2",4);
820 p_xs_3->
nup2=(p_all_par+ii)->best*d2r;
823 compa=strncmp((p_all_par+ii)->name,
"taup2",5);
826 p_xs_3->
taup2=(p_all_par+ii)->best*d2r;
829 compa=strncmp((p_all_par+ii)->name,
"mup3",4);
832 p_xs_3->
mup3=(p_all_par+ii)->best*d2r;
835 compa=strncmp((p_all_par+ii)->name,
"nup3",4);
838 p_xs_3->
nup3=(p_all_par+ii)->best*d2r;
841 compa=strncmp((p_all_par+ii)->name,
"taup3",5);
844 p_xs_3->
taup3=(p_all_par+ii)->best*d2r;
847 compa=strncmp((p_all_par+ii)->name,
"mup4",4);
850 p_xs_3->
mup4=(p_all_par+ii)->best*d2r;
853 compa=strncmp((p_all_par+ii)->name,
"nup4",4);
856 p_xs_3->
nup4=(p_all_par+ii)->best*d2r;
859 compa=strncmp((p_all_par+ii)->name,
"taup4",5);
862 p_xs_3->
taup4=(p_all_par+ii)->best*d2r;
865 compa=strncmp((p_all_par+ii)->name,
"mup5",4);
868 p_xs_3->
mup5=(p_all_par+ii)->best*d2r;
871 compa=strncmp((p_all_par+ii)->name,
"nup5",4);
874 p_xs_3->
nup5=(p_all_par+ii)->best*d2r;
877 compa=strncmp((p_all_par+ii)->name,
"taup5",5);
880 p_xs_3->
taup5=(p_all_par+ii)->best*d2r;
883 compa=strncmp((p_all_par+ii)->name,
"mup6",4);
886 p_xs_3->
mup6=(p_all_par+ii)->best*d2r;
889 compa=strncmp((p_all_par+ii)->name,
"nup6",4);
892 p_xs_3->
nup6=(p_all_par+ii)->best*d2r;
895 compa=strncmp((p_all_par+ii)->name,
"taup6",5);
898 p_xs_3->
taup6=(p_all_par+ii)->best*d2r;
901 compa=strncmp((p_all_par+ii)->name,
"mug",3);
904 p_xs_3->
mug=(p_all_par+ii)->best*d2r;
907 compa=strncmp((p_all_par+ii)->name,
"nug",3);
910 p_xs_3->
nug=(p_all_par+ii)->best*d2r;
913 compa=strncmp((p_all_par+ii)->name,
"taug",4);
916 p_xs_3->
taug=(p_all_par+ii)->best*d2r;
919 compa=strncmp((p_all_par+ii)->name,
"sg",2);
921 p_xs_3->
sg=(p_all_par+ii)->best;
924 compa=strncmp((p_all_par+ii)->name,
"fdet",4);
926 p_xs_3->
fdet=(p_all_par+ii)->best;
929 compa=strncmp((p_all_par+ii)->name,
"mud",3);
932 p_xs_3->
mud=(p_all_par+ii)->best*d2r;
935 compa=strncmp((p_all_par+ii)->name,
"nud",3);
938 p_xs_3->
nud=(p_all_par+ii)->best*d2r;
941 compa=strncmp((p_all_par+ii)->name,
"taud",4);
944 p_xs_3->
taud=(p_all_par+ii)->best*d2r;
947 compa=strncmp((p_all_par+ii)->name,
"pix",3);
949 p_xs_3->
pix=(p_all_par+ii)->best;
952 compa=strncmp((p_all_par+ii)->name,
"chipx",5);
954 p_xs_3->
chipx=(p_all_par+ii)->best;
957 compa=strncmp((p_all_par+ii)->name,
"chipy",5);
959 p_xs_3->
chipy=(p_all_par+ii)->best;
962 compa=strncmp((p_all_par+ii)->name,
"chiprot",7);
965 p_xs_3->
chiprot=(p_all_par+ii)->best*d2r;
968 compa=strncmp((p_all_par+ii)->name,
"pc_x_xx",7);
970 p_xs_3->
pc_x_xx=(p_all_par+ii)->best;
973 compa=strncmp((p_all_par+ii)->name,
"pc_x_x1",7);
975 p_xs_3->
pc_x_x1=(p_all_par+ii)->best;
978 compa=strncmp((p_all_par+ii)->name,
"pc_x_yy",7);
980 p_xs_3->
pc_x_yy=(p_all_par+ii)->best;
983 compa=strncmp((p_all_par+ii)->name,
"pc_x_y1",7);
985 p_xs_3->
pc_x_y1=(p_all_par+ii)->best;
988 compa=strncmp((p_all_par+ii)->name,
"pc_x_xy",7);
990 p_xs_3->
pc_x_xy=(p_all_par+ii)->best;
993 compa=strncmp((p_all_par+ii)->name,
"pc_x_x3",7);
995 p_xs_3->
pc_x_x3=(p_all_par+ii)->best;
998 compa=strncmp((p_all_par+ii)->name,
"pc_x_x2y",8);
1000 p_xs_3->
pc_x_x2y=(p_all_par+ii)->best;
1003 compa=strncmp((p_all_par+ii)->name,
"pc_x_y2x",8);
1005 p_xs_3->
pc_x_y2x=(p_all_par+ii)->best;
1008 compa=strncmp((p_all_par+ii)->name,
"pc_x_y3",7);
1010 p_xs_3->
pc_x_y3=(p_all_par+ii)->best;
1013 compa=strncmp((p_all_par+ii)->name,
"pc_y_xx",7);
1015 p_xs_3->
pc_y_xx=(p_all_par+ii)->best;
1018 compa=strncmp((p_all_par+ii)->name,
"pc_y_x1",7);
1020 p_xs_3->
pc_y_x1=(p_all_par+ii)->best;
1023 compa=strncmp((p_all_par+ii)->name,
"pc_y_yy",7);
1025 p_xs_3->
pc_y_yy=(p_all_par+ii)->best;
1028 compa=strncmp((p_all_par+ii)->name,
"pc_y_y1",7);
1030 p_xs_3->
pc_y_y1=(p_all_par+ii)->best;
1033 compa=strncmp((p_all_par+ii)->name,
"pc_y_xy",7);
1035 p_xs_3->
pc_y_xy=(p_all_par+ii)->best;
1038 compa=strncmp((p_all_par+ii)->name,
"pc_y_x3",7);
1040 p_xs_3->
pc_y_x3=(p_all_par+ii)->best;
1043 compa=strncmp((p_all_par+ii)->name,
"pc_y_x2y",8);
1045 p_xs_3->
pc_y_x2y=(p_all_par+ii)->best;
1048 compa=strncmp((p_all_par+ii)->name,
"pc_y_y2x",8);
1050 p_xs_3->
pc_y_y2x=(p_all_par+ii)->best;
1053 compa=strncmp((p_all_par+ii)->name,
"pc_y_y3",7);
1055 p_xs_3->
pc_y_y3=(p_all_par+ii)->best;
1058 compa=strncmp((p_all_par+ii)->name,
"pc4_x_xy3",9);
1063 compa=strncmp((p_all_par+ii)->name,
"pc4_x_x3y",9);
1068 compa=strncmp((p_all_par+ii)->name,
"pc4_x_x2y2",10);
1073 compa=strncmp((p_all_par+ii)->name,
"pc4_x_x4",8);
1075 p_xs_3->
pc4_x_x4=(p_all_par+ii)->best;
1078 compa=strncmp((p_all_par+ii)->name,
"pc4_x_y4",8);
1080 p_xs_3->
pc4_x_y4=(p_all_par+ii)->best;
1083 compa=strncmp((p_all_par+ii)->name,
"pc4_y_xy3",9);
1088 compa=strncmp((p_all_par+ii)->name,
"pc4_y_x3y",9);
1093 compa=strncmp((p_all_par+ii)->name,
"pc4_y_x2y2",10);
1098 compa=strncmp((p_all_par+ii)->name,
"pc4_y_x4",8);
1100 p_xs_3->
pc4_y_x4=(p_all_par+ii)->best;
1103 compa=strncmp((p_all_par+ii)->name,
"pc4_y_y4",8);
1105 p_xs_3->
pc4_y_y4=(p_all_par+ii)->best;
1108 compa=strncmp((p_all_par+ii)->name,
"ca_x0",5);
1110 p_xs_3->
ca_x0=(p_all_par+ii)->best;
1113 compa=strncmp((p_all_par+ii)->name,
"ca_x1",5);
1115 p_xs_3->
ca_x1=(p_all_par+ii)->best;
1118 compa=strncmp((p_all_par+ii)->name,
"ca_y0",5);
1120 p_xs_3->
ca_y0=(p_all_par+ii)->best;
1123 compa=strncmp((p_all_par+ii)->name,
"ca_y1",5);
1125 p_xs_3->
ca_y1=(p_all_par+ii)->best;
1128 compa=strncmp((p_all_par+ii)->name,
"d2_x1",5);
1130 p_xs_3->
d2_x1=(p_all_par+ii)->best;
1133 compa=strncmp((p_all_par+ii)->name,
"d2_x2",5);
1135 p_xs_3->
d2_x2=(p_all_par+ii)->best;
1138 compa=strncmp((p_all_par+ii)->name,
"d2_x3",5);
1140 p_xs_3->
d2_x3=(p_all_par+ii)->best;
1143 compa=strncmp((p_all_par+ii)->name,
"d2_y1x0",7);
1145 p_xs_3->
d2_y1x0=(p_all_par+ii)->best;
1148 compa=strncmp((p_all_par+ii)->name,
"d2_y1x1",7);
1150 p_xs_3->
d2_y1x1=(p_all_par+ii)->best;
1153 compa=strncmp((p_all_par+ii)->name,
"d2_y1x2",7);
1155 p_xs_3->
d2_y1x2=(p_all_par+ii)->best;
1158 compa=strncmp((p_all_par+ii)->name,
"d2_y1x3",7);
1160 p_xs_3->
d2_y1x3=(p_all_par+ii)->best;
1163 compa=strncmp((p_all_par+ii)->name,
"d2_y2x0",7);
1165 p_xs_3->
d2_y2x0=(p_all_par+ii)->best;
1168 compa=strncmp((p_all_par+ii)->name,
"d2_y2x1",7);
1170 p_xs_3->
d2_y2x1=(p_all_par+ii)->best;
1173 compa=strncmp((p_all_par+ii)->name,
"d2_y2x2",7);
1175 p_xs_3->
d2_y2x2=(p_all_par+ii)->best;
1178 compa=strncmp((p_all_par+ii)->name,
"d2_y2x3",7);
1180 p_xs_3->
d2_y2x3=(p_all_par+ii)->best;
1183 compa=strncmp((p_all_par+ii)->name,
"d2_y3x0",7);
1185 p_xs_3->
d2_y3x0=(p_all_par+ii)->best;
1188 compa=strncmp((p_all_par+ii)->name,
"d2_y3x1",7);
1190 p_xs_3->
d2_y3x1=(p_all_par+ii)->best;
1193 compa=strncmp((p_all_par+ii)->name,
"d2_y3x2",7);
1195 p_xs_3->
d2_y3x2=(p_all_par+ii)->best;
1198 compa=strncmp((p_all_par+ii)->name,
"d2_y3x3",7);
1200 p_xs_3->
d2_y3x3=(p_all_par+ii)->best;
1203 compa=strncmp((p_all_par+ii)->name,
"offx",4);
1205 p_xs_3->
offx=(p_all_par+ii)->best;
1208 compa=strncmp((p_all_par+ii)->name,
"offy",4);
1210 p_xs_3->
offy=(p_all_par+ii)->best;
1213 compa=strncmp((p_all_par+ii)->name,
"flipx",5);
1215 p_xs_3->
flipx=(p_all_par+ii)->best;
1218 compa=strncmp((p_all_par+ii)->name,
"flipy",5);
1220 p_xs_3->
flipy=(p_all_par+ii)->best;
1223 for (kk=0;kk<9;kk++) {
1224 sprintf(tempstr,
"slit[%d]",kk);
1225 indlen=strlen(tempstr);
1226 compa=strncmp((p_all_par+ii)->name,tempstr,indlen);
1228 p_xs_3->
slit[kk]=(p_all_par+ii)->best;
1233 if ((p_all_par+ii)->flag!=0) {
1234 abest[jj]=(p_all_par+ii)->best;
1235 amin[jj]=(p_all_par+ii)->min;
1236 amax[jj]=(p_all_par+ii)->
max;
1238 printf(
"%d %s %d \n", ii, (p_all_par+ii)->name, jj);
1243 if (p_xs_3->
arm==0) {
1250 else if (p_xs_3->
arm==1) {
1257 else if (p_xs_3->
arm==2) {
1268 p_xs_3->
BSIZE=instr_config->
ny;
1269 p_xs_3->
ASIZE=instr_config->
nx;
1283#define xsh_model_config_enter(name, val, index, units) \
1284 cpl_table_set_string(tab, XSH_COL_MODEL_CONF_NAME, index, name) ; \
1285 cpl_table_set_double(tab, XSH_COL_MODEL_CONF_BEST, index, val) ; \
1286 cpl_table_set_double(tab, XSH_COL_MODEL_CONF_LOW, index, val) ; \
1287 cpl_table_set_double(tab, XSH_COL_MODEL_CONF_HIGH, index, val) ; \
1288 cpl_table_set_int(tab, XSH_COL_MODEL_CONF_FLAG, index, 0) ; \
1289 cpl_table_set_string(tab, XSH_COL_MODEL_CONF_UNITS, index, units) ;
1299 nb_parameters = 91 ;
1302 tab = cpl_table_new(nb_parameters) ;
1373 if (p_xs_3->
arm==2 && p_xs_3->
d2_y1x0==0.0) {
1411 for (j=0 ; j<9 ; j++) {
1412 sprintf(tempstr,
"slit[%d]", j) ;
1427 const char * procatg)
1433 if (in == NULL)
return NULL ;
1434 if (procatg == NULL)
return NULL ;
1438 if ((out = cpl_table_load(in, 1, 0)) == NULL) {
1439 cpl_msg_error(__func__,
"Cannot load %s as a table", in) ;
1494 cpl_msg_error(__func__,
"Unsupported PRO.CATG: %s", procatg) ;
1495 cpl_table_delete(out) ;
1503 cpl_table_delete(out) ;
1512 const cpl_table * tab,
1516 if (!cpl_table_has_column(tab, col)) {
1517 cpl_msg_error(__func__,
"Column %s is missing", col) ;
1530 tempcfg=fopen(
"xsh_temp.cfg",
"w");
1532 fprintf(tempcfg,
"%lf %lf %lf %d temper\n", p_xs_3->
temper,p_xs_3->
temper,p_xs_3->
temper,0);
1535 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);
1536 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);
1537 fprintf(tempcfg,
"%lf es_y_tot\n", p_xs_3->
es_y_tot);
1542 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);
1543 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);
1544 fprintf(tempcfg,
"%lf %lf %lf %d fcol\n", p_xs_3->
fcol,p_xs_3->
fcol,p_xs_3->
fcol,0);
1567 fprintf(tempcfg,
"%lf %lf %lf %d sg\n", p_xs_3->
sg,p_xs_3->
sg,p_xs_3->
sg,0);
1568 fprintf(tempcfg,
"%lf %lf %lf %d fdet\n", p_xs_3->
fdet,p_xs_3->
fdet,p_xs_3->
fdet,0);
1572 fprintf(tempcfg,
"%lf %lf %lf %d pix\n", p_xs_3->
pix,p_xs_3->
pix,p_xs_3->
pix,0);
1573 fprintf(tempcfg,
"%lf %lf %lf %d chipx\n", p_xs_3->
chipx,p_xs_3->
chipx,p_xs_3->
chipx,0);
1574 fprintf(tempcfg,
"%lf %lf %lf %d chipy\n", p_xs_3->
chipy,p_xs_3->
chipy,p_xs_3->
chipy,0);
1604 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);
1605 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);
1606 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);
1607 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);
1608 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);
1609 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);
1610 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);
1623 fprintf(tempcfg,
"%lf %lf %lf %d offx\n", p_xs_3->
offx,p_xs_3->
offx,p_xs_3->
offx,0);
1624 fprintf(tempcfg,
"%lf %lf %lf %d offy\n", p_xs_3->
offy,p_xs_3->
offy,p_xs_3->
offy,0);
1625 fprintf(tempcfg,
"%lf %lf %lf %d flipx\n", p_xs_3->
flipx,p_xs_3->
flipx,p_xs_3->
flipx,0);
1626 fprintf(tempcfg,
"%lf %lf %lf %d flipy\n", p_xs_3->
flipy,p_xs_3->
flipy,p_xs_3->
flipy,0);
1627 for (jj=0 ; jj<9 ; jj++) {
1628 sprintf(tempstr,
"slit[%d]", jj) ;
1629 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);
#define XSH_ASSURE_NOT_NULL(pointer)
void xsh_instrument_set_arm(xsh_instrument *i, XSH_ARM arm)
Set an arm on instrument structure.
XSH_INSTRCONFIG * xsh_instrument_get_config(xsh_instrument *i)
Get the instrument default set of keywords.
void xsh_instrument_free(xsh_instrument **instrument)
free an instrument structure
xsh_instrument * xsh_instrument_new(void)
create new instrument structure
int xsh_model_readfits(double *abest, double *amin, double *amax, int *aname, const char *xs_config_file, const char *xs_config_tag, struct xs_3 *p_xs_3, ann_all_par *p_all_par)
cpl_error_code xsh_model_config_load_best(cpl_frame *config_frame, xsh_xs_3 *p_xs_3)
Load the config model table and fill the struct.
void xsh_model_io_dump(xsh_xs_3 *p_xs_3)
#define xsh_model_config_enter(name, val, index, units)
cpl_table * xsh_model_io_output_cfg(struct xs_3 *p_xs_3)
#define xsh_msg_error(...)
Print an error message.
#define xsh_msg(...)
Print a message on info level.
#define xsh_msg_dbg_high(...)
void xsh_free_table(cpl_table **t)
Deallocate a table and set the pointer to NULL.
#define XSH_MOD_CFG_OPT_REC_VIS
#define XSH_MOD_CFG_OPT_AFC_NIR
#define XSH_MOD_CFG_FAN_UVB
#define XSH_MOD_CFG_OPT_REC_UVB
#define XSH_COL_MODEL_CONF_HIGH
#define XSH_MOD_CFG_OPT_WAV_SLIT_VIS
#define XSH_MOD_CFG_OPT_FMT_NIR
#define XSH_MOD_CFG_OPT_2D_VIS
#define XSH_MOD_CFG_TAB_NIR
#define XSH_COL_MODEL_CONF_BEST
#define XSH_MOD_CFG_OPEN_NIR
#define XSH_MOD_CFG_OPT_WAV_IFU_VIS
#define XSH_MOD_CFG_TAB_UVB
#define XSH_COL_MODEL_CONF_LOW
#define XSH_MOD_CFG_OPEN_UVB
#define XSH_MOD_CFG_OPT_FMT_UVB
#define XSH_MOD_CFG_FAN_VIS
#define XSH_COL_MODEL_CONF_NAME
#define XSH_MOD_CFG_OPT_2D_UVB
#define XSH_MOD_CFG_OPT_WAV_IFU_UVB
#define XSH_MOD_CFG_OPT_WAV_IFU_NIR
#define XSH_MOD_CFG_OPT_FMT_VIS
#define XSH_MOD_CFG_TAB_VIS
#define XSH_MOD_CFG_OPT_WAV_SLIT_UVB
#define XSH_COL_MODEL_CONF_FLAG
#define XSH_MOD_CFG_OPT_WAV_SLIT_NIR
#define XSH_MOD_CFG_OPEN_VIS
#define XSH_MOD_CFG_FAN_NIR
#define XSH_MOD_CFG_OPT_AFC_UVB
#define XSH_COL_MODEL_CONF_UNITS
#define XSH_MOD_CFG_OPT_2D_NIR
#define XSH_MOD_CFG_OPT_AFC_VIS
#define XSH_MOD_CFG_OPT_REC_NIR
void xsh_model_io_output_cfg_txt(struct xs_3 *p_xs_3)
static int xsh_table_check_column(const cpl_table *, const char *)
cpl_table * xsh_load_table_check(const char *in, const char *procatg)
#define XSH_TABLE_FREE(TABLE)