DETMON Pipeline Reference Manual  1.2.7
detmon.h
1 /* $Id: detmon.h,v 1.3 2013-01-25 16:08:41 jtaylor Exp $
2  *
3  * This file is part of the irplib package
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 02111-1307 USA
19  */
20 
21 /*
22  * $Author: jtaylor $
23  * $Date: 2013-01-25 16:08:41 $
24  * $Revision: 1.3 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef IRPLIB_DETMON_H
29 #define IRPLIB_DETMON_H
30 
31 /*----------------------------------------------------------------------------
32  Includes
33  ----------------------------------------------------------------------------*/
34 
35 #include <cpl.h>
36 #include <detmon_cpl_size.h>
37 
38 /*----------------------------------------------------------------------------
39  Prototypes
40  ----------------------------------------------------------------------------*/
41 
42 
43 #define NIR TRUE
44 #define OPT FALSE
45 
46 #define DETMON_QC_FREQ "ESO QC FREQ"
47 #define DETMON_QC_FREQ_C "Spectrum frequency"
48 
49 #define DETMON_QC_POW "ESO QC POW"
50 #define DETMON_QC_POW_C "Spectrum power"
51 
52 #define DETMON_QC_DUTYCYCL "ESO QC DUTYCYCL"
53 #define DETMON_QC_DUTYCYCL_C "DUTYCYCL value (time to store a frame)"
54 
55 #define DETMON_QC_MASTER_MEAN "ESO QC MASTER MEAN"
56 #define DETMON_QC_MASTER_MEAN_C "Master Mean value"
57 
58 #define DETMON_QC_MASTER_RMS "ESO QC MASTER RMS"
59 #define DETMON_QC_MASTER_RMS_C "Master RMS value"
60 
61 #define DETMON_QC_NBCOLDPIX "ESO QC NBCOLPIX"
62 #define DETMON_QC_NBCOLDPIX_C "Number of cold pixels"
63 
64 #define DETMON_QC_NBHOTPIX "ESO QC NBHOTPIX"
65 #define DETMON_QC_NBHOTPIX_C "Number of hot pixels"
66 
67 #define DETMON_QC_NBDEVPIX "ESO QC NBDEVPIX"
68 #define DETMON_QC_NBDEVPIX_C "Number of deviating pixels"
69 
70 #define DETMON_QC_BIAS_RANDOM_VAL "ESO QC BIAS RANDOM VAL"
71 #define DETMON_QC_BIAS_RANDOM_VAL_C "Bias level (random sampling method) [ADU]"
72 
73 #define DETMON_QC_BIAS_RANDOM_RON "ESO QC BIAS RANDOM RON"
74 #define DETMON_QC_BIAS_RANDOM_RON_C "Bias Read Out Noise (random sampling method) [ADU]"
75 
76 #define DETMON_QC_BIAS_HISTO_VAL "ESO QC BIAS HISTO VAL"
77 #define DETMON_QC_BIAS_HISTO_VAL_C "Bias level (histogram method) [ADU]"
78 
79 #define DETMON_QC_BIAS_HISTO_RON "ESO QC BIAS HISTO RON"
80 #define DETMON_QC_BIAS_HISTO_RON_C "Bias Read Out Noise (histogram method) [e- rms]"
81 
82 #define DETMON_QC_BIAS_PRESCAN_MEAN "ESO QC BIAS PRESCAN MEAN"
83 #define DETMON_QC_BIAS_PRESCAN_MEAN_C "Bias mean level (on prescan region) [ADU]"
84 
85 #define DETMON_QC_BIAS_PRESCAN_MED "ESO QC BIAS PRESCAN MED"
86 #define DETMON_QC_BIAS_PRESCAN_MED_C "Bias median level (on prescan region) [ADU]"
87 
88 #define DETMON_QC_BIAS_PRESCAN_RON "ESO QC BIAS PRESCAN RON"
89 #define DETMON_QC_BIAS_PRESCAN_RON_C "Bias Read Out Noise (on prescan region) [e- rms]"
90 
91 
92 #define DETMON_QC_BIAS_OVERSCAN_MEAN "ESO QC BIAS OVERSCAN MEAN"
93 #define DETMON_QC_BIAS_OVERSCAN_MEAN_C "Bias mean level (on overscan region) [ADU]"
94 
95 #define DETMON_QC_BIAS_OVERSCAN_MED "ESO QC BIAS OVERSCAN MED"
96 #define DETMON_QC_BIAS_OVERSCAN_MED_C "Bias median level (on overscan region) [ADU]"
97 
98 #define DETMON_QC_BIAS_OVERSCAN_RON "ESO QC BIAS OVERSCAN RON"
99 #define DETMON_QC_BIAS_OVERSCAN_RON_C "Bias Read Out Noise (on overscan region) [e- rms]"
100 
101 #define DETMON_QC_BIAS_REGION_VAL "ESO QC BIAS REGION VAL"
102 #define DETMON_QC_BIAS_REGION_VAL_C "Bias level (on user defined region) [ADU]"
103 
104 #define DETMON_QC_BIAS_REGION_MED "ESO QC BIAS REGION MED"
105 #define DETMON_QC_BIAS_REGION_MED_C "Bias median level (on user defined region) [ADU]"
106 
107 #define DETMON_QC_BIAS_REGION_RON "ESO QC BIAS REGION RON"
108 #define DETMON_QC_BIAS_REGION_RON_C "Bias Read Out Noise (on user defined region) [e- rms]"
109 
110 
111 #define DETMON_QC_DARK "ESO QC DARK"
112 #define DETMON_QC_DARK_C "Dark level [ADU]"
113 
114 #define DETMON_QC_DARK_STDEV "ESO QC DARK STDEV"
115 #define DETMON_QC_DARK_STDEV_C "Dark stdev level [ADU]"
116 
117 
118 
119 /* Macros to generate the recipe(s) description(s) */
120 #define detmon_ronbias_get_description(RECIPE_NAME, PIPE_NAME, \
121  DETMON_RONBIAS_RAW) \
122  RECIPE_NAME " -- " PIPE_NAME " ronbias recipe for OPT/IR.\n" \
123  "The files listed in the Set Of Frames must be tagged:\n" \
124  "raw-file.fits "DETMON_RONBIAS_RAW"\n"
125 
126 #define detmon_pernoise_get_description(RECIPE_NAME, PIPE_NAME, \
127  DETMON_PERNOISE_RAW) \
128  RECIPE_NAME " -- " PIPE_NAME " Recipe for Periodic Noise Characterisation.\n" \
129  "The files listed in the Set Of Frames must be tagged:\n" \
130  "raw-file.fits "DETMON_PERNOISE_RAW"\n"
131 
132 #define detmon_dark_get_description(RECIPE_NAME, PIPE_NAME, \
133  DETMON_DARK_RAW) \
134  RECIPE_NAME " -- " PIPE_NAME " Dark Recipe.\n" \
135  "The files listed in the Set Of Frames must be tagged:\n" \
136  "raw-file.fits "DETMON_DARK_RAW"\n"
137 
138 #define RANDOM ((irplib_ronbias_method) 1 << 1)
139 #define HISTO ((irplib_ronbias_method) 1 << 2)
140 #define PREOVERSCAN ((irplib_ronbias_method) 1 << 3)
141 #define REGION ((irplib_ronbias_method) 1 << 4)
142 
143 typedef unsigned long irplib_ronbias_method;
144 
145 #undef REGEXP
146 #define REGEXP "ARCFILE|MJD-OBS|ESO TPL ID|DATE-OBS|ESO DET DIT|ESO DET NDIT"
147 
148 
149 cpl_image *
150 irplib_imagelist_collapse_stdev_create(const cpl_imagelist * imlist);
151 
152 cpl_error_code
153 detmon_ronbias(cpl_frameset *,
154  const cpl_parameterlist *,
155  const char *,
156  const char *,
157  const char *,
158  const char *,
159  const cpl_propertylist *,
160  const cpl_propertylist *,
161  const cpl_propertylist *,
162  const cpl_propertylist *,
163  const cpl_propertylist *,
164  const cpl_propertylist *,
165  const cpl_propertylist *,
166  const char *,
167  int (*)(const cpl_frame *,
168  const cpl_frame *),
169  cpl_boolean);
170 
171 cpl_propertylist *
172 detmon_fill_prolist(const char *,
173  const char *,
174  const char *,
175  cpl_boolean);
176 
177 cpl_error_code
178 detmon_ronbias_fill_parlist_default(cpl_parameterlist *,
179  const char *,
180  const char *);
181 
182 cpl_error_code
183 detmon_darkron_fill_parlist_default(cpl_parameterlist *,
184  const char *,
185  const char *);
186 
187 cpl_error_code
188 detmon_ronbias_fill_parlist(cpl_parameterlist *,
189  const char *,
190  const char *,
191  const char *,
192  const char *,
193  const int,
194  const int,
195  const int,
196  const int,
197  const int,
198  const int,
199  const int,
200  const int,
201  const int,
202  const char *,
203  const int,
204  const int,
205  const int,
206  const int,
207  const int,
208  const int,
209  const int,
210  const int,
211  const int,
212  const int,
213  cpl_boolean);
214 
215 cpl_error_code
216 detmon_ronbias_histo_reduce(const cpl_image * c_raw,
217  double * bias,
218  double * fwhm,
219  double * max);
220 cpl_image *
221 detmon_build_synthetic(cpl_image *,
222  cpl_image *);
223 
224 cpl_error_code
225 irplib_flux_get_bias_window(const cpl_image *,
226  const int *,
227  int ,
228  int ,
229  double *,
230  double *);
231 
232 cpl_error_code
233 detmon_fill_pernoise_params(cpl_parameterlist *,
234  const char *,
235  const char *,
236  int mode,
237  const char *direction,
238  double speed,
239  int llx,
240  int lly,
241  int urx,
242  int ury,
243  double kappa,
244  int exts);
245 
246 int detmon_fill_pernoise_params_default(cpl_parameterlist *,
247  const char *,
248  const char *);
249 
250 cpl_error_code
251 detmon_pernoise(cpl_frameset *,
252  const cpl_parameterlist *,
253  const char *,
254  const char *,
255  const char *,
256  const char *,
257  const char *,
258  int (*)(const cpl_frame *,
259  const cpl_frame *));
260 
261 cpl_table *
262 detmon_pernoise_reduce(cpl_image *);
263 
264 cpl_error_code
265 detmon_dark(cpl_frameset *,
266  const cpl_parameterlist *,
267  const char *,
268  const char *,
269  const char *,
270  const char *,
271  const char *,
272  const char *,
273  const char *,
274  int (*)(const cpl_frame *,
275  const cpl_frame *));
276 
277 cpl_error_code
278 detmon_fill_dark_params(cpl_parameterlist * parlist,
279  const char *recipe_name,
280  const char *pipeline_name,
281  const char * ron_method,
282  const char * dsnu_method,
283  const char * optnir,
284  int exts);
285 
286 int
287 detmon_fill_dark_params_default(cpl_parameterlist * parlist,
288  const char *recipe_name,
289  const char *pipeline_name);
290 
291 int
292 detmon_compare_dits(const cpl_frame *, const cpl_frame *);
293 
294 double irplib_pfits_get_exptime(const cpl_propertylist *);
295 
296 cpl_error_code
297 detmon_fill_parlist(cpl_parameterlist *,
298  const char *, const char *, int, ...);
299 
300 int
301 detmon_retrieve_par_int(const char *,
302  const char *,
303  const char *, const cpl_parameterlist *);
304 
305 double
306 detmon_retrieve_par_double(const char *,
307  const char *,
308  const char *, const cpl_parameterlist *);
309 
310 int detmon_lg_mr(cpl_frameset * frameset,
311  const cpl_parameterlist * parlist_,
312  const char * recipe,
313  cpl_boolean opt);
314 
315 #endif