44#if defined(__linux__) && defined(__GLIBC__)
75static int gravity_vis(cpl_frameset *, cpl_parameterlist *);
80static char gravity_vis_short[] =
"Compute the visibilities from raw observation of OBJECT.";
82 "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."
84 "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"
86 "* Load the input file (loop on input OBJECT files)\n"
87 "* Extract the spectra (use BAD, DARK, SKY, FLAT files)\n"
88 "* Interpolate the spectra into a common wavelength table (use WAVE file)\n"
89 "* Compute the real-time visibilities (use P2VM file)\n"
90 "* Compute additional real-time signals (SNR, GDELAY...)\n"
91 "* Compute selection flags (= flag frames with SNR lower than threshold, vFactor lower than threshold...)\n"
92 "* Average the real-time visibilities, considering the selection flag\n"
93 "* Write the product\n"
109 GRAVI_SPECTRUM" (opt) : intermediate product (see detailled description of data)\n"
110 GRAVI_PREPROC" (opt) : intermediate product (see detailled description of data)\n"
130 cpl_recipe * recipe = cpl_calloc(1,
sizeof *recipe );
131 cpl_plugin * plugin = &recipe->interface;
133 if (cpl_plugin_init(plugin,
135 GRAVI_BINARY_VERSION,
136 CPL_PLUGIN_TYPE_RECIPE,
140 "Nabih Azouaoui, Vincent Lapeyrere, JB. Le Bouquin",
146 cpl_msg_error(cpl_func,
"Plugin initialization failed");
147 (void)cpl_error_set_where(cpl_func);
151 if (cpl_pluginlist_append(list, plugin)) {
152 cpl_msg_error(cpl_func,
"Error adding plugin to list");
153 (void)cpl_error_set_where(cpl_func);
175 if (cpl_error_get_code() != CPL_ERROR_NONE) {
176 cpl_msg_error(cpl_func,
"%s():%d: An error is already set: %s",
177 cpl_func, __LINE__, cpl_error_get_where());
178 return (
int)cpl_error_get_code();
181 if (plugin == NULL) {
182 cpl_msg_error(cpl_func,
"Null plugin");
183 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
187 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
188 cpl_msg_error(cpl_func,
"Plugin is not a recipe");
189 cpl_ensure_code(0, (
int)CPL_ERROR_TYPE_MISMATCH);
193 recipe = (cpl_recipe *)plugin;
196 recipe->parameters = cpl_parameterlist_new();
197 if (recipe->parameters == NULL) {
198 cpl_msg_error(cpl_func,
"Parameter list allocation failed");
199 cpl_ensure_code(0, (
int)CPL_ERROR_ILLEGAL_OUTPUT);
236 p = cpl_parameter_new_value (
"gravity.vis.flat-flux", CPL_TYPE_BOOL,
237 "Normalize the flux (stored in OI_FLUX binary extension) with "
238 "instrument transmission recorded in the \n"
239 "input P2VM calibration map. Consequently, the flux quantity is either "
240 "the intensity level recorded \n"
241 "in the detector, thus including the instrument transmission (FALSE); "
242 "or the intensity level at the instrument entrance (TRUE).",
243 "gravity.vis", FALSE);
244 cpl_parameter_set_alias (p, CPL_PARAMETER_MODE_CLI,
"flat-flux");
245 cpl_parameter_disable (p, CPL_PARAMETER_MODE_ENV);
246 cpl_parameterlist_append (recipe->parameters, p);
249 p = cpl_parameter_new_value (
"gravity.preproc.average-sky", CPL_TYPE_BOOL,
250 "Average the SKYs into a master SKY. If FALSE, the recipe loops\n "
251 "over the SKY to reduce each OBJECT with a different SKY",
252 "gravity.preproc", FALSE);
253 cpl_parameter_set_alias (p, CPL_PARAMETER_MODE_CLI,
"average-sky");
254 cpl_parameter_disable (p, CPL_PARAMETER_MODE_ENV);
255 cpl_parameterlist_append (recipe->parameters, p);
258 p = cpl_parameter_new_value (
"gravity.test.reduce-acq-cam", CPL_TYPE_BOOL,
259 "If TRUE, reduced ACQ_CAM images",
260 "gravity.test", FALSE);
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;
411 int nb_frame, nb_sky;
418 cpl_error_get_code()) ;
440 if ( cpl_frameset_get_size (p2vmcalib_frameset) !=1 ||
441 cpl_frameset_get_size (wavecalib_frameset) !=1 ||
442 cpl_frameset_get_size (flatcalib_frameset) !=1 ||
443 cpl_frameset_get_size (badcalib_frameset) != 1 ||
444 cpl_frameset_get_size (recipe_frameset) < 1 ||
445 (cpl_frameset_is_empty (dark_frameset) &&
446 cpl_frameset_is_empty (darkcalib_frameset) &&
447 cpl_frameset_is_empty (sky_frameset)) ) {
448 cpl_error_set_message (cpl_func, CPL_ERROR_ILLEGAL_INPUT,
449 "Illegal number of P2VM, FLAT, WAVE, BAD, DARK or SKY, OBJECT file on the frameset");
450 cpl_error_set_message (cpl_func, CPL_ERROR_ILLEGAL_INPUT,
451 "See online help: esorex --man gravity_vis");
457 cpl_parameter *phase_ref = cpl_parameterlist_find (parlist,
"gravity.vis.phase-ref-sc");
458 cpl_parameter *output_phase = cpl_parameterlist_find (parlist,
"gravity.vis.output-phase-sc");
460 if (strcmp (cpl_parameter_get_string(phase_ref),
"SELF_REF") != 0) {
461 cpl_msg_warning (cpl_func,
"VISPHI flattening requires phase-ref-sc=SELF_REF, forcing");
462 cpl_parameter_set_string (phase_ref,
"SELF_REF");
465 if (strcmp (cpl_parameter_get_string(output_phase),
"SELF_VISPHI") != 0) {
466 cpl_msg_warning (cpl_func,
"VISPHI flattening requires output-phase-sc=SELF_VISPHI, forcing");
467 cpl_parameter_set_string (output_phase,
"SELF_VISPHI");
472 used_frameset = cpl_frameset_new();
478 if (!cpl_frameset_is_empty (dark_frameset)) {
480 frame = cpl_frameset_get_position (dark_frameset, 0);
493 NULL, frame,
"gravity_vis",
498 else if (!cpl_frameset_is_empty (darkcalib_frameset)) {
500 frame = cpl_frameset_get_position (darkcalib_frameset, 0);
506 cpl_msg_info (cpl_func,
"There is no DARK in the frame set");
509 frame = cpl_frameset_get_position (badcalib_frameset, 0);
513 frame = cpl_frameset_get_position (flatcalib_frameset, 0);
517 frame = cpl_frameset_get_position (wavecalib_frameset, 0);
521 frame = cpl_frameset_get_position (p2vmcalib_frameset, 0);
524 cpl_parameterlist_append(parlist, param_extrapixel);
527 if (!cpl_frameset_is_empty (dispcalib_frameset)) {
528 frame = cpl_frameset_get_position (dispcalib_frameset, 0);
532 cpl_msg_info (cpl_func,
"There is no DISP_MODEL in the frameset");
535 if (!cpl_frameset_is_empty (metpos_frameset)) {
536 frame = cpl_frameset_get_position (metpos_frameset, 0);
540 cpl_msg_info (cpl_func,
"There is no DIODE_POSITION in the frameset");
543 if ( !cpl_frameset_is_empty (eop_frameset) ) {
544 frame = cpl_frameset_get_position (eop_frameset, 0);
548 cpl_msg_info (cpl_func,
"There is no EOP_PARAM in the frameset");
552 if (!cpl_frameset_is_empty (static_param_frameset)) {
553 frame = cpl_frameset_get_position (static_param_frameset, 0);
557 cpl_msg_info (cpl_func,
"There is no STATIC_PARAM in the frameset");
560 if ( !cpl_frameset_is_empty (diamcat_frameset) ) {
561 frame = cpl_frameset_get_position (diamcat_frameset, 0);
565 cpl_msg_info (cpl_func,
"There is no DIAMETER_CAT in the frameset");
567 if ( !cpl_frameset_is_empty (pcacalib_frameset)) {
568 frame = cpl_frameset_get_position (pcacalib_frameset, 0);
571 cpl_msg_info (cpl_func,
"There is no PHASE_PCA in the frameset");
579 frame_tag = cpl_frame_get_tag (cpl_frameset_get_position (recipe_frameset, 0));
585 mode = cpl_sprintf (
"gravi_dual");
591 mode = cpl_sprintf (
"gravi_dual");
597 mode = cpl_sprintf (
"gravi_single");
603 mode = cpl_sprintf (
"gravi_single");
606 cpl_error_set_message (cpl_func, CPL_ERROR_ILLEGAL_INPUT,
607 "Cannot recognize the input DO.CATG");
611 cpl_msg_info (cpl_func,
"Mode of the first frame is: %s (will be used for all frames)", mode);
621 nb_sky = cpl_frameset_get_size (sky_frameset);
622 sky_maps = cpl_calloc (CPL_MAX(nb_sky,1),
sizeof(
gravi_data*));
624 for (
int isky = 0; isky < nb_sky; isky++){
627 cpl_msg_info (cpl_func,
" ***** SKY %d over %d ***** ", isky+1, nb_sky);
628 frame = cpl_frameset_get_position (sky_frameset, isky);
640 if (averageSky == 0) {
641 char filename_suffix[20];
642 snprintf(filename_suffix, 16,
"%d", isky);
644 parlist, NULL, frame,
"gravity_vis",
654 if (averageSky == 1) {
655 cpl_msg_info (cpl_func,
"Do a MASTER SKY from the %d skys", nb_sky);
662 parlist, sky_frameset,
663 cpl_frameset_get_position (sky_frameset, 0),
664 "gravity_vis", NULL, skyCatg);
668 cpl_frameset_join (used_frameset, sky_frameset);
669 for (
int isky = 0; isky < nb_sky; isky++)
671 sky_maps[0] = msky_map;
679 nb_frame = cpl_frameset_get_size (recipe_frameset);
681 for (
int ivis = 0; ivis < nb_frame; ivis++){
683 char filename_suffix[20];
684 snprintf(filename_suffix, 16,
"%d", ivis);
685 current_frameset = cpl_frameset_duplicate (used_frameset);
687 cpl_msg_info (cpl_func,
" ***** OBJECT %d over %d ***** ", ivis+1, nb_frame);
692 isky = nb_sky>0 ? ivis % nb_sky : 0;
696 cpl_msg_info (cpl_func,
"There is no SKY in the frameset");
698 else if (averageSky) {
700 cpl_msg_info (cpl_func,
"Use MASTER SKY (already reduced)");
704 cpl_msg_info (cpl_func,
"Use SKY %i over %i (already reduced)", isky+1, nb_sky);
705 frame = cpl_frameset_get_position (sky_frameset, isky);
708 cpl_frameset_insert (current_frameset, cpl_frame_duplicate (frame));
715 frame = cpl_frameset_get_position (recipe_frameset, ivis);
724 current_frameset, frame,
"gravity_vis",
725 NULL,
"BIAS_SUBTRACTED");
732 cpl_msg_warning (cpl_func,
"Shutter problem in the OBJECT");
737 badpix_map, sky_maps[isky],
744 parlist, current_frameset, frame,
756 parlist, current_frameset, frame,
770 parlist, current_frameset, frame,
777 cpl_boolean subtract_met_dark = dark_map != NULL && cpl_parameter_get_bool(
778 cpl_parameterlist_find_const(parlist,
"gravity.metrology.use-dark-offsets"));
780 if (subtract_met_dark)
805 gravi_reduce_acqcam (p2vmred_data, preproc_data, sky_maps[isky], dark_map, static_param_data);
854 CPLCHECK_MSG (
"Cannot compute rejection flags signals");
860 parlist, current_frameset, frame,
861 "gravity_vis", NULL, redCatg);
867 cpl_size current_frame = 0;
868 while (current_frame >= 0)
877 cpl_msg_info (cpl_func,
"Force same time for all quantities/baselines");
890 if (vis_data == NULL) {
891 vis_data = tmpvis_data; tmpvis_data = NULL;
905 parlist, current_frameset, frame,
912 FREE (cpl_frameset_delete, current_frameset);
926 cpl_msg_info (cpl_func,
"Computing QC parameters for visibilities");
936 cpl_msg_info (cpl_func,
"Flatten the FLUX with the internal P2VM spectrum");
941 cpl_msg_info (cpl_func,
"Don't flatten the FLUX with the internal P2VM spectrum");
948 cpl_msg_info (cpl_func,
"Align the SC visibilities on the FT");
952 cpl_msg_info (cpl_func,
"Don't align the SC visibilities on the FT");
957 cpl_msg_info (cpl_func,
"Compute the wavelength shift due to target color");
961 cpl_msg_info (cpl_func,
"Don't compute the wavelength shift due to target color");
969 cpl_msg_info (cpl_func,
"Don't average the different observation (if any)");
977 cpl_frameset_join (used_frameset, recipe_frameset);
978 frame = cpl_frameset_get_position (recipe_frameset, 0);
984 used_frameset, frame,
"gravity_vis", NULL, proCatg);
1012 FREE (cpl_frameset_delete,darkcalib_frameset);
1013 FREE (cpl_frameset_delete,wavecalib_frameset);
1014 FREE (cpl_frameset_delete,flatcalib_frameset);
1015 FREE (cpl_frameset_delete,badcalib_frameset);
1016 FREE (cpl_frameset_delete,p2vmcalib_frameset);
1017 FREE (cpl_frameset_delete,metpos_frameset);
1018 FREE (cpl_frameset_delete,dark_frameset);
1019 FREE (cpl_frameset_delete,diamcat_frameset);
1020 FREE (cpl_frameset_delete,sky_frameset);
1021 FREE (cpl_frameset_delete,dispcalib_frameset);
1022 FREE (cpl_frameset_delete,pcacalib_frameset);
1023 FREE (cpl_frameset_delete,eop_frameset);
1024 FREE (cpl_frameset_delete,patch_frameset);
1025 FREE (cpl_frameset_delete,static_param_frameset);
1026 FREE (cpl_frameset_delete,recipe_frameset);
1027 FREE (cpl_frameset_delete,current_frameset);
1028 FREE (cpl_frameset_delete,used_frameset);
1029 FREE (cpl_free,proCatg);
1030 FREE (cpl_free,redCatg);
1031 FREE (cpl_free,skyCatg);
1032 FREE (cpl_free,mode);
1041#if defined(__linux__) && defined(__GLIBC__)
1047 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_reduce_acqcam(gravi_data *output_data, gravi_data *input_data, gravi_data *sky_data, gravi_data *dark_data, gravi_data *static_param_data)
Reduce the ACQ camera images.
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_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.
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_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_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_compute_vis_qc(gravi_data *vis_data, cpl_frameset *frameset)
The function compute the QC parameters for a VIS (averaged) data.
cpl_error_code gravi_wave_correct_color(gravi_data *vis_data)
Create a OI_WAVELENGTH_CORR table with color corrected wavelength.