21#ifndef ERISP_ERIS_ERIS_IFU_JITTER_STATIC_H_
22#define ERISP_ERIS_ERIS_IFU_JITTER_STATIC_H_
34#include <gsl/gsl_interp2d.h>
38#include "eris_ifu_functions.h"
39#include "eris_ifu_jitter_interface.h"
40#include "eris_ifu_extract_spec_static.h"
46typedef enum {OBJECT_CUBE, STD_CUBE, PSF_CUBE, STD_FLUX_CUBE, SKY_OBJECT_CUBE,
47 SKY_STD_CUBE, SKY_PSF_CUBE, SKY_STD_FLUX_CUBE, TWEAKED_CUBE, TWEAKED_STD_CUBE,
48 DAR_CUBE, DAR_STD_CUBE, DAR_PSF_CUBE, DAR_STD_FLUX_CUBE, PUPIL_CUBE,
49 JITTER_CUBE, BPM_CUBE, STD_CUBE_NOFLAT, STD_FLUX_CUBE_NOFLAT,
50 OBJECT_CUBE_COADD, TWEAKED_CUBE_COADD, DAR_CUBE_COADD,DAR_STD_CUBE_COADD,
51 DAR_PSF_CUBE_COADD, DAR_PUPIL_CUBE_COADD, STD_CUBE_COADD,
52 PSF_CUBE_COADD, STD_FLUX_CUBE_COADD, PUPIL_CUBE_COADD,
53 STD_FLUX_CUBE_COADD_NOFLAT, STD_CUBE_COADD_NOFLAT}
71 struct stdParamStruct stdParams,
72 struct paramStruct params,
73 cpl_frameset *frameset,
74 const cpl_parameterlist * parlist,
75 const char* recipe_name,
79 struct stdParamStruct stdParams,
80 struct paramStruct params,
81 cpl_frameset *frameset,
82 const cpl_parameterlist * parlist,
83 const char* recipe_name,
87 cpl_image *resampledDetImage,
88 slitletDetectionModes mode,
91 cpl_vector *distancesV,
92 cpl_bivector *positionsVV);
95 skyTweakModes sky_tweak,
97 struct sofStruct *sof,
98 productDepthType productDepth);
103 struct sofStruct *sof,
104 struct paramStruct params,
105 bool doVelocityCorrection,
106 cpl_polynomial *ohLambdaCorrection,
107 productDepthType productDepth);
110 const cpl_imagelist *data_in,
111 const cpl_imagelist *noise_in,
113 cpl_vector **spec_data_out,
114 cpl_vector **spec_noise_out);
124 char **filenamePrefix);
130 const cpl_parameterlist * parlist, cubeType obj_type,
const char* pcatg,
131 struct stdParamStruct stdParams,
const char* recipe_name,
132 const char* context);
136 cpl_frameset* frames,
137 struct esParamStruct params,
138 struct esSofStruct *sof);
141 const cpl_parameterlist * parlist,
142 struct esParamStruct *params,
143 const char* context);
146 cpl_propertylist *hdr,
157 cpl_kernel kernelType,
159 cpl_size kernelSize);
166 const gsl_interp2d_type *T);
177 struct sofStruct *sof);
cpl_error_code eris_ifu_jitter_process_cubes(struct sofStruct *sof, struct stdParamStruct stdParams, struct paramStruct params, cpl_frameset *frameset, const cpl_parameterlist *parlist, const char *recipe_name, cubeType *obj_type)
Process and combine data cubes with sky tweaking and DAR correction.
cpl_error_code eris_ifu_dar_gsl_shift(cpl_image *inImg, cpl_image *outImg, double xShift, double yShift, const gsl_interp2d_type *T)
Apply DAR correction using GSL 2D interpolation.
cpl_error_code eris_ifu_jitter_extract_spec_processSof(cubeType obj_type, cpl_frameset *frames, struct esParamStruct params, struct esSofStruct *sof)
Process SOF for spectral extraction.
void eris_ifu_jitter_free_sofStruct(struct sofStruct *sof_struct)
Free and clean up SOF structure and all contained data.
cubeType eris_ifu_jitter_get_sky_type(sofModes mode)
Get sky cube type from SOF observation mode.
cpl_error_code eris_ifu_jitter_extract(cpl_frameset *frameset, const cpl_parameterlist *parlist, cubeType obj_type, const char *pcatg, struct stdParamStruct stdParams, const char *recipe_name, const char *context)
Main spectral extraction function.
cpl_error_code eris_frameset_duplicate_cube_tag(cpl_frameset *frameset, const char *pcatg, cpl_boolean apply_flat)
Duplicate a cube file with different PRODCATG for coadded version.
void eris_ifu_jitter_get_cube_type_string(cubeType type)
Print cube type as string to log.
cpl_error_code eris_ifu_update_wcs_with_OCS_keywords(struct sofStruct *sof)
Update WCS coordinates from OCS cumulative offset keywords.
cpl_error_code eris_ifu_extract_spec(const cpl_imagelist *data_in, const cpl_imagelist *noise_in, cpl_image *mask, cpl_vector **spec_data_out, cpl_vector **spec_noise_out)
Extract a spectrum from 3D data cube.
cpl_error_code eris_ifu_jitter_get_procatg_and_filename(cubeType type, char **proCatg, char **filenamePrefix)
Get the value of the PRO.CATG and the filename as function of the type of cube.
hdrl_image * eris_ifu_jitter_subtract_background(skyTweakModes sky_tweak, int sofIdx, struct sofStruct *sof, productDepthType productDepth)
Subtract sky or dark background from raw exposure image.
cubeType eris_ifu_jitter_get_obj_type(sofModes mode)
Get object cube type from SOF observation mode.
cpl_imagelist * eris_ifu_jitter_reconstruct_cube(cpl_image *resampledDetImage, slitletDetectionModes mode, int fineTuneMode, double firstCol, cpl_vector *distancesV, cpl_bivector *positionsVV)
Function to create a 3D-data cube from a re-sampled image.
cpl_error_code eris_ifu_jitter_process_exposures(struct sofStruct *sof, struct stdParamStruct stdParams, struct paramStruct params, cpl_frameset *frameset, const cpl_parameterlist *parlist, const char *recipe_name, const char *context)
Process all raw exposures into calibrated 3D data cubes.
cpl_error_code eris_ifu_dar_cpl_shift(cpl_image *inImg, cpl_image *out1Img, cpl_image *out2Img, double xShift, double yShift, cpl_kernel kernelType, double width, cpl_size kernelSize)
Apply DAR correction using CPL image shifting.
hdrl_imagelist * eris_ifu_jitter_build_cube(hdrl_image *image, int sofIdx, struct sofStruct *sof, struct paramStruct params, bool doVelocityCorrection, cpl_polynomial *ohLambdaCorrection, productDepthType productDepth)
Build 3D data cube from 2D detector image.
int eris_frameset_count_tag(cpl_frameset *sof, const char *tag)
Count frames with specified tag in frameset.
cpl_error_code eris_ifu_dar_correction(hdrl_imagelist *cube, cpl_propertylist *hdr, int method, double radius, int length)
Apply Differential Atmospheric Refraction (DAR) correction.
cpl_error_code eris_ifu_extract_spec_fetch_params(const cpl_parameterlist *parlist, struct esParamStruct *params, const char *context)
Fetch spectral extraction parameters from parameter list.
cubeType eris_ifu_jitter_get_coadd_obj_type(cubeType type)
Convert cube type to corresponding coadded cube type.