340 #include <uves_physmod_body.h>
343 #include <uves_physmod_plotmod.h>
344 #include <uves_physmod_create_table.h>
346 #include <uves_physmod_qc1pmtbl.h>
347 #include <uves_physmod_calmap.h>
348 #include <uves_physmod_msrawxy.h>
349 #include <uves_physmod_chop_otab.h>
350 #include <uves_physmod_stability_check.h>
353 #include <uves_utils.h>
354 #include <uves_utils_polynomial.h>
355 #include <uves_utils_wrappers.h>
356 #include <uves_pfits.h>
357 #include <uves_dfs.h>
358 #include <uves_parameters.h>
359 #include <uves_qclog.h>
360 #include <uves_recipe.h>
361 #include <uves_error.h>
362 #include <uves_msg.h>
372 #define UVES_PHYSMOD_ITER_MAX 5
378 uves_physmod_qclog(cpl_table* line_table,
379 cpl_table* order_table,
388 uves_physmod_qclog_sc(
const double med_dx,
402 flames_get_physmod_shift(
const int plate_no,
405 double* physmod_shift_x,
406 double* physmod_shift_y,
416 const char *
const uves_physmod_desc_short =
"Implements the UVES physical model";
417 const char *
const uves_physmod_desc =
418 "This recipe implements the UVES physical model\n"
419 "Input files are BLUE or RED arm formatcheck frames identified by the tag\n"
420 "ARC_LAMP_FORM_xxxx, xxxx=BLUE or RED and a ThAr line reference table\n"
421 "identified by the tag LINE_REFER_TABLE\n"
422 "The recipe extracts from the input files FITS header data indicating the\n"
423 "instrument setting and ambiental atmospheric conditions, then using the\n"
424 "model predicts X,Y position of the lines listed in the LINE_REFER_TABLE\n"
425 "table which are imaging on the detector and stores this information in an\n"
426 "guess order and a guess line table.\n"
427 "Output are a guess order table and a guess line table per chip.\n"
428 "If the user provides in input also master format checks having tag\n"
429 "MASTER_FORM_xxxx, xxxx=BLUE or REDL and REDU the recipe performs also a\n"
445 uves_physmod_define_parameters_body(cpl_parameterlist *parameters,
446 const char *recipe_id)
448 const char *subcontext = NULL;
454 if (uves_define_global_parameters(parameters) != CPL_ERROR_NONE)
459 uves_par_new_range(
"mbox_x",
464 uves_par_new_range(
"mbox_y",
469 uves_par_new_value(
"trans_x",
471 "Detector translation along X",
474 uves_par_new_value(
"trans_y",
476 "Detector translation along Y",
479 uves_par_new_value(
"ech_angle_off",
481 "Offset on echelle angle",
484 uves_par_new_value(
"cd_angle_off",
486 "Offset on cross disperser angle",
489 uves_par_new_value(
"ccd_rot_angle_off",
491 "Offset on CCD rotation angle",
494 uves_par_new_value(
"compute_regression_sw",
496 "Compute regression?",
510 uves_par_new_value(
"def_pol1",
515 uves_par_new_value(
"def_pol2",
520 uves_par_new_value(
"kappa",
522 "Kappa value in kappa sigma clipping "
523 "on RESIDUAL between YFIT and Y columns",
526 uves_par_new_value(
"tol",
528 "Tolerance in kappa sigma clipping "
529 "on RESIDUAL between YFIT and Y columns",
532 return (
int) cpl_error_get_code();
565 uves_physmod_process_chip(
const cpl_image *raw_image,
567 const char *raw_filename,
570 const char *recipe_id,
571 const int debug_mode,
572 const cpl_parameterlist* parameters,
573 cpl_table* line_refer,
574 const double physmod_shift_x,
575 const double physmod_shift_y,
576 cpl_table** tmp_mod_tbl,
579 cpl_table** mline_tbl,
583 const int stability_cnt)
586 cpl_table *tmp_fsr_tbl = NULL;
587 cpl_table *tmp_m_tbl = NULL;
588 cpl_table *tmp_p_tbl = NULL;
589 cpl_table *tmp_w_tbl = NULL;
590 cpl_table *tmp_s_tbl = NULL;
591 cpl_table *tmp_rline_tbl = NULL;
592 cpl_table *tmp_npline_tbl = NULL;
595 cpl_table * result=NULL;
596 const char *product_filename = NULL;
599 uves_msg(
"stability counter=%d",stability_cnt);
600 if(stability_cnt == 0) {
601 uves_msg(
"offsetx=%f offsety=%f",physmod_shift_x,physmod_shift_y);
612 "Could not run UVES physical model on the raw image %s",
617 const char *product_filename = NULL;
618 product_filename =
"model_prediction";
619 check( uves_save_table_local(
"Physical model table",
620 product_filename, *tmp_mod_tbl, chip, -1, -1, raw_header, NULL),
621 "Error saving physical model table");
630 uves_free_table(&tmp_rline_tbl);
642 "Could not run uves_msrawxy to measure arc line position on raw image %s",
654 "Could not run uves_physmod_plotmod");
656 if(stability_cnt == 0) {
657 uves_free_table(&tmp_w_tbl);
658 uves_free_table(&tmp_s_tbl);
670 absolute_order_poly2d),
671 "Could not run uves_calmap on raw image %s", raw_filename);
677 abs_ord_min,abs_ord_max),
678 "Could not run uves_physmod_chop_otab on raw image %s",
683 "Could not run uves_qc1pmtbl on raw image %s", raw_filename);
687 abs_ord_min,abs_ord_max),
688 "Could not run uves_physmod_chop_otab on raw image %s",
696 if(stability_cnt==0) {
697 product_filename =
"arclampform";
699 product_filename =
"ref_arclampform";
701 check( uves_save_image_local(
"Physical model table",
702 product_filename, raw_image, chip, -1, -1, raw_header,
true),
703 "Error saving arc lamp form image");
705 product_filename =
"pline";
706 check( uves_save_table_local(
"Physical model table",
707 product_filename, *tmp_mod_tbl, chip, -1, -1, raw_header, NULL),
708 "Error saving physical model table");
711 if(stability_cnt == 0) {
712 product_filename =
"free_spectral_range";
713 check( uves_save_table_local(
"FSR table",
714 product_filename, tmp_fsr_tbl,
715 chip, -1, -1, raw_header, NULL),
716 "Error saving free spectral range table");
720 product_filename =
"midduml";
721 check( uves_save_table_local(
"midduml table",
722 product_filename, *lin_tbl, chip, -1, -1, raw_header, NULL),
723 "Error saving midduml table");
727 product_filename =
"middumm";
728 check( uves_save_table_local(
"middumm table",
729 product_filename, tmp_m_tbl, chip, -1, -1, raw_header, NULL),
730 "Error saving middumm table");
734 product_filename =
"middumrline";
735 check( uves_save_table_local(
"middumrline table",
736 product_filename, tmp_rline_tbl, chip, -1, -1, raw_header, NULL),
737 "Error saving middumrline table");
740 product_filename =
"middummline";
741 check( uves_save_table_local(
"middummline table",
742 product_filename, *mline_tbl, chip, -1, -1, raw_header, NULL),
743 "Error saving middummline table");
746 product_filename =
"middump";
747 check( uves_save_table_local(
"middump table",
748 product_filename, tmp_p_tbl, chip, -1, -1, raw_header, NULL),
749 "Error saving middump table");
752 product_filename =
"middumnpline";
753 check( uves_save_table_local(
"middumnpline table",
754 product_filename, tmp_npline_tbl, chip, -1, -1, raw_header, NULL),
755 "Error saving middumnpline table");
759 if(stability_cnt== 0) {
760 product_filename =
"middumw";
761 check( uves_save_table_local(
"middumw table",
762 product_filename, tmp_w_tbl,
763 chip, -1, -1, raw_header, NULL),
764 "Error saving middumw table");
766 product_filename =
"middums";
767 check( uves_save_table_local(
"middums table",
768 product_filename, tmp_s_tbl,
769 chip, -1, -1, raw_header, NULL),
770 "Error saving middums table");
773 product_filename =
"order";
774 check( uves_save_table_local(
"order table",
775 product_filename, *ord_tbl,
776 chip, -1, -1, raw_header, NULL),
777 "Error saving order table");
778 uves_msg(
"Order table saved to file %s",
782 product_filename =
"line";
783 check( uves_save_table_local(
"line table",
784 product_filename, *lin_tbl, chip, -1, -1, raw_header, NULL),
785 "Error saving uves_line table");
786 uves_msg(
"Line table saved to file %s",
794 uves_free_table(&tmp_fsr_tbl);
795 uves_free_table(&tmp_m_tbl);
796 uves_free_table(&tmp_p_tbl);
797 uves_free_table(&tmp_w_tbl);
798 uves_free_table(&tmp_s_tbl);
799 uves_free_table(&tmp_rline_tbl);
800 uves_free_table(&tmp_npline_tbl);
819 uves_physmod_exe_body(cpl_frameset *frames,
821 const char *recipe_id,
822 const cpl_parameterlist *parameters,
823 const char *starttime)
826 cpl_image *raw_image[2] = {NULL, NULL};
832 cpl_table *line_table = NULL;
833 cpl_table *order_table = NULL;
834 cpl_table *mline_table = NULL;
835 cpl_table *m_mline_table = NULL;
836 cpl_table *model_table = NULL;
838 cpl_table *r_mline_table = NULL;
839 cpl_table *mst_line_table = NULL;
840 cpl_table *mst_mline_table = NULL;
841 cpl_table *mst_order_table = NULL;
846 cpl_table *line_refer = NULL;
855 int mst_abs_ord_min=0;
856 int mst_abs_ord_max=0;
860 const char *raw_filename =
"";
861 char *product_filename = NULL;
865 const char *line_refer_filename =
"";
866 const char *master_formatcheck_filename =
"";
867 cpl_image *master_formatcheck = NULL;
873 int iter_max=UVES_PHYSMOD_ITER_MAX;
875 cpl_table* qclog[iter_max*2+1];
878 double physmod_shift_x=0;
879 double physmod_shift_y=0;
880 double ref_frame_physmod_shift_x=0;
881 double ref_frame_physmod_shift_y=0;
882 const double max_shift_x=0.4;
883 const double max_shift_y=0.2;
884 double med_dx=2*max_shift_x;
885 double med_dy=2*max_shift_y;
886 const char* PROCESS_CHIP=NULL;
888 cpl_image *master_bias = NULL;
898 const char *chip_name =
"";
900 const char *master_bias_filename =
"";
905 for( iter=0 ; iter < 2*iter_max+1 ; iter++) {
914 check( uves_get_parameter(parameters, NULL,
"uves",
"debug",
915 CPL_TYPE_BOOL, &debug_mode),
916 "Could not read parameter");
917 check( uves_get_parameter(parameters, NULL,
"uves",
"process_chip",
918 CPL_TYPE_STRING, &PROCESS_CHIP),
919 "Could not read parameter");
922 check( uves_load_formatcheck(frames, flames, &raw_filename, raw_image,
923 raw_header, rotated_header, &blue),
924 "Error loading raw frame");
927 check( uves_load_linerefertable(frames, &line_refer_filename,
929 "Could not load line reference table");
930 uves_msg(
"Using line reference table in '%s'", line_refer_filename);
932 check( uves_get_parameter(parameters, NULL, recipe_id,
933 "trans_x", CPL_TYPE_DOUBLE, &trans_x ) ,
934 "Could not read parameter");
936 check( uves_get_parameter(parameters, NULL, recipe_id,
937 "trans_y", CPL_TYPE_DOUBLE, &trans_y ) ,
938 "Could not read parameter");
944 chip != UVES_CHIP_INVALID;
948 med_dx=2*max_shift_x;
949 med_dy=2*max_shift_y;
950 if(strcmp(PROCESS_CHIP,
"REDU") == 0) {
959 uves_msg(
"Processing %s chip in '%s'",
969 "Error reading plate id");
974 ck0_nomsg(flames_get_physmod_shift(plate_no,wavec,chip,
975 &physmod_shift_x,&physmod_shift_y,
976 &rot_1,&rot_2,&rot_3));
978 ref_frame_physmod_shift_x=physmod_shift_x;
979 ref_frame_physmod_shift_y=physmod_shift_y;
983 uves_msg(
"shift_x=%f shift_y=%f",physmod_shift_x,physmod_shift_y);
985 physmod_shift_x+=trans_x;
989 physmod_shift_y+=trans_y;
991 uves_msg(
"shift_x=%f shift_y=%f",physmod_shift_x,physmod_shift_y);
996 physmod_shift_x=trans_x;
1000 physmod_shift_y=trans_y;
1004 uves_msg(
"Using physmod shifts: %g %g",physmod_shift_x,physmod_shift_y);
1006 if (cpl_frameset_find(frames, UVES_MASTER_ARC_FORM(chip)) != NULL) {
1008 uves_free_image (&master_formatcheck);
1009 uves_free_propertylist(&master_formatcheck_header[raw_index]);
1010 check( uves_load_master_formatcheck(frames,
1012 &master_formatcheck_filename,
1013 &master_formatcheck,
1014 &master_formatcheck_header[raw_index],
1016 "Could not load master formatcheck frm");
1027 uves_free_image(&master_bias);
1028 uves_free_propertylist(&master_bias_header);
1029 if (cpl_frameset_find(frames, UVES_MASTER_BIAS(chip)) != NULL)
1031 uves_free_image(&master_bias);
1032 uves_free_propertylist(&master_bias_header);
1033 check( uves_load_mbias(frames,
1035 &master_bias_filename, &master_bias,
1036 &master_bias_header, chip),
1037 "Error loading master bias");
1040 master_bias_filename,master_formatcheck_filename);
1041 check_nomsg(cpl_image_subtract(raw_image[raw_index],master_bias));
1043 check_nomsg(cpl_image_subtract(master_formatcheck,master_bias));
1049 uves_msg_low(
"No master bias in SOF. Bias subtraction not done");
1059 (fabs(med_dx) > max_shift_x ||
1060 fabs(med_dy) > max_shift_y ) ;
1071 uves_free_table(&model_table);
1072 uves_free_table(&line_table);
1073 uves_free_table(&order_table);
1074 uves_free_table(&mline_table);
1077 uves_msg(
"Run the physical model on the raw frame");
1078 uves_msg(
"physmod shift x %f y %f",physmod_shift_x,physmod_shift_y);
1079 check( uves_physmod_process_chip(raw_image[raw_index],
1080 raw_header[raw_index],
1096 &absolute_order_poly2d,0),
1097 "Error processing chip");
1099 nordpred=abs_ord_max-abs_ord_min+1;
1100 uves_msg(
"No of predicted orders %d",nordpred);
1104 uves_msg(
"add QC log on raw frame");
1105 ck0(uves_physmod_qclog(line_table,order_table,qclog[it],
1106 raw_header[raw_index], chip,
1107 flames,iter,plate_no),
"qc-log dump");
1113 uves_free_table(&mst_line_table);
1114 uves_free_table(&mst_order_table);
1115 uves_free_table(&mst_mline_table);
1118 uves_msg(
"Run the physical model on the Master formatcheck frame");
1119 uves_msg(
"ref physmod shift x %f y %f",
1120 ref_frame_physmod_shift_x,ref_frame_physmod_shift_y);
1122 uves_msg(
"Stability counter=%d",stability_cnt);
1123 check(uves_physmod_process_chip(master_formatcheck,
1124 master_formatcheck_header[raw_index],
1125 master_formatcheck_filename,
1132 ref_frame_physmod_shift_x,
1133 ref_frame_physmod_shift_y,
1140 &mst_absolute_order_poly2d,
1142 "Error processing chip");
1145 uves_msg(
"Using master format check frm '%s'",
1146 master_formatcheck_filename);
1157 uves_physmod_qclog_sc(med_dx,med_dy,avg_dx,avg_dy,
1158 raw_header[raw_index],
1159 master_formatcheck_header[raw_index],
1162 uves_msg(
"iter=%d med_dx=%g med_dy=%g",
1163 iter,fabs(med_dx),fabs(med_dy));
1164 uves_msg(
"iter=%d max_shift_x=%g max_shift_y=%g",
1165 iter,max_shift_x,max_shift_y);
1168 nordpred=abs_ord_max-abs_ord_min+1;
1169 physmod_shift_x-=med_dx;
1170 physmod_shift_y-=med_dy;
1185 uves_free_propertylist(&product_header);
1186 uves_free_propertylist(&table_header);
1190 "Error writing trace ID to product header");
1192 "Error window number to product header");
1195 "Error window number to product header");
1198 "Error window number to product header");
1209 cpl_free(product_filename);
1211 sprintf(extname,
"LINE_GUESS_TAB");
1213 check(( product_filename = uves_guess_line_table_filename(chip),
1214 uves_frameset_insert(frames,
1216 CPL_FRAME_GROUP_PRODUCT,
1217 CPL_FRAME_TYPE_TABLE,
1218 CPL_FRAME_LEVEL_INTERMEDIATE,
1220 UVES_GUESS_LINE_TABLE(flames, chip),
1221 raw_header[raw_index],
1226 PACKAGE
"/" PACKAGE_VERSION,
1231 "Could not add line guess table %s to frameset",
1236 sprintf(extname,
"LINE_GUESS_POL1");
1238 check( uves_save_polynomial(absolute_order_poly2d,
1239 product_filename, table_header),
1240 "Could not write polynomial to file '%s'", product_filename);
1242 sprintf(extname,
"LINE_GUESS_POL2");
1244 check( uves_save_polynomial(absolute_order_poly2d,
1245 product_filename, table_header),
1246 "Could not write polynomial to file '%s'", product_filename);
1250 uves_msg(
"Line table %s added to frameset", product_filename);
1254 cpl_free(product_filename);
1256 sprintf(extname,
"ORD_GUESS_TAB");
1258 check(( product_filename = uves_guess_order_table_filename(chip),
1259 uves_frameset_insert(frames,
1261 CPL_FRAME_GROUP_PRODUCT,
1262 CPL_FRAME_TYPE_TABLE,
1263 CPL_FRAME_LEVEL_INTERMEDIATE,
1265 UVES_GUESS_ORDER_TABLE(flames, chip),
1266 raw_header[raw_index],
1271 PACKAGE
"/" PACKAGE_VERSION,
1276 "Could not add order guess table %s to frameset",
1279 uves_msg(
"Order guess table %s added to frameset",
1282 for(it=0;it<2*iter_max+1;it++) {
1286 if(strcmp(PROCESS_CHIP,
"REDL") == 0) {
1293 for(it=0;it<2*iter_max+1;it++) {
1298 uves_free_image(&master_bias);
1299 uves_free_propertylist(&master_bias_header);
1301 uves_free_image (&raw_image[0]);
1302 uves_free_image (&raw_image[1]);
1303 uves_free_propertylist(&raw_header[0]);
1304 uves_free_propertylist(&raw_header[1]);
1305 uves_free_propertylist(&rotated_header[0]);
1306 uves_free_propertylist(&rotated_header[1]);
1308 uves_free_image (&master_formatcheck);
1309 uves_free_propertylist(&master_formatcheck_header[0]);
1310 uves_free_propertylist(&master_formatcheck_header[1]);
1312 uves_free_table(&model_table);
1313 uves_free_table(&line_table);
1314 uves_free_table(&mst_line_table);
1315 uves_free_table(&order_table);
1316 uves_free_table(&mst_order_table);
1317 uves_free_table(&line_refer);
1319 uves_free_table(&mline_table);
1320 uves_free_table(&m_mline_table);
1321 uves_free_table(&r_mline_table);
1322 uves_free_table(&mst_mline_table);
1324 uves_free_propertylist(&product_header);
1325 uves_free_propertylist(&table_header);
1328 cpl_free(product_filename);
1345 uves_physmod_qclog(cpl_table* line_table,
1346 cpl_table* order_table,
1349 enum uves_chip chip,
1355 cpl_table *xline_table=NULL;
1366 "Fibre-Physical-Model-Prediction-Results",
1372 "Physical-Model-Prediction-Results",
1378 "UVES_phys_mod/1.1.0",
1384 "2000:03:18T00:00:00.000",
1385 "Physmod Model Parameters Last Change",
1390 sprintf(key_value,
"%s%d",
"QC MODEL ITER",iter);
1399 cpl_table_get_column_min(line_table,
"Order"),
1400 "minimum predicted order value",
1405 cpl_table_get_column_max(line_table,
"Order"),
1406 "maximum predicted order value",
1412 cpl_table_get_column_min(line_table,
"WAVEC")/10.,
1413 "minimum predicted order value",
1418 cpl_table_get_column_max(line_table,
"WAVEC")/10.,
1419 "maximum predicted order value",
1427 cpl_table_get_nrow(line_table),
1428 "Number of predicted lines",
1431 check_nomsg(nlinsel=cpl_table_and_selected_int(line_table,
"SELPLOT",
1433 check_nomsg(xline_table=cpl_table_extract_selected(line_table));
1438 "Number of lines selected",
1443 "QC MODEL DIFFXRMS",
1444 cpl_table_get_column_stdev(xline_table,
"XDIF"),
1445 "Std dev of X difference to physical model",
1449 "QC MODEL DIFFXAVG",
1450 cpl_table_get_column_mean(xline_table,
"XDIF"),
1451 "Average of X difference to physical model",
1455 cpl_table_get_column_median(xline_table,
"XDIF"),
1456 "Median of X difference to physical model",
1460 "QC MODEL DIFFYRMS",
1461 cpl_table_get_column_stdev(xline_table,
"YDIF"),
1462 "Std dev of Y difference to physical model",
1466 "QC MODEL DIFFYAVG",
1467 cpl_table_get_column_mean(xline_table,
"YDIF"),
1468 "Average of Y difference to physical model",
1472 cpl_table_get_column_median(xline_table,
"YDIF"),
1473 "Median of Y difference to physical model",
1477 if ( flames == 1 ) {
1480 sprintf(key_value,
"%s%d",
"QC MODEL RESXRMS",iter);
1483 cpl_table_get_column_stdev(xline_table,
"XDIF"),
1484 "Std dev of X difference to physical model",
1488 sprintf(key_value,
"%s%d",
"QC MODEL RESXAVG",iter);
1491 cpl_table_get_column_mean(xline_table,
"XDIF"),
1492 "Average of X difference to physical model",
1495 sprintf(key_value,
"%s%d",
"QC MODEL RESXMED",iter);
1498 cpl_table_get_column_median(xline_table,
"XDIF"),
1499 "Median of X difference to physical model",
1504 sprintf(key_value,
"%s%d",
"QC MODEL RESYRMS",iter);
1507 cpl_table_get_column_stdev(xline_table,
"YDIF"),
1508 "Std dev of Y difference to physical model",
1512 sprintf(key_value,
"%s%d",
"QC MODEL RESYAVG",iter);
1515 cpl_table_get_column_mean(xline_table,
"YDIF"),
1516 "Average of Y difference to physical model",
1519 sprintf(key_value,
"%s%d",
"QC MODEL RESYMED",iter);
1522 cpl_table_get_column_median(xline_table,
"YDIF"),
1523 "Median of Y difference to physical model",
1530 cpl_table_unselect_all(line_table);
1536 cpl_table_get_column_min(xline_table,
"WAVEC")/10.,
1537 "minimum predicted wavelength value",
1542 cpl_table_get_column_max(xline_table,
"WAVEC")/10.,
1543 "maximum predicted wavelength value",
1549 (
int)cpl_table_get_column_min(xline_table,
"Order"),
1550 "minimum predicted order value",
1555 (
int)cpl_table_get_column_max(xline_table,
"Order"),
1556 "maximum predicted order value",
1565 cpl_table_get_column_min(line_table,
"WAVEC")/10.,
1566 "minimum wavelength",
1571 cpl_table_get_column_max(line_table,
"WAVEC")/10.,
1572 "maximum wavelength",
1577 cpl_table_get_column_min(order_table,
"ORDER"),
1578 "minimum order number",
1583 cpl_table_get_column_max(order_table,
"ORDER"),
1584 "maximum order number",
1598 cpl_table_get_column_max(order_table,
"ORDER"),
1599 "abs. trans. countrate",
1609 cpl_table_get_column_max(order_table,
"ORDER"),
1610 "no. of hot pixels",
1627 uves_free_table(&xline_table);
1629 if (cpl_error_get_code() != CPL_ERROR_NONE) {
1654 uves_physmod_qclog_sc(
const double med_dx,
1655 const double med_dy,
1656 const double avg_dx,
1657 const double avg_dy,
1660 enum uves_chip chip,
1671 "Fibre-Stability-Check-Results",
1677 "Stability-Check-Results",
1684 "UVES_phys_mod/1.1.0",
1690 "2000:03:18T00:00:00.000",
1691 "Physmod Model Parameters Last Change",
1701 "Reference file name",
1707 "Ambient pressure [mm] Hg.",
1713 sprintf(key_value,
"%s%d",
"QC MODEL ITER",iter);
1733 "median shift in x",
1745 "median shift in y",
1751 if (cpl_error_get_code() != CPL_ERROR_NONE) {
1775 flames_get_physmod_shift(
const int plate_no,
1777 enum uves_chip chip,
1790 uves_msg(
"plate_no=%d,wavec=%d,chip=%d",plate_no,wavec,chip);
1794 if(chip==UVES_CHIP_REDL) {
1846 if(chip==UVES_CHIP_REDL) {
1848 case UVES_CHIP_REDL:
1910 uves_msg(
"Physical Model shifts trans=%f,%f rot=%f,%f,%f",
1911 *trans_x,*trans_y,*rot_1,*rot_2,*rot_3);
int uves_physmod_stability_check(cpl_table *m_tbl, cpl_table *r_tbl, double *med_dx, double *med_dy, double *avg_dx, double *avg_dy)
This procedure run a stability check.
void uves_polynomial_delete(polynomial **p)
Delete a polynomial.
int uves_physmod_qc1pmtbl(cpl_table **rline_tbl, cpl_table **lin_tbl)
To be written.
int uves_flames_pfits_get_plateid(const uves_propertylist *raw_header)
read the plate id
void uves_pfits_set_windownumber(uves_propertylist *plist, int window_number)
Write the window number.
const char * uves_pfits_get_arcfile(const uves_propertylist *plist)
find out the arcfile
int uves_qclog_add_string(cpl_table *table, const char *key_name, const char *value, const char *key_help, const char *format)
Add string key to QC-LOG table.
int uves_physmod_create_table(const uves_propertylist *raw_header, enum uves_chip chip, bool flames, const char *recipe_id, const cpl_parameterlist *parameters, cpl_table *line_refer, const double physmod_shift_x, const double physmod_shift_y, cpl_table **mod_tbl, cpl_table **fsr_tbl)
Generates two tables with results of the UVES physical model.
int uves_qclog_delete(cpl_table **table)
delete QC-LOG table
double uves_pfits_get_gratwlen(const uves_propertylist *plist, enum uves_chip chip)
find out the central wavelength
int uves_qclog_add_double(cpl_table *table, const char *key_name, const double value, const char *key_help, const char *format)
Add double key to QC-LOG table.
double uves_pfits_get_ambipress(const uves_propertylist *plist)
find out the arcfile
void uves_flames_pfits_set_newplateid(uves_propertylist *plist, int plate_no)
Write the plate number.
int uves_qclog_add_int(cpl_table *table, const char *key_name, const int value, const char *key_help, const char *format)
Add integer key to QC-LOG table.
uves_propertylist * uves_propertylist_new(void)
Create an empty property list.
#define uves_msg(...)
Print a message on 'info' or 'debug' level.
void uves_pfits_set_traceid(uves_propertylist *plist, int trace_id)
Write the trace ID.
int uves_physmod_chop_otab(const uves_propertylist *raw_header, enum uves_chip chip, cpl_table **ord_tbl, const char *col_name, int *ord_min, int *ord_max)
Chop off orders which are not fully in the detector chip.
int uves_chip_get_index(enum uves_chip chip)
Convert to integer.
enum uves_chip uves_chip_get_first(bool blue)
Get first chip for blue or red arm.
cpl_error_code uves_pfits_set_extname(uves_propertylist *plist, const char *extname)
Write the EXTNAME keyword.
#define uves_msg_low(...)
Print a message on a lower message level.
void uves_pfits_set_lastabsorder(uves_propertylist *plist, int last_abs_order)
Write the last absolute order number.
enum uves_chip uves_chip_get_next(enum uves_chip chip)
Get next chip.
#define uves_msg_debug(...)
Print a debug message.
const char * uves_chip_tostring_upper(enum uves_chip chip)
Convert to string.
int uves_physmod_msrawxy(const cpl_image *raw_image, const uves_propertylist *raw_header, const char *recipe_id, const cpl_parameterlist *parameters, cpl_table *mod_tbl, cpl_table **l_tbl, cpl_table **m_tbl, cpl_table **p_tbl, cpl_table **rline_tbl, cpl_table **mline_tbl, cpl_table **npline_tbl)
This procedure measures the raw XY positions and widths of Th-Ar lines on an ThAr arc echelle exposur...
int uves_physmod_plotmod(const cpl_table *tbl, const uves_propertylist *head, const char *rec_id, const cpl_parameterlist *params, enum uves_chip chip)
This procedure plots results from the uves_physmod recipe.
const char * uves_string_toupper(char *s)
Convert all lowercase characters in a string into uppercase characters.
cpl_error_code uves_pfits_set_ordpred(uves_propertylist *plist, int nord)
Write the predicted number of order.
void uves_qclog_add_common_wave(const uves_propertylist *raw_header, enum uves_chip chip, cpl_table *qclog)
Write common QC parameters.
cpl_table * uves_qclog_init(const uves_propertylist *raw_header, enum uves_chip chip)
Init QC-LOG table.
const char * uves_pfits_get_chipid(const uves_propertylist *plist, enum uves_chip chip)
Find out the chip ID.
void uves_pfits_set_firstabsorder(uves_propertylist *plist, int first_abs_order)
Write the first absolute order number.
int uves_physmod_calmap(const uves_propertylist *raw_header, enum uves_chip chip, const char *recipe_id, const cpl_parameterlist *parameters, cpl_table *npline_tbl, cpl_table **ord_tbl, cpl_table **lin_tbl, cpl_table **w_tbl, cpl_table **s_tbl, int *abs_ord_min, int *abs_ord_max, polynomial **poly2d)
This procedure makes the order definitions and wavelength calibration from the wavelength projection ...