ERIS Pipeline Reference Manual 1.8.14
eris_ifu_combine_static.h
1
2#ifndef ERISP_ERIS_ERIS_IFU_COMBINE_STATIC_H_
3#define ERISP_ERIS_ERIS_IFU_COMBINE_STATIC_H_
4
5#ifdef HAVE_CONFIG_H
6#include <config.h>
7#endif
8
9#define MAX_NAME_SIZE 512
10#define KEY_NAME_MJD_OBS "MJD-OBS"
11
12/* Number of tabulations in kernel */
13#define TABSPERPIX (1000)
14#define KERNEL_WIDTH (2.0)
15#define KERNEL_SAMPLES (1+(int)(TABSPERPIX * KERNEL_WIDTH))
16#define TANH_STEEPNESS (5.0)
17
18#define EXTNAME_DATA "DATA"
19#define EXTNAME_DQ "CONTRIB"
20#define EXTNAME_ERROR "ERROR"
21#define EXTNAME_DATA_COMMENT "This extension contains data values"
22#define EXTNAME_ERROR_COMMENT "This extension contains data errors"
23#define EXTNAME_DQ_COMMENT "This extension contains contribution values in seconds"
24
25/*-----------------------------------------------------------------------------
26 Includes
27 -----------------------------------------------------------------------------*/
28
29#include <cpl.h>
30#include "hdrl.h"
31#include <stdbool.h>
32#include <eris_ifu_vector.h>
33cpl_error_code eris_ifu_combine_jittered_images(
34 cpl_image **imagesData,
35 cpl_image **imagesError,
36 int size_x,
37 int size_y,
38 cpl_image **mergedImageData,
39 cpl_image **mergedImageError,
40 cpl_image **mergedImageDIT,
41 int n_cubes,
42 const float *offsetx,
43 const float *offsety,
44 const double *exptimes,
45 const double kappa,
46 const char *compute_mode,
47 const int pclip);
48
49cpl_error_code eris_ifu_combine_divide_DIT(
50 cpl_imagelist **cubesData,
51 const int n_cubes,
52 const double *exptimes);
53
54cpl_error_code eris_ifu_combine_auto_size_cube(
55 const float *offsetx,
56 const float *offsety,
57 const int nframes,
58 float *ref_offx,
59 float *ref_offy,
60 int *size_x,
61 int *size_y);
62
63cpl_error_code eris_ifu_combine_build_mask(
64 cpl_imagelist **cubesDataShifted,
65 cpl_image *mergedImgDIT,
66 const int n_cubes,
67 const int *llx,
68 const int *lly,
69 const double *exptimes);
70
71cpl_error_code eris_ifu_combine_build_mask_cube(
72 cpl_image **imagesDataShifted,
73 cpl_image **mergedCubeDIT_img,
74 const int *llx,
75 const int *lly,
76 const double *exptimes,
77 int n_cubes,
78 cpl_size nx_out,
79 cpl_size ny_out);
80
81cpl_error_code eris_ifu_combine_coadd_ks_clip(
82 const int n_cubes,
83 const double kappa,
84 int *llx,
85 int *lly,
86 const double *exptimes,
87 cpl_image **mergedCubeData_img,
88 cpl_image **mergedCubeError_img,
89 cpl_image *mergedCubeDIT_img,
90 cpl_image **imagesDataShifted,
91 cpl_image **imagesErrorShifted,
92 const char *compute_mode,
93 const int pclip, const int nx_out, const int ny_out);
94
95cpl_error_code eris_ifu_combine_coadd_ks_clip_internal(cpl_image **cubesDataShifted,
96 const int n_frames,
97 const int n_contributions,
98 const int x, const int y,
99 int *llx, int *lly,
100 const double kappa,
101 cpl_vector **msk,
102 const char *compute_mode,
103 const int pclip);
104
105cpl_error_code eris_ifu_combine_coadd(const int n_cubes, cpl_image **imgMergedCubeData,
106 cpl_image **imgMergedCubeError,
107 cpl_image *mergedImgDIT,
108 cpl_image **cubesDataShifted,
109 cpl_image **cubesErrorShifted,
110 const double *exptimes,
111 int *llx,
112 int *lly,
113 const char *compute_mode, const int nx_out, const int ny_out);
114
115int eris_ifu_combine_calc_contributions(cpl_image **cubesDataShifted,
116 const int n_cubes,
117 const int *llx, const int *lly,
118 const int x, const int y);
119
120cpl_error_code eris_ifu_combine_subtract_background(
121 cpl_image *img,
122 bool *warn);
123
124void eris_ifu_combine_get_xy_min_max(
125 const int nframes,
126 const float *offsetx, const float *offsety,
127 float *min_offx, float *max_offx,
128 float *min_offy, float *max_offy);
129
130int eris_ifu_combine_nearest_int(
131 const double x);
132
133cpl_image* eris_ifu_combine_shift_image(
134 const cpl_image *img_in,
135 const double shift_x,
136 const double shift_y,
137 const double *kernel);
138
139void eris_ifu_combine_convert_0_to_NaN_img(
140 cpl_image *img);
141
142double eris_ifu_combine_calc_error(
143 eris_ifu_vector *data_vec,
144 eris_ifu_vector *error_vec,
145 const char *compute_mode);
146
147cpl_error_code eris_ifu_combine_read_image_planes(
148 const cpl_frameset *frameset,
149 cpl_image **imagesData,
150 cpl_image **imagesError,
151 int z,
152 int edge_trim,
153 bool subtract_background);
154
155int eris_ifu_combine_min_cube_size(const cpl_frameset *fs);
156
157/* --- simple shifting from KMOS pipeline --- */
158
177enum extrapolationType {
178 NONE_NANS,
179 NONE_CLIPPING,
180 BCS_NATURAL,
181 BCS_ESTIMATED,
182 RESIZE_NANS,
183 RESIZE_BCS_NATURAL,
184 RESIZE_BCS_ESTIMATED
185};
186
187cpl_image *eris_ifu_combine_shift_image_kmos(const cpl_image *img_in,
188 double xshift,
189 double yshift,
190 const char *method,
191 const enum extrapolationType extrapolation);
192
193#endif