MOONS Pipeline Reference Manual 0.13.2
moons_mdark.c
1/*
2 * This file is part of the MOONS Pipeline
3 * Copyright (C) 2002-2016 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#ifdef HAVE_CONFIG_H
21#include <config.h>
22#endif
23
24/*-----------------------------------------------------------------------------
25 Includes
26 -----------------------------------------------------------------------------*/
27
28#include "moo_utils.h"
29#include "moo_pfits.h"
30#include "moo_dfs.h"
31#include "moo_params.h"
32#include "moo_drl.h"
33#include "moo_products.h"
34#include <cpl.h>
35
36#include <string.h>
37
38/*-----------------------------------------------------------------------------
39 Plugin registration
40 -----------------------------------------------------------------------------*/
41
42int cpl_plugin_get_info(cpl_pluginlist *list);
43
44/*-----------------------------------------------------------------------------
45 Private function prototypes
46 -----------------------------------------------------------------------------*/
47
48static int _moons_mdark_create(cpl_plugin *plugin);
49static int _moons_mdark_exec(cpl_plugin *plugin);
50static int _moons_mdark_destroy(cpl_plugin *plugin);
51static int
52_moons_mdark(cpl_frameset *frameset, const cpl_parameterlist *parlist);
53
54/*-----------------------------------------------------------------------------
55 Static variables
56 -----------------------------------------------------------------------------*/
57
58static const char *const _moons_mdark_description =
59 "This recipe can be use in VIS or NIR mode\n"
60 "1) RI detectors (VIS mode)\n"
61 "INPUT FRAMES\n"
62 " * RawList n>=3 files (RAW) with tag DARK_VIS : "
63 "dark files for RI detectors\n"
64 " * [OPTIONAL] ReferenceBadPixMask 1 file (QUA) with tag BP_MAP_RP : "
65 "cosmetic bad pixel map\n"
66 " * [OPTIONAL] NonLinearityBadPixMask 1 file (QUA) with tag BP_MAP_NL : "
67 "cosmetic bad pixel map coming from linearity recipe\n"
68 " * MasterBias 1 file (DET) with tag MASTER_BIAS : "
69 "master bias file\n"
70 "PRODUCTS\n"
71 " * MASTER_DARK_VIS.fits (DET) with tag "
72 "MASTER_DARK_VIS : "
73 "the master dark file for RI detectors\n"
74 "\n2) YJ, H detectors (NIR mode)\n"
75 "INPUT FRAMES\n"
76 " * RawList n>=3 files (RAW) with tag DARK_NIR : "
77 "dark files for YJ and H detectors\n"
78 " * [OPTIONAL] ReferenceBadPixMask 1 file (QUA) with tag BP_MAP_RP : "
79 "cosmetic bad pixel map\n"
80 " * [OPTIONAL] NonLinearityBadPixMask 1 file (QUA) with tag BP_MAP_NL : "
81 "cosmetic bad pixel map coming from linearity recipe\n"
82 "PRODUCTS\n"
83 " * MASTER_DARK_NIR.fits (DET) with tag "
84 "MASTER_DARK_NIR : "
85 "the master dark file\n"
86 "\n";
87
88/*-----------------------------------------------------------------------------
89 Function code
90 -----------------------------------------------------------------------------*/
91
92/*----------------------------------------------------------------------------*/
102/*----------------------------------------------------------------------------*/
103
104int
105cpl_plugin_get_info(cpl_pluginlist *list)
106{
107 cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe);
108 cpl_plugin *plugin = &recipe->interface;
109
110 if (cpl_plugin_init(plugin, CPL_PLUGIN_API, MOONS_BINARY_VERSION,
111 CPL_PLUGIN_TYPE_RECIPE, "moons_mdark",
112 "Create a master dark product",
113 _moons_mdark_description, "Regis Haigron",
114 PACKAGE_BUGREPORT, moo_get_license(),
115 _moons_mdark_create, _moons_mdark_exec,
116 _moons_mdark_destroy)) {
117 cpl_msg_error(cpl_func, "Plugin initialization failed");
118 (void)cpl_error_set_where(cpl_func);
119 return 1;
120 }
121
122 if (cpl_pluginlist_append(list, plugin)) {
123 cpl_msg_error(cpl_func, "Error adding plugin to list");
124 (void)cpl_error_set_where(cpl_func);
125 return 1;
126 }
127
128 return 0;
129}
130
131
132/*----------------------------------------------------------------------------*/
140/*----------------------------------------------------------------------------*/
141
142static int
143_moons_mdark_create(cpl_plugin *plugin)
144{
145 cpl_recipe *recipe;
146
147 /* Do not create the recipe if an error code is already set */
148 if (cpl_error_get_code() != CPL_ERROR_NONE) {
149 cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
150 cpl_func, __LINE__, cpl_error_get_where());
151 return (int)cpl_error_get_code();
152 }
153
154 if (plugin == NULL) {
155 cpl_msg_error(cpl_func, "Null plugin");
156 cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
157 }
158
159 /* Verify plugin type */
160 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
161 cpl_msg_error(cpl_func, "Plugin is not a recipe");
162 cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
163 }
164
165 /* Get the recipe */
166 recipe = (cpl_recipe *)plugin;
167
168 /* Create the parameters list in the cpl_recipe object */
169 recipe->parameters = cpl_parameterlist_new();
170 if (recipe->parameters == NULL) {
171 cpl_msg_error(cpl_func, "Parameter list allocation failed");
172 cpl_ensure_code(0, (int)CPL_ERROR_ILLEGAL_OUTPUT);
173 }
174
175 moo_params *params = moo_params_new("moons", "moons_mdark");
176
177 /* Fill the parameters list */
178 moo_params_add_keep_temp(params, recipe->parameters);
179 moo_params_add_prepare(params, recipe->parameters);
180
181 moo_params_add_correct_bias(params, recipe->parameters,
182 MOO_CORRECT_BIAS_METHOD_MASTER);
183 moo_params_add_nos(params, recipe->parameters);
184 moo_params_add_hot(params, recipe->parameters);
185 moo_params_add_crh(params, recipe->parameters, MOO_CRH_METHOD_SIGCLIP);
186
187 moo_params_delete(params);
188
189 return 0;
190}
191
192
193/*----------------------------------------------------------------------------*/
199/*----------------------------------------------------------------------------*/
200
201static int
202_moons_mdark_exec(cpl_plugin *plugin)
203{
204 cpl_recipe *recipe;
205 int recipe_status;
206 cpl_errorstate initial_errorstate = cpl_errorstate_get();
207
208 /* Return immediately if an error code is already set */
209 if (cpl_error_get_code() != CPL_ERROR_NONE) {
210 cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
211 cpl_func, __LINE__, cpl_error_get_where());
212 return (int)cpl_error_get_code();
213 }
214
215 if (plugin == NULL) {
216 cpl_msg_error(cpl_func, "Null plugin");
217 cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
218 }
219
220 /* Verify plugin type */
221 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
222 cpl_msg_error(cpl_func, "Plugin is not a recipe");
223 cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
224 }
225
226 /* Get the recipe */
227 recipe = (cpl_recipe *)plugin;
228
229 /* Verify parameter and frame lists */
230 if (recipe->parameters == NULL) {
231 cpl_msg_error(cpl_func, "Recipe invoked with NULL parameter list");
232 cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
233 }
234 if (recipe->frames == NULL) {
235 cpl_msg_error(cpl_func, "Recipe invoked with NULL frame set");
236 cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
237 }
238
239 /* Invoke the recipe */
240 recipe_status = _moons_mdark(recipe->frames, recipe->parameters);
241
242 /* Ensure DFS-compliance of the products */
243 if (cpl_dfs_update_product_header(recipe->frames)) {
244 if (!recipe_status)
245 recipe_status = (int)cpl_error_get_code();
246 }
247
248 if (!cpl_errorstate_is_equal(initial_errorstate)) {
249 /* Dump the error history since recipe execution start.
250 At this point the recipe cannot recover from the error */
251 cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
252 }
253
254 return recipe_status;
255}
256
257
258/*----------------------------------------------------------------------------*/
264/*----------------------------------------------------------------------------*/
265
266static int
267_moons_mdark_destroy(cpl_plugin *plugin)
268{
269 cpl_recipe *recipe;
270
271 if (plugin == NULL) {
272 cpl_msg_error(cpl_func, "Null plugin");
273 cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
274 }
275
276 /* Verify plugin type */
277 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
278 cpl_msg_error(cpl_func, "Plugin is not a recipe");
279 cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
280 }
281
282 /* Get the recipe */
283 recipe = (cpl_recipe *)plugin;
284
285 cpl_parameterlist_delete(recipe->parameters);
286
287 return 0;
288}
289
290/*----------------------------------------------------------------------------*/
304/*----------------------------------------------------------------------------*/
305static cpl_frame *
306_moons_prepare(moo_products *products,
307 const cpl_frame *frame,
308 const char *bpmap_rp_name,
309 const char *bpmap_nl_name,
310 const cpl_frame *masterbias,
311 const cpl_frame *coefs_cube,
312 int do_correct_bias,
313 moo_prepare_params *prepare_params,
314 moo_correct_bias_params *params,
315 int i)
316{
317 cpl_frame *result = NULL;
318 cpl_frame *pframe = NULL;
319 char *detname1 = NULL;
320 moo_det *det = NULL;
321
322 cpl_ensure(frame != NULL, CPL_ERROR_NULL_INPUT, NULL);
323 cpl_errorstate prestate = cpl_errorstate_get();
324
325 moo_try_check(det = moo_prepare(frame, bpmap_rp_name, bpmap_nl_name,
326 masterbias, coefs_cube, prepare_params),
327 " ");
328
329 if (do_correct_bias > 0) {
330 moo_try_check(moo_correct_bias(det, masterbias, params), " ");
331 }
332
333 moo_try_check(detname1 =
334 cpl_sprintf("%s_%d.fits", MOONS_TAG_DARK_CORRECTBIAS, i),
335 " ");
336 moo_try_check(pframe = moo_products_add(products, det,
337 CPL_FRAME_LEVEL_INTERMEDIATE,
338 MOONS_TAG_DARK_CORRECTBIAS,
339 detname1, frame),
340 " ");
341 moo_try_check(result = cpl_frame_duplicate(pframe), " ");
342
343moo_try_cleanup:
344 if (!cpl_errorstate_is_equal(prestate)) {
345 cpl_frame_delete(result);
346 result = NULL;
347 }
348 moo_det_delete(det);
349 cpl_free(detname1);
350 return result;
351}
352
353/*----------------------------------------------------------------------------*/
368/*----------------------------------------------------------------------------*/
369static cpl_frameset *
370_moons_prepare_set(cpl_frameset *raw_frames,
371 const char *bpmap_rp_name,
372 const char *bpmap_nl_name,
373 const cpl_frame *masterbias,
374 const cpl_frame *coef_cube,
375 int do_correct_bias,
376 moo_prepare_params *prepare_params,
377 moo_correct_bias_params *params,
378 moo_products *products)
379{
380 cpl_frameset *detframes = NULL;
381 moo_det *det = NULL;
382
383 cpl_ensure(raw_frames, CPL_ERROR_NULL_INPUT, NULL);
384 cpl_ensure(products, CPL_ERROR_NULL_INPUT, NULL);
385
386 cpl_errorstate prestate = cpl_errorstate_get();
387
388 moo_try_check(detframes = cpl_frameset_new(), " ");
389
390 for (int i = 0; i < cpl_frameset_get_size(raw_frames); ++i) {
391 const cpl_frame *current_frame = NULL;
392 cpl_frame *frame = NULL;
393
394 moo_try_check(current_frame =
395 cpl_frameset_get_position_const(raw_frames, i),
396 " ");
397
398 moo_try_check(frame =
399 _moons_prepare(products, current_frame, bpmap_rp_name,
400 bpmap_nl_name, masterbias, coef_cube,
401 do_correct_bias, prepare_params,
402 params, i),
403 " ");
404
405 moo_try_check(cpl_frameset_insert(detframes, frame), " ");
406 }
407moo_try_cleanup:
408 if (!cpl_errorstate_is_equal(prestate)) {
409 moo_det_delete(det);
410 cpl_frameset_delete(detframes);
411 detframes = NULL;
412 }
413 return detframes;
414}
415
416/*----------------------------------------------------------------------------*/
430/*----------------------------------------------------------------------------*/
431static cpl_error_code
432_moons_mdark_check_sof(cpl_frameset *frameset,
433 cpl_frameset **rawframes,
434 const char **bpmap_rp_name,
435 const char **bpmap_nl_name,
436 const cpl_frame **master_bias,
437 const cpl_frame **coefs_cube_frame,
438 int *nb_nir)
439{
440 cpl_errorstate prestate = cpl_errorstate_get();
441
442 cpl_ensure_code(rawframes != NULL, CPL_ERROR_NULL_INPUT);
443 cpl_ensure_code(frameset != NULL, CPL_ERROR_NULL_INPUT);
444 cpl_ensure_code(bpmap_rp_name != NULL, CPL_ERROR_NULL_INPUT);
445 cpl_ensure_code(bpmap_nl_name != NULL, CPL_ERROR_NULL_INPUT);
446 cpl_ensure_code(master_bias != NULL, CPL_ERROR_NULL_INPUT);
447 cpl_ensure_code(nb_nir != NULL, CPL_ERROR_NULL_INPUT);
448 /* set group */
449 cpl_ensure_code(moo_dfs_set_groups(frameset) == CPL_ERROR_NONE,
450 cpl_error_get_code());
451
452 cpl_frameset *raw_frames_vis = NULL;
453 cpl_frameset *raw_frames_nir = NULL;
454 int nraw_vis = 0;
455 int nraw_nir = 0;
456 int i;
457
458 moo_try_check(raw_frames_vis = cpl_frameset_new(), " ");
459 moo_try_check(raw_frames_nir = cpl_frameset_new(), " ");
460
461 for (i = 0; i < cpl_frameset_get_size(frameset); ++i) {
462 const cpl_frame *current_frame = NULL;
463 moo_try_check(current_frame =
464 cpl_frameset_get_position_const(frameset, i),
465 " ");
466 if (!strcmp(cpl_frame_get_tag(current_frame), MOONS_TAG_DARK_VIS)) {
467 cpl_frame *new_frame = cpl_frame_duplicate(current_frame);
468 cpl_frameset_insert(raw_frames_vis, new_frame);
469 ++nraw_vis;
470 }
471 else if (!strcmp(cpl_frame_get_tag(current_frame),
472 MOONS_TAG_DARK_NIR)) {
473 cpl_frame *new_frame = cpl_frame_duplicate(current_frame);
474 cpl_frameset_insert(raw_frames_nir, new_frame);
475 ++nraw_nir;
476 }
477 else if (!strcmp(cpl_frame_get_tag(current_frame),
478 MOONS_TAG_BP_MAP_RP)) {
479 *bpmap_rp_name = cpl_frame_get_filename(current_frame);
480 }
481 else if (!strcmp(cpl_frame_get_tag(current_frame),
482 MOONS_TAG_BP_MAP_NL)) {
483 *bpmap_nl_name = cpl_frame_get_filename(current_frame);
484 }
485 else if (!strcmp(cpl_frame_get_tag(current_frame),
486 MOONS_TAG_MASTER_BIAS)) {
487 *master_bias = current_frame;
488 }
489 else if (!strcmp(cpl_frame_get_tag(current_frame),
490 MOONS_TAG_LINEARITY_COEFF_CUBE)) {
491 *coefs_cube_frame = current_frame;
492 }
493 }
494 *nb_nir = nraw_nir;
495
496 if (nraw_vis > 0 && nraw_nir > 0) {
497 cpl_frameset_delete(raw_frames_vis);
498 cpl_frameset_delete(raw_frames_nir);
499 return (int)cpl_error_set_message(cpl_func,
500 CPL_ERROR_INCOMPATIBLE_INPUT,
501 "You have NIR and VIS raw files");
502 }
503
504 int nraw = 0;
505 const char *tag = NULL;
506 if (nraw_vis > 0) {
507 nraw = nraw_vis;
508 *rawframes = raw_frames_vis;
509 cpl_frameset_delete(raw_frames_nir);
510 if (*master_bias == NULL) {
511 return (
512 int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
513 "SOF does not have any file tagged "
514 "with %s",
515 MOONS_TAG_MASTER_BIAS);
516 }
517 tag = MOONS_TAG_DARK_VIS;
518 }
519 else {
520 nraw = nraw_nir;
521 tag = MOONS_TAG_DARK_NIR;
522 *rawframes = raw_frames_nir;
523 cpl_frameset_delete(raw_frames_vis);
524 }
525
526 if (nraw == 0) {
527 return (int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
528 "SOF does not have any file tagged "
529 "with %s",
530 tag);
531 }
532
533 if (nraw < 3) {
534 return (int)cpl_error_set_message(
535 cpl_func, CPL_ERROR_DATA_NOT_FOUND,
536 "SOF does not have enough files (%d<3) tagged "
537 "with %s",
538 nraw, tag);
539 }
540
541moo_try_cleanup:
542 if (!cpl_errorstate_is_equal(prestate)) {
543 cpl_frameset_delete(raw_frames_vis);
544 cpl_frameset_delete(raw_frames_nir);
545 *rawframes = NULL;
546 }
547 return cpl_error_get_code();
548}
549
550/*----------------------------------------------------------------------------*/
557/*----------------------------------------------------------------------------*/
558
559static int
560_moons_mdark(cpl_frameset *frameset, const cpl_parameterlist *parlist)
561{
562 /* parameters */
563 moo_prepare_params *prepare_params = NULL;
564
565 moo_correct_bias_params *correct_bias_params = NULL;
566 moo_crh_params *crh_params = NULL;
567 moo_nos_params *nos_params = NULL;
568 moo_hot_params *hot_params = NULL;
569
570 /* input files */
571 cpl_frameset *raw_frames = NULL;
572 const char *bpmap_rp_name = NULL;
573 const char *bpmap_nl_name = NULL;
574 const cpl_frame *masterbias = NULL;
575 const cpl_frame *coef_cube = NULL;
576 int nraw_nir = 0;
577 /* structure in use */
578 moo_det *medDark = NULL;
579 moo_det *medCosmics = NULL;
580 moo_detlist *detDarkList = NULL;
581 moo_masklist *cosmicsList = NULL;
582
583 /* frames used */
584 cpl_frameset *detframes = NULL;
585
586 moo_products *products = moo_products_new(frameset, parlist, "moons_mdark",
587 PACKAGE "/" PACKAGE_VERSION);
588
589 /* parameters */
590 const moo_params *params = moo_products_get_params(products);
591 moo_try_check(correct_bias_params =
592 moo_params_get_correct_bias(params, parlist),
593 " ");
594 moo_try_check(prepare_params = moo_params_get_prepare(params, parlist),
595 " ");
596 moo_try_check(crh_params = moo_params_get_crh(params, parlist), " ");
597 moo_try_check(nos_params = moo_params_get_nos(params, parlist), " ");
598 moo_try_check(hot_params = moo_params_get_hot(params, parlist), " ");
599
600 /* SOF file */
601 moo_try_check(_moons_mdark_check_sof(frameset, &raw_frames, &bpmap_rp_name,
602 &bpmap_nl_name, &masterbias,
603 &coef_cube, &nraw_nir),
604 " ");
605
606 const cpl_frame *ref_frame = cpl_frameset_get_position_const(raw_frames, 0);
607
608 moo_try_check(detframes =
609 _moons_prepare_set(raw_frames, bpmap_rp_name,
610 bpmap_nl_name, masterbias, coef_cube,
611 (nraw_nir == 0), prepare_params,
612 correct_bias_params, products),
613 " ");
614
615 moo_try_check(detDarkList = moo_detlist_create(detframes), " ");
616
617 int nraw = moo_detlist_get_size(detDarkList);
618
619 cosmicsList = moo_masklist_create(nraw);
620
621 moo_try_check(medDark =
622 moo_remove_CRH(detDarkList, cosmicsList, crh_params),
623 " ");
624
625 const char *meddark_filename = MOONS_TAG_DARK_REMOVECRH ".fits";
626 moo_try_check(moo_products_add(products, medDark,
627 CPL_FRAME_LEVEL_INTERMEDIATE,
628 MOONS_TAG_DARK_REMOVECRH, meddark_filename,
629 ref_frame),
630 " ");
631 moo_try_check(moo_compute_hot_map(medDark, hot_params), " ");
632
633 const char *darkhot_filename = MOONS_TAG_DARK_COMPUTEHOT ".fits";
634 moo_try_check(moo_products_add(products, medDark,
635 CPL_FRAME_LEVEL_INTERMEDIATE,
636 MOONS_TAG_DARK_COMPUTEHOT, darkhot_filename,
637 ref_frame),
638 " ");
639
640 if (nraw_nir > 0) {
641 if (strcmp(crh_params->method, MOO_CRH_METHOD_SIGCLIP) != 0) {
642 cpl_msg_info(__func__,
643 "Do crh rejection in SIGCLIP mode to detect cosmics");
644 crh_params->method = MOO_CRH_METHOD_SIGCLIP;
645 moo_try_check(medCosmics = moo_remove_CRH(detDarkList, cosmicsList,
646 crh_params),
647 " ");
648 }
649
650 moo_try_check(moo_compute_noise_map(medDark, detDarkList, cosmicsList,
651 nos_params),
652 " ");
653 moo_try_check(moo_masterdark(medDark, products, 1), " ");
654 }
655 else {
656 moo_try_check(moo_masterdark(medDark, products, 0), " ");
657 }
658
659moo_try_cleanup:
660 // dump error from the state
661 moo_det_delete(medDark);
662 moo_det_delete(medCosmics);
663 moo_detlist_delete(detDarkList);
664 moo_masklist_delete(cosmicsList);
665 cpl_frameset_delete(detframes);
666
667 cpl_frameset_delete(raw_frames);
668
669 moo_nos_params_delete(nos_params);
670 moo_hot_params_delete(hot_params);
671 moo_crh_params_delete(crh_params);
672 moo_prepare_params_delete(prepare_params);
673
674 moo_correct_bias_params_delete(correct_bias_params);
675 moo_products_delete(products);
676 return (int)cpl_error_get_code();
677}
void moo_det_delete(moo_det *self)
Delete a moo_det.
Definition: moo_det.c:472
moo_detlist * moo_detlist_create(cpl_frameset *frameset)
Create a new moo_detlist from the given DET frameset.
Definition: moo_detlist.c:71
cpl_size moo_detlist_get_size(const moo_detlist *self)
Get the number of DET in the detlist.
Definition: moo_detlist.c:173
void moo_detlist_delete(moo_detlist *self)
Free all memory used by a moo_detlist object including the DET.
Definition: moo_detlist.c:559
moo_masklist * moo_masklist_create(int size)
Create a new moo_masklist from the given MASK frameset.
Definition: moo_masklist.c:71
void moo_masklist_delete(moo_masklist *self)
Free all memory used by a moo_masklist object including the MASK.
Definition: moo_masklist.c:165
moo_prepare_params * moo_params_get_prepare(const moo_params *self, const cpl_parameterlist *list)
Get remove prepare parameters from moons parameters list.
Definition: moo_params.c:1073
cpl_error_code moo_params_add_nos(moo_params *self, cpl_parameterlist *list)
Add default parameters for compute noise map.
Definition: moo_params.c:527
cpl_error_code moo_params_add_hot(moo_params *self, cpl_parameterlist *list)
Add default parameters for compute hot map.
Definition: moo_params.c:556
void moo_nos_params_delete(moo_nos_params *self)
Delete a moo_nos_params.
Definition: moo_params.c:646
moo_correct_bias_params * moo_params_get_correct_bias(const moo_params *self, const cpl_parameterlist *list)
Get correct_bias parameters from moons parameters list.
Definition: moo_params.c:1167
cpl_error_code moo_params_add_crh(moo_params *self, cpl_parameterlist *list, const char *method)
Add default parameters for remove crh.
Definition: moo_params.c:694
void moo_params_delete(moo_params *self)
Delete a moo_params.
Definition: moo_params.c:85
moo_crh_params * moo_params_get_crh(const moo_params *self, const cpl_parameterlist *list)
Get remove crh parameters from moons parameters list.
Definition: moo_params.c:1099
void moo_hot_params_delete(moo_hot_params *self)
Delete a moo_hot_params.
Definition: moo_params.c:609
cpl_error_code moo_params_add_correct_bias(moo_params *self, cpl_parameterlist *list, const char *method)
Add default parameters for correct_bias.
Definition: moo_params.c:860
moo_nos_params * moo_params_get_nos(const moo_params *self, const cpl_parameterlist *list)
Get compute noise parameters from moons parameters list.
Definition: moo_params.c:1006
moo_hot_params * moo_params_get_hot(const moo_params *self, const cpl_parameterlist *list)
Get compute hot map parameters from moons parameters list.
Definition: moo_params.c:1038
cpl_error_code moo_params_add_keep_temp(moo_params *self, cpl_parameterlist *list)
Add default parameters for keep-temp.
Definition: moo_params.c:932
cpl_error_code moo_params_add_prepare(moo_params *self, cpl_parameterlist *list)
Add default parameters for prepare.
Definition: moo_params.c:667
moo_params * moo_params_new(const char *pid, const char *recipe_id)
Create a new moo_params.
Definition: moo_params.c:62
cpl_error_code moo_dfs_set_groups(cpl_frameset *set)
Set the group as RAW or CALIB in a frameset.
Definition: moo_dfs.c:206
moo_det * moo_remove_CRH(moo_detlist *detlist, moo_masklist *cosmiclist, moo_crh_params *params)
Remove CRH in single frames or in a combination of multiple frames.
moo_det * moo_prepare(const cpl_frame *rawframe, const char *const badpixmask_rp, const char *const badpixmask_nl, const cpl_frame *masterbias, const cpl_frame *cube_frame, moo_prepare_params *params)
This function transforms RAW frames in DET frames attaching the default bad pixel map and an error im...
Definition: moo_prepare.c:324
cpl_error_code moo_compute_hot_map(moo_det *det, moo_hot_params *params)
Calculates the hot bad pixel mask.
Definition: moo_drl.c:830
cpl_error_code moo_compute_noise_map(moo_det *det, moo_detlist *darkList, moo_masklist *cosmiclist, moo_nos_params *params)
Calculates the noisey bad pixel mask.
Definition: moo_drl.c:629
cpl_error_code moo_correct_bias(moo_det *det, const cpl_frame *masterbias_frame, moo_correct_bias_params *params)
Subtracts the Master Bias frame from a DET frame.
Definition: moo_drl.c:86
moo_products * moo_products_new(cpl_frameset *framelist, const cpl_parameterlist *parlist, const char *recid, const char *pipeline_id)
create a moo_product object for a recipe
Definition: moo_products.c:53
cpl_error_code moo_masterdark(moo_det *det, moo_products *products, int mode)
This function creates the master dark frame as a product and essentially produces a standard output a...
cpl_frame * moo_products_add(moo_products *self, moo_det *det, cpl_frame_level level, const char *tag, const char *filename, const cpl_frame *inherit_frame)
create a product from a DET object
Definition: moo_products.c:203
const moo_params * moo_products_get_params(const moo_products *self)
get the moo_params object
Definition: moo_products.c:87
const char * moo_get_license(void)
Get the pipeline copyright and license.
Definition: moo_utils.c:81