ERIS Pipeline Reference Manual 1.9.2
eris_ifu_jitter_static.h
1/* $Id$
2 *
3 * This file is part of the ERIS Pipeline
4 * Copyright (C) 2002,2003 European Southern Observatory
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef ERISP_ERIS_ERIS_IFU_JITTER_STATIC_H_
22#define ERISP_ERIS_ERIS_IFU_JITTER_STATIC_H_
23
24#ifdef HAVE_CONFIG_H
25#include <config.h>
26#endif
27
28/*-----------------------------------------------------------------------------
29 Includes
30 -----------------------------------------------------------------------------*/
31
32#include <time.h>
33#include <math.h>
34#include <gsl/gsl_interp2d.h>
35
36#include <cpl.h>
37#include <hdrl.h>
38#include "eris_ifu_functions.h"
39#include "eris_ifu_jitter_interface.h"
40#include "eris_ifu_extract_spec_static.h"
41
42/*-----------------------------------------------------------------------------
43 Define
44 -----------------------------------------------------------------------------*/
45
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}
54cubeType;
55
56/*
57struct cubesStruct {
58 int cubeCnt;
59 cpl_imagelist **cube;
60 cpl_propertylist **header;
61};
62*/
63
64/*-----------------------------------------------------------------------------
65 Functions prototypes
66 -----------------------------------------------------------------------------*/
67
68/*----------------------------------------------------------------------------*/
69
70cpl_error_code eris_ifu_jitter_process_exposures(struct sofStruct *sof,
71 struct stdParamStruct stdParams,
72 struct paramStruct params,
73 cpl_frameset *frameset,
74 const cpl_parameterlist * parlist,
75 const char* recipe_name,
76 const char* context);
77
78cpl_error_code eris_ifu_jitter_process_cubes(struct sofStruct *sof,
79 struct stdParamStruct stdParams,
80 struct paramStruct params,
81 cpl_frameset *frameset,
82 const cpl_parameterlist * parlist,
83 const char* recipe_name,
84 cubeType *obj_type);
85
87 cpl_image *resampledDetImage,
88 slitletDetectionModes mode,
89 int fineTuneMode,
90 double firstCol,
91 cpl_vector *distancesV,
92 cpl_bivector *positionsVV);
93
95 skyTweakModes sky_tweak,
96 int sofIdx,
97 struct sofStruct *sof,
98 productDepthType productDepth);
99
100hdrl_imagelist *eris_ifu_jitter_build_cube(
101 hdrl_image *image,
102 int sofIdx,
103 struct sofStruct *sof,
104 struct paramStruct params,
105 bool doVelocityCorrection,
106 cpl_polynomial *ohLambdaCorrection,
107 productDepthType productDepth);
108
109cpl_error_code eris_ifu_extract_spec(
110 const cpl_imagelist *data_in,
111 const cpl_imagelist *noise_in,
112 cpl_image *mask,
113 cpl_vector **spec_data_out,
114 cpl_vector **spec_noise_out);
115
116cubeType
117eris_ifu_jitter_get_obj_type(sofModes mode);
118cubeType
119eris_ifu_jitter_get_sky_type(sofModes mode);
120cubeType
122cpl_error_code
123eris_ifu_jitter_get_procatg_and_filename(cubeType type, char **proCatg,
124 char **filenamePrefix);
125
126void eris_ifu_jitter_free_sofStruct(struct sofStruct* sof_struct);
127
128cpl_error_code
129eris_ifu_jitter_extract(cpl_frameset * frameset,
130 const cpl_parameterlist * parlist, cubeType obj_type, const char* pcatg,
131 struct stdParamStruct stdParams, const char* recipe_name,
132 const char* context);
133cpl_error_code
135 cubeType obj_type,
136 cpl_frameset* frames,
137 struct esParamStruct params,
138 struct esSofStruct *sof);
139
141 const cpl_parameterlist * parlist,
142 struct esParamStruct *params,
143 const char* context);
144
145cpl_error_code eris_ifu_dar_correction(hdrl_imagelist *cube,
146 cpl_propertylist *hdr,
147 int method,
148 double radius,
149 int length);
150
151cpl_error_code eris_ifu_dar_cpl_shift(
152 cpl_image *inImg,
153 cpl_image *out1Img,
154 cpl_image *out2Img,
155 double xShift,
156 double yShift,
157 cpl_kernel kernelType,
158 double width,
159 cpl_size kernelSize);
160
161cpl_error_code eris_ifu_dar_gsl_shift(
162 cpl_image *inImg,
163 cpl_image *outImg,
164 double xShift,
165 double yShift,
166 const gsl_interp2d_type *T);
167
168void
170
171cpl_error_code
172eris_frameset_duplicate_cube_tag(cpl_frameset* frameset, const char* pcatg, cpl_boolean apply_flat);
173int
174eris_frameset_count_tag(cpl_frameset * sof, const char* tag);
175
177 struct sofStruct *sof);
178
179#endif
180
181
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.