72static int gravity_vis(cpl_frameset *, cpl_parameterlist *);
77static char gravity_vis_short[] =
"Compute the visibilities from raw observation of OBJECT.";
79 "This recipe is associated to the observations template. Its reduces the raw data acquired on calibrator or science targets and computes the uncalibrated visibilities, saved in an OIFITS file. If several OBJECT are provided, the recipe will reduce all of them and merge the resulting data into a single OIFITS. If several SKY_RAW are provided, the recipe reduces the first OBJECT with the first SKY file. Then each new OBJECT with the next SKY. When the number of SKYs is reached, the recipe loops back to first SKY file (so if the number of SKYs is larger than the number of OBJECTs, the last SKY won't be used). The recipe will reduce the data even if no SKY or no DARK is provided. However this will lead to wrong estimate of the visibility and squared visibility of the object. If the file DIAMETER_CAT is not provided, the recipe will use the diameter provided in the header to compute the transfer function QC parameters."
81 "The tag in the DO category can be SINGLE/DUAL and CAL/SCI. They should reflect the instrument mode (SINGLE or DUAL) and the DPR.CATG of the observation (SCIENCE or CALIB). The tag in the PRO.CATG category will be SINGLE/DUAL and CAL/SCI depending on the input tag.\n"
83 "* Load the input file (loop on input OBJECT files)\n"
84 "* Extract the spectra (use BAD, DARK, SKY, FLAT files)\n"
85 "* Interpolate the spectra into a common wavelength table (use WAVE file)\n"
86 "* Compute the real-time visibilities (use P2VM file)\n"
87 "* Compute additional real-time signals (SNR, GDELAY...)\n"
88 "* Compute selection flags (= flag frames with SNR lower than threshold, vFactor lower than threshold...)\n"
89 "* Average the real-time visibilities, considering the selection flag\n"
90 "* Write the product\n"
106 GRAVI_SPECTRUM" (opt) : intermediate product (see detailled description of data)\n"
107 GRAVI_PREPROC" (opt) : intermediate product (see detailled description of data)\n"
127 cpl_recipe * recipe = cpl_calloc(1,
sizeof *recipe );
128 cpl_plugin * plugin = &recipe->interface;
130 if (cpl_plugin_init(plugin,
132 GRAVI_BINARY_VERSION,
133 CPL_PLUGIN_TYPE_RECIPE,
137 "Nabih Azouaoui, Vincent Lapeyrere, JB. Le Bouquin",
143 cpl_msg_error(cpl_func,
"Plugin initialization failed");
144 (void)cpl_error_set_where(cpl_func);
148 if (cpl_pluginlist_append(list, plugin)) {
149 cpl_msg_error(cpl_func,
"Error adding plugin to list");
150 (void)cpl_error_set_where(cpl_func);
172 if (cpl_error_get_code() != CPL_ERROR_NONE) {
173 cpl_msg_error(cpl_func,
"%s():%d: An error is already set: %s",
174 cpl_func, __LINE__, cpl_error_get_where());
175 return (
int)cpl_error_get_code();
178 if (plugin == NULL) {
179 cpl_msg_error(cpl_func,
"Null plugin");
180 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
184 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
185 cpl_msg_error(cpl_func,
"Plugin is not a recipe");
186 cpl_ensure_code(0, (
int)CPL_ERROR_TYPE_MISMATCH);
190 recipe = (cpl_recipe *)plugin;
193 recipe->parameters = cpl_parameterlist_new();
194 if (recipe->parameters == NULL) {
195 cpl_msg_error(cpl_func,
"Parameter list allocation failed");
196 cpl_ensure_code(0, (
int)CPL_ERROR_ILLEGAL_OUTPUT);
233 p = cpl_parameter_new_value (
"gravity.vis.flat-flux", CPL_TYPE_BOOL,
234 "Normalize the flux (stored in OI_FLUX binary extension) with "
235 "instrument transmission recorded in the \n"
236 "input P2VM calibration map. Consequently, the flux quantity is either "
237 "the intensity level recorded \n"
238 "in the detector, thus including the instrument transmission (FALSE); "
239 "or the intensity level at the instrument entrance (TRUE).",
240 "gravity.vis", FALSE);
241 cpl_parameter_set_alias (p, CPL_PARAMETER_MODE_CLI,
"flat-flux");
242 cpl_parameter_disable (p, CPL_PARAMETER_MODE_ENV);
243 cpl_parameterlist_append (recipe->parameters, p);
246 p = cpl_parameter_new_value (
"gravity.preproc.average-sky", CPL_TYPE_BOOL,
247 "Average the SKYs into a master SKY. If FALSE, the recipe loops\n "
248 "over the SKY to reduce each OBJECT with a different SKY",
249 "gravity.preproc", FALSE);
250 cpl_parameter_set_alias (p, CPL_PARAMETER_MODE_CLI,
"average-sky");
251 cpl_parameter_disable (p, CPL_PARAMETER_MODE_ENV);
252 cpl_parameterlist_append (recipe->parameters, p);
255 p = cpl_parameter_new_enum (
"gravity.test.reduce-acq-cam", CPL_TYPE_STRING,
256 "If TRUE, reduced ACQ_CAM images. If QC, compute only\n "
257 "the QC parameters of the field part. If FALSE, ignore\n "
258 "completely the acquisition camera.",
259 "gravity.test",
"FALSE",
260 3,
"TRUE",
"FALSE",
"QC");
261 cpl_parameter_set_alias (p, CPL_PARAMETER_MODE_CLI,
"reduce-acq-cam");
262 cpl_parameter_disable (p, CPL_PARAMETER_MODE_ENV);
263 cpl_parameterlist_append (recipe->parameters, p);
266 p = cpl_parameter_new_value (
"gravity.vis.color-wave-correction", CPL_TYPE_BOOL,
267 "If TRUE, creates a new OI_WAVELENGTH_EFF with corrected wavelength",
268 "gravity.vis", FALSE);
269 cpl_parameter_set_alias (p, CPL_PARAMETER_MODE_CLI,
"color-wave-correction");
270 cpl_parameter_disable (p, CPL_PARAMETER_MODE_ENV);
271 cpl_parameterlist_append (recipe->parameters, p);
274 p = cpl_parameter_new_value (
"gravity.vis.oifits2", CPL_TYPE_BOOL,
275 "If TRUE, the output products will be fully OIFITS2 compliant. "
276 "Note that TRUE will be the default and eventually the "
277 "parameter will be removed in the future",
278 "gravity.vis", FALSE);
279 cpl_parameter_set_alias (p, CPL_PARAMETER_MODE_CLI,
"oifits2");
280 cpl_parameter_disable (p, CPL_PARAMETER_MODE_ENV);
281 cpl_parameterlist_append (recipe->parameters, p);
298 cpl_errorstate initial_errorstate = cpl_errorstate_get();
302 if (cpl_error_get_code() != CPL_ERROR_NONE) {
303 cpl_msg_error(cpl_func,
"%s():%d: An error is already set: %s",
304 cpl_func, __LINE__, cpl_error_get_where());
305 return (
int)cpl_error_get_code();
308 if (plugin == NULL) {
309 cpl_msg_error(cpl_func,
"Null plugin");
310 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
314 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
315 cpl_msg_error(cpl_func,
"Plugin is not a recipe");
316 cpl_ensure_code(0, (
int)CPL_ERROR_TYPE_MISMATCH);
320 recipe = (cpl_recipe *)plugin;
323 if (recipe->parameters == NULL) {
324 cpl_msg_error(cpl_func,
"Recipe invoked with NULL parameter list");
325 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
327 if (recipe->frames == NULL) {
328 cpl_msg_error(cpl_func,
"Recipe invoked with NULL frame set");
329 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
333 recipe_status =
gravity_vis(recipe->frames, recipe->parameters);
336 if (cpl_dfs_update_product_header(recipe->frames)) {
338 recipe_status = (int)cpl_error_get_code();
342 if (!cpl_errorstate_is_equal(initial_errorstate)) {
345 cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
348 return recipe_status;
362 if (plugin == NULL) {
363 cpl_msg_error(cpl_func,
"Null plugin");
364 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
368 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
369 cpl_msg_error(cpl_func,
"Plugin is not a recipe");
370 cpl_ensure_code(0, (
int)CPL_ERROR_TYPE_MISMATCH);
374 recipe = (cpl_recipe *)plugin;
376 cpl_parameterlist_delete(recipe->parameters);
392 cpl_parameterlist * parlist)
394 cpl_frameset * recipe_frameset=NULL, * wavecalib_frameset=NULL, * dark_frameset=NULL,
395 * darkcalib_frameset=NULL, * sky_frameset=NULL, * flatcalib_frameset=NULL, * p2vmcalib_frameset=NULL,
396 * badcalib_frameset=NULL, *used_frameset=NULL, * current_frameset=NULL, * dispcalib_frameset=NULL,
397 * metpos_frameset=NULL, * diamcat_frameset = NULL, *eop_frameset = NULL, *patch_frameset = NULL,
398 * static_param_frameset=NULL, * pcacalib_frameset = NULL;
400 cpl_frame * frame=NULL;
402 const char * frame_tag=NULL;
403 char * proCatg = NULL, * mode=NULL, * redCatg = NULL, * skyCatg = NULL;
405 gravi_data * p2vm_map=NULL, * data=NULL, * wave_map=NULL, * dark_map=NULL,
406 * profile_map=NULL, * badpix_map=NULL, * preproc_data=NULL, * p2vmred_data=NULL, * tmpvis_data=NULL,
407 * vis_data=NULL, * disp_map=NULL, * diodepos_data=NULL, * diamcat_data=NULL, *eop_map=NULL,
408 * static_param_data=NULL, * pca_calib_data=NULL;
410 cpl_propertylist ** p2vm_qcs = NULL;
412 int nb_frame, nb_sky;
413 char * input_data_type;
420 cpl_error_get_code()) ;
442 if ( cpl_frameset_get_size (p2vmcalib_frameset) !=1 ||
443 cpl_frameset_get_size (wavecalib_frameset) !=1 ||
444 cpl_frameset_get_size (flatcalib_frameset) !=1 ||
445 cpl_frameset_get_size (badcalib_frameset) != 1 ||
446 cpl_frameset_get_size (recipe_frameset) < 1 ||
447 (cpl_frameset_is_empty (dark_frameset) &&
448 cpl_frameset_is_empty (darkcalib_frameset) &&
449 cpl_frameset_is_empty (sky_frameset)) ) {
450 cpl_error_set_message (cpl_func, CPL_ERROR_ILLEGAL_INPUT,
451 "Illegal number of P2VM, FLAT, WAVE, BAD, DARK or SKY, OBJECT file on the frameset");
452 cpl_error_set_message (cpl_func, CPL_ERROR_ILLEGAL_INPUT,
453 "See online help: esorex --man gravity_vis");
459 cpl_parameter *phase_ref = cpl_parameterlist_find (parlist,
"gravity.vis.phase-ref-sc");
460 cpl_parameter *output_phase = cpl_parameterlist_find (parlist,
"gravity.vis.output-phase-sc");
462 if (strcmp (cpl_parameter_get_string(phase_ref),
"SELF_REF") != 0) {
463 cpl_msg_warning (cpl_func,
"VISPHI flattening requires phase-ref-sc=SELF_REF, forcing");
464 cpl_parameter_set_string (phase_ref,
"SELF_REF");
467 if (strcmp (cpl_parameter_get_string(output_phase),
"SELF_VISPHI") != 0) {
468 cpl_msg_warning (cpl_func,
"VISPHI flattening requires output-phase-sc=SELF_VISPHI, forcing");
469 cpl_parameter_set_string (output_phase,
"SELF_VISPHI");
474 used_frameset = cpl_frameset_new();
480 if (!cpl_frameset_is_empty (dark_frameset)) {
482 frame = cpl_frameset_get_position (dark_frameset, 0);
495 NULL, frame,
"gravity_vis",
500 else if (!cpl_frameset_is_empty (darkcalib_frameset)) {
502 frame = cpl_frameset_get_position (darkcalib_frameset, 0);
508 cpl_msg_info (cpl_func,
"There is no DARK in the frame set");
511 frame = cpl_frameset_get_position (badcalib_frameset, 0);
515 frame = cpl_frameset_get_position (flatcalib_frameset, 0);
519 frame = cpl_frameset_get_position (wavecalib_frameset, 0);
523 frame = cpl_frameset_get_position (p2vmcalib_frameset, 0);
526 cpl_parameterlist_append(parlist, param_extrapixel);
529 if (!cpl_frameset_is_empty (dispcalib_frameset)) {
530 frame = cpl_frameset_get_position (dispcalib_frameset, 0);
534 cpl_msg_info (cpl_func,
"There is no DISP_MODEL in the frameset");
537 if (!cpl_frameset_is_empty (metpos_frameset)) {
538 frame = cpl_frameset_get_position (metpos_frameset, 0);
542 cpl_msg_info (cpl_func,
"There is no DIODE_POSITION in the frameset");
545 if ( !cpl_frameset_is_empty (eop_frameset) ) {
546 frame = cpl_frameset_get_position (eop_frameset, 0);
550 cpl_msg_info (cpl_func,
"There is no EOP_PARAM in the frameset");
554 if (!cpl_frameset_is_empty (static_param_frameset)) {
555 frame = cpl_frameset_get_position (static_param_frameset, 0);
559 cpl_msg_info (cpl_func,
"There is no STATIC_PARAM in the frameset");
562 if ( !cpl_frameset_is_empty (diamcat_frameset) ) {
563 frame = cpl_frameset_get_position (diamcat_frameset, 0);
567 cpl_msg_info (cpl_func,
"There is no DIAMETER_CAT in the frameset");
569 if ( !cpl_frameset_is_empty (pcacalib_frameset)) {
570 frame = cpl_frameset_get_position (pcacalib_frameset, 0);
573 cpl_msg_info (cpl_func,
"There is no PHASE_PCA in the frameset");
581 frame_tag = cpl_frame_get_tag (cpl_frameset_get_position (recipe_frameset, 0));
587 mode = cpl_sprintf (
"gravi_dual");
588 input_data_type = cpl_sprintf (
"raw_calibrator");
594 mode = cpl_sprintf (
"gravi_dual");
595 input_data_type = cpl_sprintf (
"raw_science");
601 mode = cpl_sprintf (
"gravi_single");
602 input_data_type = cpl_sprintf (
"raw_calibrator");
608 mode = cpl_sprintf (
"gravi_single");
609 input_data_type = cpl_sprintf (
"raw_science");
612 cpl_error_set_message (cpl_func, CPL_ERROR_ILLEGAL_INPUT,
613 "Cannot recognize the input DO.CATG");
617 cpl_msg_info (cpl_func,
"Mode of the first frame is: %s (will be used for all frames)", mode);
627 nb_sky = cpl_frameset_get_size (sky_frameset);
628 sky_maps = cpl_calloc (CPL_MAX(nb_sky,1),
sizeof(
gravi_data*));
630 for (
int isky = 0; isky < nb_sky; isky++){
633 cpl_msg_info (cpl_func,
" ***** SKY %d over %d ***** ", isky+1, nb_sky);
634 frame = cpl_frameset_get_position (sky_frameset, isky);
646 if (averageSky == 0) {
647 char filename_suffix[20];
648 snprintf(filename_suffix, 16,
"%d", isky);
650 parlist, NULL, frame,
"gravity_vis",
660 if (averageSky == 1) {
661 cpl_msg_info (cpl_func,
"Do a MASTER SKY from the %d skys", nb_sky);
668 parlist, sky_frameset,
669 cpl_frameset_get_position (sky_frameset, 0),
670 "gravity_vis", NULL, skyCatg);
674 cpl_frameset_join (used_frameset, sky_frameset);
675 for (
int isky = 0; isky < nb_sky; isky++)
677 sky_maps[0] = msky_map;
685 nb_frame = cpl_frameset_get_size (recipe_frameset);
686 p2vm_qcs = cpl_malloc(
sizeof(cpl_propertylist*) * nb_frame);
688 for (
int ivis = 0; ivis < nb_frame; ivis++){
689 p2vm_qcs[ivis] = cpl_propertylist_new();
691 char filename_suffix[20];
692 snprintf(filename_suffix, 16,
"%d", ivis);
693 current_frameset = cpl_frameset_duplicate (used_frameset);
695 cpl_msg_info (cpl_func,
" ***** OBJECT %d over %d ***** ", ivis+1, nb_frame);
700 isky = nb_sky>0 ? ivis % nb_sky : 0;
704 cpl_msg_info (cpl_func,
"There is no SKY in the frameset");
706 else if (averageSky) {
708 cpl_msg_info (cpl_func,
"Use MASTER SKY (already reduced)");
712 cpl_msg_info (cpl_func,
"Use SKY %i over %i (already reduced)", isky+1, nb_sky);
713 frame = cpl_frameset_get_position (sky_frameset, isky);
716 cpl_frameset_insert (current_frameset, cpl_frame_duplicate (frame));
723 frame = cpl_frameset_get_position (recipe_frameset, ivis);
725 cpl_frameset_insert(used_frameset, cpl_frame_duplicate (frame));
736 current_frameset, frame,
"gravity_vis",
737 NULL,
"BIAS_SUBTRACTED");
744 cpl_msg_warning (cpl_func,
"Shutter problem in the OBJECT");
749 badpix_map, sky_maps[isky],
756 parlist, current_frameset, frame,
768 parlist, current_frameset, frame,
783 parlist, current_frameset, frame,
790 cpl_boolean subtract_met_dark = dark_map != NULL && cpl_parameter_get_bool(
791 cpl_parameterlist_find_const(parlist,
"gravity.metrology.use-dark-offsets"));
793 if (subtract_met_dark)
818 int saveAcqTable = 1;
819 gravi_reduce_acqcam (p2vmred_data, preproc_data, sky_maps[isky], dark_map, static_param_data, saveAcqTable);
822 int saveAcqTable = 0;
823 gravi_reduce_acqcam (p2vmred_data, preproc_data, sky_maps[isky], dark_map, static_param_data, saveAcqTable);
876 CPLCHECK_MSG (
"Cannot compute rejection flags signals");
882 parlist, current_frameset, frame,
883 "gravity_vis", NULL, redCatg);
889 cpl_size current_frame = 0;
890 while (current_frame >= 0)
899 cpl_msg_info (cpl_func,
"Force same time for all quantities/baselines");
905 if (current_frame < 0 && !strcmp (
gravi_param_get_string (parlist,
"gravity.test.reduce-acq-cam"),
"TRUE"))
912 if (vis_data == NULL) {
913 vis_data = tmpvis_data; tmpvis_data = NULL;
927 parlist, current_frameset, frame,
934 FREE (cpl_frameset_delete, current_frameset);
948 cpl_msg_info (cpl_func,
"Computing QC parameters for visibilities");
959 cpl_msg_info (cpl_func,
"Flatten the FLUX with the internal P2VM spectrum");
964 cpl_msg_info (cpl_func,
"Don't flatten the FLUX with the internal P2VM spectrum");
971 cpl_msg_info (cpl_func,
"Align the SC visibilities on the FT");
975 cpl_msg_info (cpl_func,
"Don't align the SC visibilities on the FT");
980 cpl_msg_info (cpl_func,
"Compute the wavelength shift due to target color");
984 cpl_msg_info (cpl_func,
"Don't compute the wavelength shift due to target color");
992 cpl_msg_info (cpl_func,
"Don't average the different observation (if any)");
1000 const cpl_frame *it_frame;
1002 cpl_frameset_iterator *it = cpl_frameset_iterator_new(science_frames);
1003 double mjd_obs_first = DBL_MAX;
1004 while ((it_frame = cpl_frameset_iterator_get(it)) != NULL) {
1005 cpl_propertylist * this_frame_header = cpl_propertylist_load(cpl_frame_get_filename(it_frame), 0);
1007 if (mjd_obs < mjd_obs_first)
1009 mjd_obs_first = mjd_obs;
1010 frame = cpl_frameset_iterator_get(it);
1012 cpl_frameset_iterator_advance(it, 1);
1013 cpl_propertylist_delete(this_frame_header);
1015 cpl_frameset_iterator_delete(it);
1017 cpl_frameset_join (used_frameset, recipe_frameset);
1023 used_frameset, frame,
"gravity_vis", NULL, proCatg);
1024 cpl_frameset_delete(science_frames);
1052 FREE (cpl_frameset_delete,darkcalib_frameset);
1053 FREE (cpl_frameset_delete,wavecalib_frameset);
1054 FREE (cpl_frameset_delete,flatcalib_frameset);
1055 FREE (cpl_frameset_delete,badcalib_frameset);
1056 FREE (cpl_frameset_delete,p2vmcalib_frameset);
1057 FREE (cpl_frameset_delete,metpos_frameset);
1058 FREE (cpl_frameset_delete,dark_frameset);
1059 FREE (cpl_frameset_delete,diamcat_frameset);
1060 FREE (cpl_frameset_delete,sky_frameset);
1061 FREE (cpl_frameset_delete,dispcalib_frameset);
1062 FREE (cpl_frameset_delete,pcacalib_frameset);
1063 FREE (cpl_frameset_delete,eop_frameset);
1064 FREE (cpl_frameset_delete,patch_frameset);
1065 FREE (cpl_frameset_delete,static_param_frameset);
1066 FREE (cpl_frameset_delete,recipe_frameset);
1067 FREE (cpl_frameset_delete,current_frameset);
1068 FREE (cpl_frameset_delete,used_frameset);
1069 FREE (cpl_free,proCatg);
1070 FREE (cpl_free,redCatg);
1071 FREE (cpl_free,skyCatg);
1072 FREE (cpl_free,mode);
1073 FREE (cpl_free,input_data_type);
1074 FREELOOP(cpl_propertylist_delete, p2vm_qcs, nb_frame);
1078 return (
int)cpl_error_get_code();
typedefCPL_BEGIN_DECLS struct _gravi_data_ gravi_data
#define gravi_data_get_header(data)
cpl_error_code gravi_metrology_demodulate(gravi_data *met_data, cpl_boolean zero_subtracted)
Demodulate the metrology.
#define GRAVI_RECIPE_OUTPUT
#define GRAVI_P2VMRED_SINGLE_CALIB
#define GRAVI_SINGLE_SCIENCE_RAW
#define GRAVI_SINGLE_SKY_RAW
#define GRAVI_P2VMRED_DUAL_CALIB
#define GRAVI_DIODE_POSITION
#define GRAVI_SINGLE_SKY_MAP
#define GRAVI_RECIPE_FLOW
#define GRAVI_VIS_DUAL_SCIENCE
#define GRAVI_VIS_SINGLE_SCIENCE
#define GRAVI_ASTROREDUCED
#define GRAVI_DUAL_CALIB_RAW
#define GRAVI_P2VMRED_SINGLE_SCIENCE
#define GRAVI_DIAMETER_CAT
#define GRAVI_DUAL_SKY_MAP
#define GRAVI_RECIPE_INPUT
#define GRAVI_SINGLE_CALIB_RAW
#define GRAVI_VIS_DUAL_CALIB
#define GRAVI_DUAL_SCIENCE_RAW
#define GRAVI_SPECTRUM_ALIGNED
#define GRAVI_VIS_SINGLE_CALIB
#define GRAVI_P2VMRED_DUAL_SCIENCE
cpl_msg_info(cpl_func, "Compute WAVE_SCAN for %s", GRAVI_TYPE(type_data))
#define GRAVI_IMAGING_DATA_ACQ_EXT
#define GRAVI_ARRAY_GEOMETRY_EXT
#define GRAVI_METROLOGY_EXT
#define GRAVI_OPTICAL_TRAIN_EXT
#define CPLCHECK_CLEAN(msg)
#define gravi_msg_function_exit(flag)
#define FREE(function, variable)
#define gravi_msg_function_start(flag)
#define CPLCHECK_MSG(msg)
#define gravi_data_check_shutter_open(data)
#define FREELOOP(function, variable, n)
static int gravity_vis_exec(cpl_plugin *)
Execute the plugin instance given by the interface.
static char gravity_vis_description[]
static int gravity_vis(cpl_frameset *, cpl_parameterlist *)
Compute the visibilities, and closure phase and create the io fits file.
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.
static char gravity_vis_short[]
static int gravity_vis_create(cpl_plugin *)
Setup the recipe options
static int gravity_vis_destroy(cpl_plugin *)
Destroy what has been created by the 'create' function.
cpl_error_code gravi_preproc_acqcam(gravi_data *output_data, gravi_data *input_data, gravi_data *bad_map)
Preprocess the ACQ images: correct bad pixels, clean from pupil background via blinking,...
cpl_error_code gravi_reduce_acqcam(gravi_data *output_data, gravi_data *input_data, gravi_data *sky_data, gravi_data *dark_data, gravi_data *static_param_data, int saveAcqTable)
Reduce the ACQ camera images.
cpl_error_code gravi_flatten_vis(gravi_data *vis_data, gravi_data *calib_data)
Use PCA model to flatten observed visphi. The flattened data are added to the existing VIS table.
gravi_data * gravi_average_dark(gravi_data **data, cpl_size ndata)
Average several DARK calibration map.
gravi_data * gravi_compute_dark(gravi_data *raw_data)
Compute the DARK calibration map.
int gravi_data_patch(gravi_data *file_to_patch, cpl_frameset *patch_frameset)
Load a RAW FITS file and create a gravi_data.
cpl_error_code gravi_data_clean_for_astro(gravi_data *data)
Clean the data to keep only OIFITS extensions related to SC.
gravi_data * gravi_data_load_frame(cpl_frame *frame, cpl_frameset *used_frameset)
Load a FITS file and create a gravi_data.
cpl_error_code gravi_data_detector_cleanup(gravi_data *data, const cpl_parameterlist *parlist)
Perform self-bias correction to the SC raw data.
gravi_data * gravi_data_load_rawframe(cpl_frame *frame, cpl_frameset *used_frameset)
Load a RAW FITS file and create a gravi_data.
cpl_error_code gravi_data_move_ext(gravi_data *output, gravi_data *input, const char *name)
Move extensions from one data to another.
cpl_error_code gravi_data_append(gravi_data *first, const gravi_data *second, int force)
Append a gravi_data into another existing one.
cpl_error_code gravi_data_save_new(gravi_data *self, cpl_frameset *allframes, const char *filename, const char *suffix, const cpl_parameterlist *parlist, cpl_frameset *usedframes, cpl_frame *frame, const char *recipe, cpl_propertylist *applist, const char *proCatg)
Save a gravi data in a CPL-complian FITS file.
cpl_error_code gravi_data_copy_ext_insname(gravi_data *output, gravi_data *input, const char *name, const char *insname)
Copy extensions from one data to another.
void gravi_data_delete(gravi_data *self)
Delete a gravi data.
cpl_frameset * gravi_frameset_extract_met_pos(cpl_frameset *frameset)
cpl_parameter * gravi_parameter_add_astro_file(cpl_parameterlist *self)
int gravi_param_get_bool(const cpl_parameterlist *parlist, const char *name)
cpl_parameter * gravi_parameter_add_static_name(cpl_parameterlist *self)
cpl_parameter * gravi_parameter_add_p2vmred_file(cpl_parameterlist *self)
cpl_parameter * gravi_parameter_add_metrology(cpl_parameterlist *self)
cpl_error_code gravi_parameter_add_rejection(cpl_parameterlist *self, int isCalib)
Add rejection parameters to the input parameter list.
cpl_frameset * gravi_frameset_extract_fringe_data(cpl_frameset *frameset)
cpl_error_code gravi_parameter_add_compute_snr(cpl_parameterlist *self)
cpl_parameter * gravi_parameter_add_biasmethod(cpl_parameterlist *self)
cpl_frameset * gravi_frameset_extract_patch(cpl_frameset *frameset)
cpl_parameter * gravi_parameter_add_average_vis(cpl_parameterlist *self)
cpl_frameset * gravi_frameset_extract_wave_map(cpl_frameset *frameset)
const char * gravi_param_get_string(const cpl_parameterlist *parlist, const char *name)
cpl_frameset * gravi_frameset_extract_bad_map(cpl_frameset *frameset)
cpl_parameter * gravi_parameter_add_pca(cpl_parameterlist *self)
Add pca parameters to the input parameter list.
cpl_parameter * gravi_parameter_add_spectrum_file(cpl_parameterlist *self)
cpl_frameset * gravi_frameset_extract_pca_calib(cpl_frameset *frameset)
cpl_frameset * gravi_frameset_extract_dark_map(cpl_frameset *frameset)
cpl_error_code gravi_dfs_set_groups(cpl_frameset *set)
Set the group as RAW or CALIB in a frameset.
cpl_parameter * gravi_parameter_add_preproc_file(cpl_parameterlist *self)
cpl_frameset * gravi_frameset_extract_p2vm_map(cpl_frameset *frameset)
cpl_frameset * gravi_frameset_extract_sky_data(cpl_frameset *frameset)
cpl_frameset * gravi_frameset_extract_static_param(cpl_frameset *frameset)
cpl_error_code gravi_parameter_add_compute_vis(cpl_parameterlist *self, int isCalib)
cpl_parameter * gravi_parameter_add_biassub_file(cpl_parameterlist *self)
cpl_frameset * gravi_frameset_extract_flat_map(cpl_frameset *frameset)
cpl_frameset * gravi_frameset_extract_eop_map(cpl_frameset *frameset)
cpl_frameset * gravi_frameset_extract_diamcat_map(cpl_frameset *frameset)
cpl_frameset * gravi_frameset_extract_disp_map(cpl_frameset *frameset)
void gravity_print_banner(void)
cpl_frameset * gravi_frameset_extract_dark_data(cpl_frameset *frameset)
Extract DARK_RAW frame from the input frameset.
cpl_error_code gravi_parameter_add_compute_signal(cpl_parameterlist *self)
cpl_error_code gravi_compute_pointing_uv(gravi_data *p2vmred_data, gravi_data *eop_data)
Compute the pointing directions and projected baselines in OI_VIS.
cpl_error_code gravi_metrology_reduce(gravi_data *data, gravi_data *eop_data, gravi_data *static_param_data, gravi_data *met_pos, const cpl_parameterlist *parlist)
Reduce the metrology.
cpl_error_code gravi_compute_qc_injection(gravi_data *data)
Compute the QC for the injection stability.
cpl_error_code gravi_compute_tau0(gravi_data *data)
Compute the QC TAU0 parameter.
cpl_error_code gravi_compute_opdc_state(gravi_data *p2vmred_data)
Compute the real-time tracking state from OPDC.
gravi_data * gravi_compute_p2vmred(gravi_data *preproc_data, gravi_data *p2vm_map, const char *mode, const cpl_parameterlist *parlist)
Converts preprocessed data into coherent fluxes using the P2VM.
cpl_error_code gravi_compute_qc_ft_opd_estimator(gravi_data *p2vmred_data)
Compute the QC for the FT linearity.
cpl_parameter * gravi_pfits_get_extrapixel_param(const cpl_propertylist *header)
Extract parameters from a product header.
double gravi_pfits_get_mjd(const cpl_propertylist *plist)
cpl_error_code gravi_align_spectrum(gravi_data *spectrum_data, gravi_data *wave_map, gravi_data *p2vm_map, enum gravi_detector_type det_type)
Regrid the regions into a common wavelength (in-place)
gravi_data * gravi_extract_spectrum(gravi_data *raw_data, gravi_data *profile_map, gravi_data *dark_map, gravi_data *bad_map, gravi_data *sky_map, const cpl_parameterlist *parlist, enum gravi_detector_type det_type)
Create the SPECTRUM gravi_data with extracted spectrum per region.
cpl_error_code gravi_subtract_met_dark(gravi_data *preproc_data, gravi_data *dark_map)
Substract metrology dark.
cpl_error_code gravi_compute_snr(gravi_data *p2vmred_data, const cpl_parameterlist *parlist)
Compute real-time SNR and Group-Delay of the observation.
cpl_error_code gravi_compute_signals(gravi_data *p2vmred_data, gravi_data *disp_data, const cpl_parameterlist *parlist)
Create intermediate signal in the P2VMREDUCED file.
cpl_error_code gravi_compute_outliers(gravi_data *p2vmred_data, const cpl_parameterlist *parlist)
Compute the outliers flags.
cpl_error_code gravi_compute_rejection(gravi_data *p2vmred_data, const cpl_parameterlist *parlist)
Create rejection flags P2VMREDUCED file.
cpl_error_code gravi_copy_p2vm_qcs(gravi_data *p2vmred_data, cpl_propertylist *plist)
Copy PFACTOR and VFACTOR QCs so that they may be aggregated over all frames.
cpl_error_code gravi_compute_tf_qc(gravi_data *oi_vis, gravi_data *diamcat_data)
Fill QC parameters related to transfer function.
const char * gravi_get_license(void)
Get the pipeline copyright and license.
cpl_error_code gravi_normalize_sc_to_ft(gravi_data *vis_data)
Align the SC visibilities on the FT visibilities.
gravi_data * gravi_compute_vis(gravi_data *p2vmred_data, const cpl_parameterlist *parlist, cpl_size *current_frame)
The function average the individual frames of a P2VMREDUCED file into a final, single observation per...
cpl_error_code gravi_vis_force_time(gravi_data *oi_data)
Force all data in OI_TABLE to have the same TIME and MJD.
cpl_error_code gravi_vis_mjd_to_time(gravi_data *vis_data)
Recompute the TIME column of all OIFITS extension from the MJD column, following the OIFITS standard ...
cpl_error_code gravi_vis_copy_fluxdata(gravi_data *oi_data, int delete_flux)
Duplicate the column FLUX into FLUXDATA, for OIFITS2 compliance.
cpl_error_code gravi_compute_vis_qc(gravi_data *vis_data, cpl_frameset *frameset, cpl_propertylist **frame_qcs, cpl_size nb_frame, char *input_data_type)
Compute the QC parameters for a VIS (averaged) data.
cpl_error_code gravi_flat_flux(gravi_data *vis_data, gravi_data *p2vm_map)
Divide the OI_FLUX by OI_FLUX from the P2VM (no checks, no time distance...)
cpl_error_code gravi_average_vis(gravi_data *oi_data)
Coadd the observations together.
cpl_error_code gravi_wave_correct_color(gravi_data *vis_data)
Create a OI_WAVELENGTH_CORR table with color corrected wavelength.