66static int gravity_p2vm(cpl_frameset *,
const cpl_parameterlist *);
72static char gravity_p2vm_short[] =
"Calibrate the instrument bad pixels, wavelength table, interferometric contrast and phase.";
74"This recipe reduces the internal calibrations. As a special sequence of shutter opening is required, it is advised to always build the SOF with a complete sequence of files obtained within a single execution of the p2vm calibration template. However it is still possible to input a SOF with DARK_RAW only, or DARK_RAW and FLAT_RAW only. It is also possible to input a SOF with some already processed calibration (e.g WAVE).\n"
76 "* Compute the dark, write product\n"
77 "* Compute the flat, write product\n"
78 "* Compute the badpixels, write product\n"
79 "* Compute the spectral calibration, write product\n"
80 "* Compute the p2vm, write product\n"
83 GRAVI_FLAT_RAW" x4 : raw flats, one shutter open (DPR.TYPE=FLAT)\n"
84 GRAVI_P2VM_RAW" x6 : raw p2vms, two shutters open (DPR.TYPE=P2VM)\n"
85 GRAVI_WAVE_RAW" : raw wavelength calibration for FT (DPR.TYPE=WAVE)\n"
112 cpl_recipe * recipe = cpl_calloc(1,
sizeof *recipe );
113 cpl_plugin * plugin = &recipe->interface;
115 if (cpl_plugin_init(plugin,
117 GRAVI_BINARY_VERSION,
118 CPL_PLUGIN_TYPE_RECIPE,
122 "Nabih Azouaoui, Vincent Lapeyrere, JB. Le Bouquin",
128 cpl_msg_error(cpl_func,
"Plugin initialization failed");
129 (void)cpl_error_set_where(cpl_func);
133 if (cpl_pluginlist_append(list, plugin)) {
134 cpl_msg_error(cpl_func,
"Error adding plugin to list");
135 (void)cpl_error_set_where(cpl_func);
157 if (cpl_error_get_code() != CPL_ERROR_NONE) {
158 cpl_msg_error(cpl_func,
"%s():%d: An error is already set: %s",
159 cpl_func, __LINE__, cpl_error_get_where());
160 return (
int)cpl_error_get_code();
163 if (plugin == NULL) {
164 cpl_msg_error(cpl_func,
"Null plugin");
165 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
169 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
170 cpl_msg_error(cpl_func,
"Plugin is not a recipe");
171 cpl_ensure_code(0, (
int)CPL_ERROR_TYPE_MISMATCH);
175 recipe = (cpl_recipe *)plugin;
178 recipe->parameters = cpl_parameterlist_new();
179 if (recipe->parameters == NULL) {
180 cpl_msg_error(cpl_func,
"Parameter list allocation failed");
181 cpl_ensure_code(0, (
int)CPL_ERROR_ILLEGAL_OUTPUT);
211 p = cpl_parameter_new_enum (
"gravity.calib.phase-calibration", CPL_TYPE_STRING,
212 "This option changes the phase reference of the P2VM:\n "
213 "NONE defines phiA(lbd) at zero for all baselines "
214 "(P2VM calibrates only the internal phase-shift of the beam combiner);\n "
215 "CLOSURE defines phiA(lbd) at zero for baselines 01, 02 and 03 "
216 "(P2VM calibrates the phase-shift and the closure-phase of the beam combiner);\n "
217 "DISP defines phiA(lbd) to have zero mean and minimum GD for baselines (01,02,03); "
218 "(P2VM calibrates the phase-shift, the closure-phase and the "
219 "spectral-dispersion of the beam combiner);\n "
220 "FULL defines phiA(lbd) to have zero-GD for baselines (01,02,03)",
221 "(P2VM calibrates the full phase with respect to zero-astrometry);\n "
222 "gravi.p2vm",
"FULL", 4,
"NONE",
"CLOSURE",
"DISP",
"FULL");
223 cpl_parameter_set_alias (p, CPL_PARAMETER_MODE_CLI,
"phase-calibration");
224 cpl_parameter_disable (p, CPL_PARAMETER_MODE_ENV);
225 cpl_parameterlist_append (recipe->parameters, p);
242 cpl_errorstate initial_errorstate = cpl_errorstate_get();
245 if (cpl_error_get_code() != CPL_ERROR_NONE) {
246 cpl_msg_error(cpl_func,
"%s():%d: An error is already set: %s",
247 cpl_func, __LINE__, cpl_error_get_where());
248 return (
int)cpl_error_get_code();
251 if (plugin == NULL) {
252 cpl_msg_error(cpl_func,
"Null plugin");
253 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
257 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
258 cpl_msg_error(cpl_func,
"Plugin is not a recipe");
259 cpl_ensure_code(0, (
int)CPL_ERROR_TYPE_MISMATCH);
263 recipe = (cpl_recipe *)plugin;
266 if (recipe->parameters == NULL) {
267 cpl_msg_error(cpl_func,
"Recipe invoked with NULL parameter list");
268 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
270 if (recipe->frames == NULL) {
271 cpl_msg_error(cpl_func,
"Recipe invoked with NULL frame set");
272 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
276 recipe_status =
gravity_p2vm(recipe->frames, recipe->parameters);
279 if (cpl_dfs_update_product_header(recipe->frames)) {
280 if (!recipe_status) recipe_status = (int)cpl_error_get_code();
283 if (!cpl_errorstate_is_equal(initial_errorstate)) {
286 cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
289 return recipe_status;
303 if (plugin == NULL) {
304 cpl_msg_error(cpl_func,
"Null plugin");
305 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
309 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
310 cpl_msg_error(cpl_func,
"Plugin is not a recipe");
311 cpl_ensure_code(0, (
int)CPL_ERROR_TYPE_MISMATCH);
315 recipe = (cpl_recipe *)plugin;
317 cpl_parameterlist_delete(recipe->parameters);
332 const cpl_parameterlist * parlist)
334 cpl_frameset * p2vm_frameset=NULL, * wavecalib_frameset=NULL, * darkcalib_frameset=NULL,
335 * flatcalib_frameset=NULL, * dark_frameset=NULL, * wave_frameset=NULL, * wavesc_frameset=NULL,
336 * badcalib_frameset=NULL, * flat_frameset=NULL, * used_frameset=NULL, * current_frameset=NULL,
337 * wave_param_frameset=NULL;
339 cpl_frame * frame=NULL, * frame_p2vm=NULL;
341 gravi_data * p2vm_map=NULL, * data=NULL, * dark_map=NULL, * wave_map=NULL,
342 * profile_map=NULL, * badpix_map=NULL, * wave_param=NULL;
348 int nb_frame, nb_frame_gain = 0;
350 cpl_propertylist * met_plist=NULL;
351 int ** valid_trans = cpl_malloc (2 *
sizeof (
int*));
352 int ** valid_CP = cpl_malloc (2 *
sizeof (
int*));
353 char ext_regexp[500];
356 for (
int i = 0 ; i < 2; i++){
357 valid_trans[i] = cpl_calloc (4,
sizeof (
int));
358 valid_CP[i] = cpl_calloc (6,
sizeof (
int));
370 used_frameset = cpl_frameset_new ();
375 if ( cpl_frameset_get_size (dark_frameset) +
376 cpl_frameset_get_size (darkcalib_frameset) !=1) {
377 cpl_error_set_message (cpl_func, CPL_ERROR_ILLEGAL_INPUT,
378 "Either a single DARK or DARK_RAW needs to be in the frameset");
384 if ( cpl_frameset_is_empty (badcalib_frameset) && cpl_frameset_is_empty (dark_frameset) &&
385 cpl_frameset_is_empty (darkcalib_frameset) ) {
386 cpl_error_set_message (cpl_func, CPL_ERROR_ILLEGAL_INPUT,
"Missing DARK or BAD on the frameset");
393 if ( cpl_frameset_is_empty (flat_frameset) &&
394 cpl_frameset_is_empty (flatcalib_frameset) ) {
395 cpl_error_set_message (cpl_func, CPL_ERROR_ILLEGAL_INPUT,
"Missing FLAT on the frameset");
403 if ( cpl_frameset_is_empty (wave_frameset) &&
404 cpl_frameset_is_empty (wavecalib_frameset) ) {
405 cpl_error_set_message (cpl_func, CPL_ERROR_ILLEGAL_INPUT,
"Missing WAVE on the frameset");
411 if ( cpl_frameset_get_size (p2vm_frameset) !=6) {
412 cpl_error_set_message (cpl_func, CPL_ERROR_ILLEGAL_INPUT,
"Illegal number of P2VM on the frameset");
418 if ( cpl_frameset_is_empty (wave_param_frameset) ) {
419 cpl_error_set_message (cpl_func, CPL_ERROR_ILLEGAL_INPUT,
"Missing WAVE_PARAM static calibration file");
427 if (!cpl_frameset_is_empty (dark_frameset)) {
428 cpl_msg_info (cpl_func,
" ***** Compute DARK map ***** ");
431 frame = cpl_frameset_get_position (dark_frameset, 0);
443 NULL, frame,
"gravity_p2vm",
448 else if (!cpl_frameset_is_empty (darkcalib_frameset)) {
452 frame = cpl_frameset_get_position (darkcalib_frameset, 0);
458 cpl_frameset_insert (dark_frameset, cpl_frame_duplicate (frame));
466 if (!cpl_frameset_is_empty (badcalib_frameset)) {
467 cpl_msg_info (cpl_func,
" ***** Get BAD pixel map ***** ");
470 frame = cpl_frameset_get_position (badcalib_frameset, 0);
473 else if (!cpl_frameset_is_empty (dark_frameset) &&
474 !cpl_frameset_is_empty (flat_frameset)) {
475 cpl_msg_info (cpl_func,
" ***** Compute BAD pixel map from DARK and FLAT_RAW ***** ");
478 nb_frame_gain = cpl_frameset_get_size (flat_frameset);
479 raw_data = cpl_calloc (nb_frame_gain,
sizeof(
gravi_data *));
482 for (
int i = 0; i < nb_frame_gain; i++) {
483 frame = cpl_frameset_get_position (flat_frameset, i);
490 nb_frame_gain, parlist);
492 CPLCHECK_CLEAN(
"Cannot compute the BAD pixel from DARK and FLAT");
495 frame = cpl_frameset_get_position (dark_frameset, 0);
497 NULL, frame,
"gravity_p2vm",
509 if (!cpl_frameset_is_empty(flatcalib_frameset)) {
513 frame = cpl_frameset_get_position (flatcalib_frameset, 0);
516 else if (!cpl_frameset_is_empty (flat_frameset)) {
517 cpl_msg_info (cpl_func,
" ***** Compute FLAT map ***** ");
521 if (!badpix_map || !dark_map) {
522 ERROR_CLEAN (CPL_ERROR_ILLEGAL_INPUT,
"Missing DARK or BAD in frameset");
526 nb_frame_gain = cpl_frameset_get_size (flat_frameset);
527 raw_data = cpl_malloc (nb_frame_gain *
sizeof(
gravi_data *));
530 for (
int i = 0; i < nb_frame_gain; i++) {
531 frame = cpl_frameset_get_position (flat_frameset, i);
542 cpl_propertylist * gain_header;
548 cpl_propertylist_append (profile_header, gain_header);
549 FREE (cpl_propertylist_delete, gain_header);
552 frame = cpl_frameset_get_position (flat_frameset, 0);
555 used_frameset, frame,
"gravity_p2vm",
568 if (!cpl_frameset_is_empty (wave_param_frameset)) {
569 frame = cpl_frameset_get_position (wave_param_frameset, 0);
573 cpl_msg_error (cpl_func,
"There is no WAVE_PARAM in the frameset (did you forget the static calibration files?)");
575 if (!cpl_frameset_is_empty (wavecalib_frameset)) {
579 frame = cpl_frameset_get_position (wavecalib_frameset, 0);
582 else if (!cpl_frameset_is_empty (wave_frameset)) {
583 cpl_msg_info (cpl_func,
" ***** Process the WAVE_RAW ***** ");
586 if ( !badpix_map || !profile_map || !dark_map) {
587 ERROR_CLEAN (CPL_ERROR_ILLEGAL_INPUT,
"Missing DARK, FLAT, or BAD in frameset");
594 frame = cpl_frameset_get_position (wave_frameset, 0);
602 cpl_msg_info (cpl_func,
"Extract SC SPECTRUM for WAVE_RAW");
612 cpl_msg_info (cpl_func,
"Extract FT SPECTRUM for WAVE_RAW");
629 cpl_msg_info (cpl_func,
"Compute the P2VM_MET from WAVE_RAW");
651 used_frameset, frame,
"gravity_p2vm",
661 if (!cpl_frameset_is_empty (wavesc_frameset)) {
666 cpl_msg_info (cpl_func,
" ***** Process the WAVESC_RAW ***** ");
669 frame = cpl_frameset_get_position (wavesc_frameset, 0);
676 cpl_msg_info (cpl_func,
"Extract SC SPECTRUM for WAVESC_RAW");
686 cpl_msg_info (cpl_func,
"Extract FT SPECTRUM for WAVESC_RAW");
714 parlist, used_frameset, frame,
"gravity_p2vm",
719 cpl_msg_warning (cpl_func,
"No WAVESC_RAW in the SOF:"
720 " SC wavelength will be inaccurate");
736 used_frameset, frame,
"gravity_p2vm",
747 if ( cpl_frameset_is_empty (p2vm_frameset) ) {
748 cpl_msg_info (cpl_func,
"All RAW data reduced... stop recipe");
753 if ( !badpix_map || !profile_map || !wave_map || !dark_map) {
754 ERROR_CLEAN (CPL_ERROR_ILLEGAL_INPUT,
"Missing DARK, FLAT, BAD, or WAVE in frameset");
758 if ( !cpl_frameset_is_empty (flat_frameset) )
759 cpl_frameset_join (p2vm_frameset, flat_frameset);
761 if ( !cpl_frameset_is_empty (wave_frameset) )
762 cpl_frameset_join (p2vm_frameset, wave_frameset);
765 nb_frame = cpl_frameset_get_size (p2vm_frameset);
768 if (nb_frame != 11) {
769 ERROR_CLEAN (CPL_ERROR_ILLEGAL_INPUT,
"Missing P2VM in frameset");
779 cpl_msg_info (cpl_func,
" ***** Create the P2VM ***** ");
784 for (
int i = 0; i < nb_frame; i++) {
786 cpl_msg_info (cpl_func,
" ***** file %d over %d ***** ", i+1, nb_frame );
787 current_frameset = cpl_frameset_duplicate (used_frameset);
790 frame = cpl_frameset_get_position (p2vm_frameset, i);
791 cpl_frameset_insert (used_frameset, cpl_frame_duplicate (frame));
806 cpl_msg_info (cpl_func,
"Use this frame for the P2VM product");
816 cpl_msg_info (cpl_func,
"Nothing to be done with the file... yet.");
819 FREE (cpl_frameset_delete, current_frameset);
871 current_frameset, frame,
"gravity_p2vm",
878 cpl_msg_info(cpl_func,
"Execution time to delete preproc_data : %f s",
879 (clock() - start) / (
double)CLOCKS_PER_SEC);
882 FREE (cpl_frameset_delete, current_frameset);
899 cpl_msg_info (cpl_func,
" ***** Analyse the WAVE file to calibrate the internal closure and transmission ***** ");
902 if (!cpl_frameset_is_empty (wavesc_frameset)) {
904 frame = cpl_frameset_get_position (wave_frameset, 0);
906 frame = cpl_frameset_get_position (wave_frameset, 0);
956 p2vm_map,
"gravi_single", parlist);
978 cpl_msg_info (cpl_func,
"P2VM phases are kept to zero (option phase-calibration=NONE)");
991 cpl_msg_info(cpl_func,
"storing bad pixel mask for TAC");
1002 used_frameset, frame_p2vm,
"gravity_p2vm",
1014 FREE (cpl_frameset_delete, dark_frameset);
1015 FREE (cpl_frameset_delete, darkcalib_frameset);
1016 FREE (cpl_frameset_delete, badcalib_frameset);
1022 FREE (cpl_propertylist_delete, met_plist);
1023 FREE (cpl_frameset_delete, wavecalib_frameset);
1024 FREE (cpl_frameset_delete, flatcalib_frameset);
1025 FREE (cpl_frameset_delete, flat_frameset);
1026 FREE (cpl_frameset_delete, wave_frameset);
1027 FREE (cpl_frameset_delete, wavesc_frameset);
1028 FREE (cpl_frameset_delete, used_frameset);
1035 FREELOOP (cpl_free, valid_trans, 2);
1037 FREE (cpl_frameset_delete, p2vm_frameset);
1038 FREE (cpl_frameset_delete, current_frameset);
1039 FREE (cpl_frameset_delete, wave_param_frameset);
1043 return (
int)cpl_error_get_code();
typedefCPL_BEGIN_DECLS struct _gravi_data_ gravi_data
#define gravi_data_get_header(data)
#define GRAVI_RECIPE_OUTPUT
#define GRAVI_RECIPE_FLOW
#define GRAVI_RECIPE_INPUT
cpl_msg_info(cpl_func, "Compute WAVE_SCAN for %s", GRAVI_TYPE(type_data))
#define GRAVI_IMAGING_DETECTOR_FT_EXT
#define GRAVI_IMAGING_DATA_FT_EXT
#define GRAVI_OI_FLUX_EXT
#define GRAVI_IMAGING_DATA_SC_EXT
#define GRAVI_SPECTRUM_DATA_FT_EXT
#define GRAVI_P2VM_MET_EXT
#define GRAVI_ARRAY_GEOMETRY_EXT
#define GRAVI_IMAGING_DETECTOR_SC_EXT
#define GRAVI_METROLOGY_EXT
#define GRAVI_OI_WAVELENGTH_EXT
#define GRAVI_OPTICAL_TRAIN_EXT
#define gravi_data_check_shutter(data, t0, t1, t2, t3)
#define CPLCHECK_CLEAN(msg)
#define gravi_msg_function_exit(flag)
#define FREE(function, variable)
#define ERROR_CLEAN(code, msg)
#define gravi_msg_function_start(flag)
#define gravi_data_get_shutter(data, tel)
#define FREELOOP(function, variable, n)
static char gravity_p2vm_short[]
static char gravity_p2vm_description[]
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.
static int gravity_p2vm_destroy(cpl_plugin *)
Destroy what has been created by the 'create' function.
static int gravity_p2vm_exec(cpl_plugin *)
Execute the plugin instance given by the interface.
static int gravity_p2vm(cpl_frameset *, const cpl_parameterlist *)
Compute the DARK, BAD, FLAT, WAVE, P2VM from a list of calibration set.
static int gravity_p2vm_create(cpl_plugin *)
Setup the recipe options
cpl_propertylist * gravi_compute_gain(gravi_data **flats_data, int nrawgain, gravi_data *dark_map)
Compute mean detector gain.
gravi_data * gravi_compute_profile(gravi_data **flats_data, gravi_data *dark_map, gravi_data *bad_map, int nflat, const cpl_parameterlist *params)
Computes the spatial profile of each spectrum for optimal extraction purpose.
gravi_data * gravi_compute_dark(gravi_data *raw_data)
Compute the DARK calibration map.
gravi_data * gravi_compute_badpix(gravi_data *dark_map, gravi_data **flats_data, int nflat, const cpl_parameterlist *params)
Identify the bad pixels in the DARK map and create the BAD map.
gravi_data * gravi_data_new(int nb_ext)
Create an empty gravi_data.
cpl_error_code gravi_data_add_table(gravi_data *self, cpl_propertylist *plist, const char *extname, cpl_table *table)
Add a BINTABLE extension in gravi_data.
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.
cpl_table * gravi_data_get_table(gravi_data *self, const char *extname)
Return a pointer on a table extension by its EXTNAME.
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_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(gravi_data *output, gravi_data *input, const char *name)
Copy extensions from one data to another.
gravi_data * gravi_data_load_rawframe_ext(cpl_frame *frame, cpl_frameset *used_frameset, const char *extensions_regexp)
Load a RAW FITS file and create a gravi_data from specified extensions.
void gravi_data_delete(gravi_data *self)
Delete a gravi data.
cpl_parameter * gravi_parameter_add_debug_file(cpl_parameterlist *self)
cpl_frameset * gravi_frameset_extract_wavesc_data(cpl_frameset *frameset)
cpl_parameter * gravi_parameter_add_profile(cpl_parameterlist *self)
Add profile parameters to the input parameter list.
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_metrology(cpl_parameterlist *self)
cpl_parameter * gravi_parameter_add_extract(cpl_parameterlist *self)
cpl_parameter * gravi_parameter_add_biasmethod(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_parameter * gravi_parameter_add_wave(cpl_parameterlist *self)
Add wavelength calibration parameters to the input parameter list.
cpl_frameset * gravi_frameset_extract_bad_map(cpl_frameset *frameset)
cpl_frameset * gravi_frameset_extract_flat_data(cpl_frameset *frameset)
cpl_frameset * gravi_frameset_extract_wave_data(cpl_frameset *frameset)
cpl_frameset * gravi_frameset_extract_dark_map(cpl_frameset *frameset)
cpl_frameset * gravi_frameset_extract_p2vm_data(cpl_frameset *frameset)
Extract P2VM_RAW frame from the input 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_parameter * gravi_parameter_add_badpix(cpl_parameterlist *self)
Add badpix parameters to the input parameter list.
cpl_frameset * gravi_frameset_extract_wave_param(cpl_frameset *frameset)
cpl_frameset * gravi_frameset_extract_flat_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_table * gravi_metrology_compute_p2vm(cpl_table *metrology_table, double wave_met)
Calibrate the P2VM of the metrology.
cpl_error_code gravi_p2vm_phase_correction(gravi_data *p2vm_map, gravi_data *p2vmred_data, int full_phase)
Correct the phase of the P2VM from internal closure-phases.
cpl_error_code gravi_p2vm_normalisation(gravi_data *p2vm_map, int **valid_trans, int **valid_pair)
The given output FITS file contain a p2vm table with the values of the transmission,...
cpl_error_code gravi_compute_p2vm(gravi_data *p2vm_map, gravi_data *preproc_data, int **valid_trans, int **valid_pair, enum gravi_detector_type det_type)
The given output FITS file contain a p2vm table with the values of the transmission,...
cpl_error_code gravi_p2vm_transmission(gravi_data *p2vm_map, gravi_data *p2vmred_data)
Compute the flux normalisation in the P2VM.
gravi_data * gravi_create_p2vm(gravi_data *wave_map, gravi_data *wave_param)
Create a new P2VM map.
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.
double gravi_pfits_get_met_wavelength_mean(const cpl_propertylist *plist, cpl_table *met_table)
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.
const char * gravi_get_license(void)
Get the pipeline copyright and license.
cpl_error_code gravi_wave_compute_opds(gravi_data *spectrum_data, cpl_table *met_table, const cpl_parameterlist *parlist)
Recover the OPD modulation from a spectrum_data and vismet_table.
cpl_error_code gravi_compute_wave(gravi_data *wave_map, gravi_data *spectrum_data, int type_data, const cpl_parameterlist *parlist, gravi_data *wave_param)
Create the WAVE calibration map.
cpl_error_code gravi_wave_qc(gravi_data *wave_map, gravi_data *profile_map)
Compute the QC parameters of the WAVE product.