CR2RE Pipeline Reference Manual 1.6.7
cr2res_util_normflat.c
1/*
2 * This file is part of the CR2RES Pipeline
3 * Copyright (C) 2002,2003 European Southern Observatory
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
18 */
19
20#ifdef HAVE_CONFIG_H
21#include <config.h>
22#endif
23
24/*-----------------------------------------------------------------------------
25 Includes
26 -----------------------------------------------------------------------------*/
27
28#include <string.h>
29#include <cpl.h>
30
31#include "cr2res_utils.h"
32#include "cr2res_calib.h"
33#include "cr2res_pfits.h"
34#include "cr2res_dfs.h"
35#include "cr2res_flat.h"
36#include "cr2res_bpm.h"
37#include "cr2res_trace.h"
38#include "cr2res_extract.h"
39#include "cr2res_io.h"
40
41/*-----------------------------------------------------------------------------
42 Define
43 -----------------------------------------------------------------------------*/
44
45#define RECIPE_STRING "cr2res_util_normflat"
46
47/*-----------------------------------------------------------------------------
48 Plugin registration
49 -----------------------------------------------------------------------------*/
50
51int cpl_plugin_get_info(cpl_pluginlist * list);
52
53/*-----------------------------------------------------------------------------
54 Private function prototypes
55 -----------------------------------------------------------------------------*/
56
57static cpl_frameset * cr2res_util_normflat_find_RAW(const cpl_frameset * in) ;
58static int cr2res_util_normflat_reduce(
59 const cpl_frameset * rawframes,
60 const cpl_frame * slitmodel_frame,
61 double bpm_low,
62 double bpm_high,
63 double bpm_linemax,
64 int reduce_det,
65 hdrl_image ** master_flat,
66 cpl_image ** bpm,
67 cpl_propertylist ** ext_plist) ;
68static int cr2res_util_normflat_compare(
69 const cpl_frame * frame1,
70 const cpl_frame * frame2) ;
71static int cr2res_util_normflat_create(cpl_plugin *);
72static int cr2res_util_normflat_exec(cpl_plugin *);
73static int cr2res_util_normflat_destroy(cpl_plugin *);
74static int cr2res_util_normflat(cpl_frameset *, const cpl_parameterlist *);
75
76/*-----------------------------------------------------------------------------
77 Static variables
78 -----------------------------------------------------------------------------*/
79
80static char cr2res_util_normflat_description[] = "\
81Flat normalization \n\
82 The input RAW files are grouped by setting/decker and each group is \n\
83 reduced separately. For each group, a slit model file with matching \n\
84 setting/decker is expected. \n\
85 \n\
86 Inputs \n\
87 raw.fits " CR2RES_FLAT_RAW " [1 to n] \n\
88 or " CR2RES_UTIL_CALIB_PROCATG " \n\
89 slit_model.fits " CR2RES_CAL_FLAT_SLIT_MODEL_PROCATG " [1 to m] \n\
90 or " CR2RES_UTIL_SLIT_MODEL_PROCATG " \n\
91 or " CR2RES_OBS_NODDING_SLITMODELA_PROCATG " \n\
92 or " CR2RES_OBS_NODDING_SLITMODELB_PROCATG " \n\
93 \n\
94 Outputs \n\
95 cr2res_util_normflat_[setting]_[Decker]_bpm.fits "
96 CR2RES_UTIL_NORM_BPM_PROCATG "\n\
97 cr2res_util_normflat_[setting]_[Decker]_master.fits "
98 CR2RES_UTIL_MASTER_FLAT_PROCATG "\n\
99 \n\
100 Algorithm \n\
101 group the input frames by different settings \n\
102 loop on groups g: \n\
103 group the input frames by different decker positions \n\
104 loop on decker positions p: \n\
105 loop on detectors d: \n\
106 cr2res_util_normflat_reduce() computes (master_flat,bpm)(g,p,d)\n\
107 Save master_flat(g,p) \n\
108 Save bpm(g,p) \n\
109 \n\
110 cr2res_util_normflat_reduce() \n\
111 Load the images list \n\
112 Average the images to avg \n\
113 Load the input slit_model with the proper setting/decker \n\
114 Compute the master flat with cr2res_master_flat(avg, \n\
115 slit_model, --bpm_low, --bpm_high, --bpm_lines_ratio) \n\
116 -> master_flat, bpm \n\
117 \n\
118Library functions used: \n\
119 cr2res_extract_frameset() \n\
120 cr2res_io_extract_decker_frameset() \n\
121 cr2res_io_find_SLIT_MODEL() \n\
122 cr2res_io_load_image_list_from_set() \n\
123 cr2res_io_load_SLIT_MODEL() \n\
124 cr2res_master_flat() \n\
125 cr2res_io_save_MASTER_FLAT() \n\
126 cr2res_io_save_BPM() \n\
127";
128
129/*-----------------------------------------------------------------------------
130 Function code
131 -----------------------------------------------------------------------------*/
132
133/*----------------------------------------------------------------------------*/
143/*----------------------------------------------------------------------------*/
144int cpl_plugin_get_info(cpl_pluginlist * list)
145{
146 cpl_recipe * recipe = cpl_calloc(1, sizeof *recipe );
147 cpl_plugin * plugin = &recipe->interface;
148
149 if (cpl_plugin_init(plugin,
150 CPL_PLUGIN_API,
151 CR2RES_BINARY_VERSION,
152 CPL_PLUGIN_TYPE_RECIPE,
153 RECIPE_STRING,
154 "Flat Normalization utility",
155 cr2res_util_normflat_description,
156 CR2RES_PIPELINE_AUTHORS,
157 PACKAGE_BUGREPORT,
159 cr2res_util_normflat_create,
160 cr2res_util_normflat_exec,
161 cr2res_util_normflat_destroy)) {
162 cpl_msg_error(cpl_func, "Plugin initialization failed");
163 (void)cpl_error_set_where(cpl_func);
164 return 1;
165 }
166
167 if (cpl_pluginlist_append(list, plugin)) {
168 cpl_msg_error(cpl_func, "Error adding plugin to list");
169 (void)cpl_error_set_where(cpl_func);
170 return 1;
171 }
172
173 return 0;
174}
175
176/*----------------------------------------------------------------------------*/
184/*----------------------------------------------------------------------------*/
185static int cr2res_util_normflat_create(cpl_plugin * plugin)
186{
187 cpl_recipe * recipe ;
188 cpl_parameter * p ;
189
190 /* Check that the plugin is part of a valid recipe */
191 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
192 recipe = (cpl_recipe *)plugin;
193 else
194 return -1;
195
196 /* Create the parameters list in the cpl_recipe object */
197 recipe->parameters = cpl_parameterlist_new();
198
199 /* Fill the parameters list */
200 p = cpl_parameter_new_value("cr2res.cr2res_util_normflat.bpm_low",
201 CPL_TYPE_DOUBLE, "Low threshold for BPM detection",
202 "cr2res.cr2res_util_normflat", 0.5);
203 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "bpm_low");
204 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
205 cpl_parameterlist_append(recipe->parameters, p);
206
207 p = cpl_parameter_new_value("cr2res.cr2res_util_normflat.bpm_high",
208 CPL_TYPE_DOUBLE, "High threshold for BPM detection",
209 "cr2res.cr2res_util_normflat", 2.0);
210 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "bpm_high");
211 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
212 cpl_parameterlist_append(recipe->parameters, p);
213
214 p = cpl_parameter_new_value("cr2res.cr2res_util_normflat.bpm_lines_ratio",
215 CPL_TYPE_DOUBLE, "Maximum ratio of bad pixels per line",
216 "cr2res.cr2res_util_normflat", 0.5);
217 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "bpm_lines_ratio");
218 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
219 cpl_parameterlist_append(recipe->parameters, p);
220
221
222 p = cpl_parameter_new_value("cr2res.cr2res_util_normflat.detector",
223 CPL_TYPE_INT, "Only reduce the specified detector",
224 "cr2res.cr2res_util_normflat", 0);
225 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "detector");
226 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
227 cpl_parameterlist_append(recipe->parameters, p);
228
229 return 0;
230}
231
232/*----------------------------------------------------------------------------*/
238/*----------------------------------------------------------------------------*/
239static int cr2res_util_normflat_exec(cpl_plugin * plugin)
240{
241 cpl_recipe *recipe;
242
243 /* Get the recipe out of the plugin */
244 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
245 recipe = (cpl_recipe *)plugin;
246 else return -1;
247
248 return cr2res_util_normflat(recipe->frames, recipe->parameters);
249}
250
251/*----------------------------------------------------------------------------*/
257/*----------------------------------------------------------------------------*/
258static int cr2res_util_normflat_destroy(cpl_plugin * plugin)
259{
260 cpl_recipe *recipe;
261
262 /* Get the recipe out of the plugin */
263 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
264 recipe = (cpl_recipe *)plugin;
265 else return -1 ;
266
267 cpl_parameterlist_delete(recipe->parameters);
268 return 0 ;
269}
270
271/*----------------------------------------------------------------------------*/
278/*----------------------------------------------------------------------------*/
279static int cr2res_util_normflat(
280 cpl_frameset * frameset,
281 const cpl_parameterlist * parlist)
282{
283 const cpl_parameter * param ;
284 int reduce_det ;
285 double bpm_low, bpm_high, bpm_lines_ratio ;
286 cpl_frameset * rawframes ;
287 const char * used_tag ;
288 cpl_frameset * raw_one_setting_decker ;
289 cpl_size * labels ;
290 cpl_size nlabels ;
291 cpl_frame * slitmodel_frame ;
292 hdrl_image * master_flat[CR2RES_NB_DETECTORS] ;
293 cpl_image * bpm[CR2RES_NB_DETECTORS] ;
294 cpl_propertylist * ext_plist[CR2RES_NB_DETECTORS] ;
295 char * out_file;
296 int i, det_nr, l ;
297
298 /* Initialise */
299 cr2res_decker decker_values[CR2RES_NB_DECKER_POSITIONS] =
300 {CR2RES_DECKER_NONE, CR2RES_DECKER_1_3, CR2RES_DECKER_2_4} ;
301 char * decker_desc[CR2RES_NB_DECKER_POSITIONS] =
302 {"Open", "Decker1", "Decker2"} ;
303
304 /* RETRIEVE INPUT PARAMETERS */
305 param = cpl_parameterlist_find_const(parlist,
306 "cr2res.cr2res_util_normflat.bpm_low");
307 bpm_low = cpl_parameter_get_double(param);
308 param = cpl_parameterlist_find_const(parlist,
309 "cr2res.cr2res_util_normflat.bpm_high");
310 bpm_high = cpl_parameter_get_double(param);
311 param = cpl_parameterlist_find_const(parlist,
312 "cr2res.cr2res_util_normflat.bpm_lines_ratio");
313 bpm_lines_ratio = cpl_parameter_get_double(param);
314 param = cpl_parameterlist_find_const(parlist,
315 "cr2res.cr2res_util_normflat.detector");
316 reduce_det = cpl_parameter_get_int(param);
317
318 /* Identify the RAW and CALIB frames in the input frameset */
319 if (cr2res_dfs_set_groups(frameset)) {
320 cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
321 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
322 return -1 ;
323 }
324
325 /* Extract RAW frames */
326 rawframes = cr2res_util_normflat_find_RAW(frameset) ;
327 if (rawframes==NULL || cpl_frameset_get_size(rawframes) <= 0) {
328 cpl_msg_error(__func__, "Cannot find any RAW file") ;
329 cpl_error_set(__func__, CPL_ERROR_DATA_NOT_FOUND) ;
330 return -1 ;
331 }
332 /* Keep track of the first file tag (should all be the same) */
333 used_tag = cpl_frame_get_tag(cpl_frameset_get_position_const(rawframes,0));
334
335 /* Labelise the raw frames with the different settings */
336 if ((labels = cpl_frameset_labelise(rawframes, cr2res_util_normflat_compare,
337 &nlabels)) == NULL) {
338 cpl_msg_error(__func__, "Cannot labelise input frames") ;
339 cpl_frameset_delete(rawframes) ;
340 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
341 return -1 ;
342 }
343
344 /* Loop on the settings */
345 for (l = 0; l < (int)nlabels; l++) {
346 cpl_propertylist *plist;
347 char *setting_id;
348 cpl_frameset *raw_one_setting;
349 /* Get the frames for the current setting */
350 raw_one_setting = cpl_frameset_extract(rawframes, labels, (cpl_size)l) ;
351
352 /* Get the current setting */
353 plist = cpl_propertylist_load(cpl_frame_get_filename(
354 cpl_frameset_get_position(raw_one_setting, 0)), 0) ;
355 setting_id = cpl_strdup(cr2res_pfits_get_wlen_id(plist)) ;
356 cr2res_format_setting(setting_id) ;
357 cpl_propertylist_delete(plist) ;
358
359 cpl_msg_info(__func__, "Process SETTING %s", setting_id) ;
360 cpl_msg_indent_more() ;
361
362 /* Loop on the decker positions */
363 for (i=0 ; i<CR2RES_NB_DECKER_POSITIONS ; i++) {
364 /* Get the Frames for the current decker position */
365 raw_one_setting_decker = cr2res_io_extract_decker_frameset(
366 raw_one_setting, used_tag, decker_values[i]) ;
367 if (raw_one_setting_decker == NULL) {
368 cpl_msg_info(__func__, "No files for decker: %s",
369 decker_desc[i]) ;
370 continue ;
371 }
372 cpl_msg_info(__func__, "Reduce %s Frames", decker_desc[i]) ;
373 cpl_msg_indent_more() ;
374
375 /* Get the slit model for the setting / decker */
376 slitmodel_frame = cr2res_io_find_SLIT_MODEL(frameset,
377 setting_id, decker_values[i]);
378
379 /* Loop on the detectors */
380 for (det_nr=1 ; det_nr<=CR2RES_NB_DETECTORS ; det_nr++) {
381 /* Initialise */
382 master_flat[det_nr-1] = NULL ;
383 bpm[det_nr-1] = NULL ;
384 ext_plist[det_nr-1] = NULL ;
385
386 /* Compute only one detector */
387 if (reduce_det != 0 && det_nr != reduce_det) continue ;
388
389 cpl_msg_info(__func__, "Process Detector %d", det_nr) ;
390 cpl_msg_indent_more() ;
391
392 /* Call the reduction function */
393 if (cr2res_util_normflat_reduce(raw_one_setting_decker,
394 slitmodel_frame, bpm_low, bpm_high,
395 bpm_lines_ratio, det_nr,
396 &(master_flat[det_nr-1]),
397 &(bpm[det_nr-1]),
398 &(ext_plist[det_nr-1])) == -1) {
399 cpl_msg_warning(__func__,
400 "Failed to reduce detector %d of %s Frames",
401 det_nr, decker_desc[i]);
402 }
403 cpl_msg_indent_less() ;
404 }
405 cpl_msg_indent_less() ;
406 cpl_frame_delete(slitmodel_frame) ;
407
408 /* Save Products */
409
410 /* MASTER_FLAT */
411 if (nlabels == 1) {
412 out_file = cpl_sprintf("%s_%s_master_flat.fits",
413 RECIPE_STRING, decker_desc[i]) ;
414 } else {
415 out_file = cpl_sprintf("%s_%s_%s_master_flat.fits",
416 RECIPE_STRING, setting_id, decker_desc[i]) ;
417 }
418 cr2res_io_save_MASTER_FLAT(out_file, frameset,
419 raw_one_setting_decker, parlist, master_flat, NULL,
420 ext_plist, CR2RES_UTIL_MASTER_FLAT_PROCATG,
421 RECIPE_STRING);
422 cpl_free(out_file);
423
424 /* BPM */
425 if (nlabels == 1) {
426 out_file = cpl_sprintf("%s_%s_master_bpm.fits",
427 RECIPE_STRING, decker_desc[i]) ;
428 } else {
429 out_file = cpl_sprintf("%s_%s_%s_master_bpm.fits",
430 RECIPE_STRING, setting_id, decker_desc[i]) ;
431 }
432 cr2res_io_save_BPM(out_file, frameset,
433 raw_one_setting_decker, parlist, bpm, NULL,ext_plist,
434 CR2RES_UTIL_NORM_BPM_PROCATG, RECIPE_STRING) ;
435 cpl_free(out_file);
436
437 /* Free */
438 cpl_frameset_delete(raw_one_setting_decker) ;
439 for (det_nr=1 ; det_nr<=CR2RES_NB_DETECTORS ; det_nr++) {
440 if (master_flat[det_nr-1] != NULL)
441 hdrl_image_delete(master_flat[det_nr-1]) ;
442 if (bpm[det_nr-1] != NULL)
443 cpl_image_delete(bpm[det_nr-1]) ;
444 if (ext_plist[det_nr-1] != NULL)
445 cpl_propertylist_delete(ext_plist[det_nr-1]) ;
446 }
447 }
448 cpl_msg_indent_less() ;
449 cpl_frameset_delete(raw_one_setting) ;
450 cpl_free(setting_id) ;
451 }
452 cpl_free(labels);
453 cpl_frameset_delete(rawframes) ;
454 return (int)cpl_error_get_code();
455}
456
457/*----------------------------------------------------------------------------*/
470/*----------------------------------------------------------------------------*/
471static int cr2res_util_normflat_reduce(
472 const cpl_frameset * rawframes,
473 const cpl_frame * slitmodel_frame,
474 double bpm_low,
475 double bpm_high,
476 double bpm_linemax,
477 int reduce_det,
478 hdrl_image ** master_flat,
479 cpl_image ** bpm,
480 cpl_propertylist ** ext_plist)
481{
482 const char * first_file ;
483 hdrl_imagelist * imlist ;
484 hdrl_image * collapsed ;
485 hdrl_image * slit_model ;
486 cpl_image * contrib ;
487 cpl_image * bpm_flat ;
488 cpl_propertylist * plist ;
489 hdrl_image * master_flat_loc ;
490 int ext_nr ;
491
492 /* Check Inputs */
493 if (rawframes == NULL) return -1 ;
494
495 /* Get the Extension number */
496 first_file = cpl_frame_get_filename(
497 cpl_frameset_get_position_const(rawframes, 0)) ;
498 ext_nr = cr2res_io_get_ext_idx(first_file, reduce_det, 1) ;
499
500 /* Load the extension header for saving */
501 plist = cpl_propertylist_load(first_file, ext_nr) ;
502 if (plist == NULL) return -1 ;
503
504 /* Load the image list */
505 imlist = cr2res_io_load_image_list_from_set(rawframes, reduce_det) ;
506 if (imlist == NULL) {
507 cpl_msg_error(__func__, "Failed to Load the images") ;
508 cpl_propertylist_delete(plist);
509 return -1 ;
510 }
511
512 /* Collapse */
513 cpl_msg_info(__func__, "Collapse the input images") ;
514 cpl_msg_indent_more() ;
515 if (hdrl_imagelist_collapse_mean(imlist, &collapsed, &contrib) !=
516 CPL_ERROR_NONE) {
517 cpl_msg_error(__func__, "Failed to Collapse") ;
518 cpl_propertylist_delete(plist);
519 hdrl_imagelist_delete(imlist) ;
520 cpl_msg_indent_less() ;
521 return -1 ;
522 }
523 hdrl_imagelist_delete(imlist) ;
524 cpl_image_delete(contrib) ;
525 cpl_msg_indent_less() ;
526
527 /* Load the Model master */
528 if ((slit_model = cr2res_io_load_SLIT_MODEL(
529 cpl_frame_get_filename(slitmodel_frame),
530 reduce_det)) == NULL) {
531 cpl_msg_error(__func__, "Cannot load the slit model") ;
532 cpl_propertylist_delete(plist);
533 hdrl_image_delete(collapsed) ;
534 return -1 ;
535 }
536
537 /* Compute the Master flat */
538 cpl_msg_info(__func__, "Compute the master flat") ;
539 cpl_msg_indent_more() ;
540 if ((master_flat_loc = cr2res_master_flat(collapsed, slit_model, bpm_low,
541 bpm_high, bpm_linemax, &bpm_flat)) == NULL) {
542 cpl_msg_error(__func__, "Failed compute the Master Flat") ;
543 cpl_propertylist_delete(plist);
544 hdrl_image_delete(collapsed) ;
545 hdrl_image_delete(slit_model) ;
546 cpl_msg_indent_less() ;
547 return -1 ;
548 }
549 cpl_msg_indent_less() ;
550 hdrl_image_delete(slit_model) ;
551 hdrl_image_delete(collapsed) ;
552
553 /* Return the results */
554 *master_flat = master_flat_loc ;
555 *bpm = bpm_flat ;
556 *ext_plist = plist ;
557 return 0 ;
558}
559
560/*----------------------------------------------------------------------------*/
567/*----------------------------------------------------------------------------*/
568static int cr2res_util_normflat_compare(
569 const cpl_frame * frame1,
570 const cpl_frame * frame2)
571{
572 int comparison ;
573 cpl_propertylist * plist1 ;
574 cpl_propertylist * plist2 ;
575 const char * sval1 ;
576 const char * sval2 ;
577
578 /* Test entries */
579 if (frame1==NULL || frame2==NULL) return -1 ;
580
581 /* Get property lists */
582 if ((plist1=cpl_propertylist_load(cpl_frame_get_filename(frame1),0))==NULL){
583 cpl_msg_error(__func__, "getting header from reference frame");
584 return -1 ;
585 }
586 if ((plist2=cpl_propertylist_load(cpl_frame_get_filename(frame2),0))==NULL){
587 cpl_msg_error(__func__, "getting header from reference frame");
588 cpl_propertylist_delete(plist1) ;
589 return -1 ;
590 }
591
592 /* Test status */
593 if (cpl_error_get_code()) {
594 cpl_propertylist_delete(plist1) ;
595 cpl_propertylist_delete(plist2) ;
596 return -1 ;
597 }
598
599 comparison = 1 ;
600
601 /* Compare the SETTING used */
602 sval1 = cr2res_pfits_get_wlen_id(plist1) ;
603 sval2 = cr2res_pfits_get_wlen_id(plist2) ;
604 if (cpl_error_get_code()) {
605 cpl_msg_error(__func__, "Cannot get the reference wavelength");
606 cpl_propertylist_delete(plist1) ;
607 cpl_propertylist_delete(plist2) ;
608 return -1 ;
609 }
610 if (strcmp(sval1, sval2)) comparison = 0 ;
611
612 cpl_propertylist_delete(plist1) ;
613 cpl_propertylist_delete(plist2) ;
614 return comparison ;
615}
616
617/*----------------------------------------------------------------------------*/
625/*----------------------------------------------------------------------------*/
626static cpl_frameset * cr2res_util_normflat_find_RAW(const cpl_frameset * in)
627{
628 cpl_frameset * out ;
629
630 /* Check entries */
631 if (in == NULL) return NULL ;
632
633 out = cr2res_extract_frameset(in, CR2RES_FLAT_RAW) ;
634 if (out == NULL)
635 out = cr2res_extract_frameset(in, CR2RES_UTIL_CALIB_PROCATG) ;
636 return out ;
637}
638
639
640
cpl_error_code cr2res_dfs_set_groups(cpl_frameset *set)
Set the group as RAW or CALIB in a frameset.
Definition: cr2res_dfs.c:53
hdrl_image * cr2res_master_flat(const hdrl_image *collapsed, const hdrl_image *model_master, double low, double high, double bad_per_line_limit, cpl_image **bpm)
Compute the Master Flat.
Definition: cr2res_flat.c:63
cpl_frame * cr2res_io_find_SLIT_MODEL(const cpl_frameset *in, const char *setting_id, cr2res_decker decker)
Get the first CR2RES_SLIT_MODEL_DRSTYPE frame from a frameset.
Definition: cr2res_io.c:167
cpl_frameset * cr2res_io_extract_decker_frameset(const cpl_frameset *in, const char *tag, cr2res_decker decker)
Extract the frames with the given tag and Decker position.
Definition: cr2res_io.c:527
hdrl_image * cr2res_io_load_SLIT_MODEL(const char *filename, int detector)
Load an hdrl image from a SLIT MODEL.
Definition: cr2res_io.c:1169
hdrl_imagelist * cr2res_io_load_image_list_from_set(const cpl_frameset *in, int detector)
Load an hdrl image list from an images frameset.
Definition: cr2res_io.c:808
int cr2res_io_save_MASTER_FLAT(const char *filename, cpl_frameset *allframes, cpl_frameset *inframes, const cpl_parameterlist *parlist, hdrl_image **master_flats, const cpl_propertylist *qc_list, cpl_propertylist **ext_plist, const char *procatg, const char *recipe)
Save a MASTER_FLAT.
Definition: cr2res_io.c:1639
int cr2res_io_get_ext_idx(const char *filename, int detector, int data)
Get the wished extension number for a detector.
Definition: cr2res_io.c:644
int cr2res_io_save_BPM(const char *filename, cpl_frameset *allframes, cpl_frameset *inframes, const cpl_parameterlist *parlist, cpl_image **bpms, const cpl_propertylist *qc_list, cpl_propertylist **ext_plist, const char *procatg, const char *recipe)
Save a BPM.
Definition: cr2res_io.c:1555
const char * cr2res_pfits_get_wlen_id(const cpl_propertylist *plist)
find out the Setting
Definition: cr2res_pfits.c:137
int cr2res_format_setting(char *setting_id)
Format the setting.
Definition: cr2res_utils.c:152
cpl_frameset * cr2res_extract_frameset(const cpl_frameset *in, const char *tag)
Extract the frames with the given tag from a frameset.
const char * cr2res_get_license(void)
Get the pipeline copyright and license.
void hdrl_image_delete(hdrl_image *himg)
delete hdrl_image
Definition: hdrl_image.c:379
cpl_error_code hdrl_imagelist_collapse_mean(const hdrl_imagelist *himlist, hdrl_image **out, cpl_image **contrib)
Mean collapsing of image list.
void hdrl_imagelist_delete(hdrl_imagelist *himlist)
Free all memory used by a hdrl_imagelist object including the images.