38#include "eris_ifu_error.h"
39#include <eris_ifu_jitter_interface.h>
40#include <eris_ifu_stdstar_static.h>
41#include <eris_ifu_jitter_static.h>
42#include <eris_ifu_lambda_corr.h>
43#include <eris_ifu_resample.h>
44#include <eris_ifu_strehl.h>
45#include <eris_ifu_extract_spec_static.h>
46#include <eris_ifu_efficiency_response.h>
47#include <eris_utils.h>
54#define CONTEXT "eris.eris_ifu_pupil"
56static const char eris_ifu_pupil_description[] =
"\
57This recipe monitors the telescope pupil position.\n\
59When an OH_SPEC file is provided in the SOF the recipe will use the OH lines\n\
60to correct the lambda calibration.\n\
62-----------------------------------------------------------------------------\n\
64 DO CATG Explanation Required #Frames\n\
65 ------- ----------- -------- -------\n\
66 science exposures with corresponding sky exposures: \n\
67 PUPIL_LAMP or PUPIL_SKY On exposure Y ? \n\
69 and calibration frames: \n\
70 DISTORTION Table with distortion correction pars. Y 1 \n\
71 WAVE_MAP Wavelength calibration map Y 1 \n\
72 OH_SPEC Vector holding OH lines (note 4) Y 1 \n\
73 MASTER_DARK Optional master dark image N [0,1]\n\
74 MASTER_FLAT Optional master flat image N [0,1]\n\
75 BPM_DARK Optional bad pixel mask (note 1 & 3) N [0,1]\n\
76 BPM_FLAT Optional bad pixel mask (note 2 & 3) N [0,1]\n\
77 BPM_LINEARITY Optional bad pixel mask (note 3) N [0,1]\n\
78 EXTCOEFF_TABLE Table with atmospheric extinction N [0,1]\n\
80 and only in case of old SINFONIE way of distortion correction:\n\
81 DISTANCES Table with slitlet distances \n\
82 with cube.slitlet-detection=\"DIST\" Y 1 \n\
83 SLITLET_POS Table with slitlet edge positions \n\
84 with cube.slitlet-detection=\"EDGE\" Y 1 \n\
87 DO CATG Explanation Product Depth\n\
88 ------- ------------------------------------------- -------------\n\
89 OBJECT_CUBE reconstructed object expoure (note 5) PD_AUX\n\
90 SKY_CUBE reconstructed sky exposure (note 6) PD_AUX\n\
92Note 1) When BPM_DARK is provided this will be used as hot bad pixel mask.\n\
93 Otherwise the qualiiy extension of MASTER_DARK will be used.\n\
94Note 2 When BPM_FLAT is provided this will be used as cold bad pixel mask.\n\
95 Otherwise the qualiiy extension of MASTER_FLAT will be used.\n\
96Note 3) All BPMs will be ORed.\n\
97Note 4) OH_SPEC can be a FITS file holding a single OH spectrum in the primary\n\
98 HDU or a FITS file with several extensions each of them holding an OH spectrum\n\
99 for one of the bands J,H,K,HK.\n\
100 The pipeline package provides the file eris_oh_spec.fits holding OH spectra\n\
103Information on relevant parameters may be found with\n\
104 esorex --params "REC_NAME_PUPIL
"\n\
105 esorex --help "REC_NAME_PUPIL
"\n\
108ESO QC LAMBDA SHIFT UM OH based shift of the central wavelength in [um]\n\
109ESO QC LAMBDA SHIFT PIXEL OH based shift of the central wavelength in [pixel]\n\
116cpl_recipe_define(eris_ifu_pupil, ERIS_BINARY_VERSION,
"Erich Wiezorrek",
117 PACKAGE_BUGREPORT,
"2019",
118 "This recipe reconstruct data cubes from std stars exposures",
119 eris_ifu_pupil_description);
121#define RECIPE_NAME "eris_ifu_pupil"
137static cpl_error_code eris_ifu_pupil_fill_parameterlist(cpl_parameterlist *pl)
139 cpl_error_code err = CPL_ERROR_NONE;
145 REC_NAME_PUPIL, M_PUPIL, pl));
148 REC_NAME_PUPIL, M_PUPIL, pl));
150 err = cpl_error_get_code();
184static int eris_ifu_pupil(cpl_frameset *frameset,
185 const cpl_parameterlist * parlist)
189 const char* required_tags[1] = {
190 ERIS_IFU_CALIB_OH_SPEC
193 cpl_ensure_code(CPL_ERROR_NONE ==
194 eris_dfs_check_input_tags(frameset, required_tags, ntags, 1),
195 CPL_ERROR_ILLEGAL_INPUT);
198 cpl_frame* flat_frame = NULL;
199 cpl_frameset* frameset_noflat = NULL;
205 flat_frame = cpl_frameset_find(frameset, ERIS_IFU_CALIB_FLATFIELD);
206 if (flat_frame != NULL) {
208 frameset_noflat = cpl_frameset_duplicate(frameset);
209 cpl_frameset_erase(frameset_noflat,ERIS_IFU_CALIB_FLATFIELD);
216 if (flat_frame != NULL) {
217 cpl_frameset_delete(frameset_noflat);
220 return (
int)cpl_error_get_code();
#define BRK_IF_ERROR(function)
If function is or returns an error != CPL_ERROR_NONE, then the try-block is exited.
#define TRY
Beginning of a TRY-block.
#define CATCH
End of a TRY-block, beginning of a CATCH-block.
cpl_error_code eris_ifu_stdstar_fill_common_parameterlist(const char *recipeName, jitterModes jitterMode, cpl_parameterlist *pl)
Fill parameter list with standard star-specific parameters.
cpl_error_code eris_ifu_jitter_fill_common_parameterlist(const char *recipeName, jitterModes jitterMode, cpl_parameterlist *pl)
Fill parameter list with common jitter recipe parameters.
cpl_error_code eris_stdstar_reduction_common(cpl_frameset *frameset, const cpl_parameterlist *parlist, cpl_boolean apply_flat_field, const char *context, const char *recipe_name)
Main standard star data reduction pipeline orchestration function.
cpl_error_code eris_check_error_code(const char *func_id)
handle CPL errors