31#include "moo_params.h"
33#include "moo_badpix.h"
34#include "moo_extlist.h"
35#include "moo_rbnlist.h"
36#include "moo_correct_tell.h"
37#include "moo_subtract_nod.h"
38#include "moo_combine_sky.h"
39#include "moo_combine_pair.h"
40#include "moo_products.h"
49int cpl_plugin_get_info(cpl_pluginlist *list);
55static int _moons_science_xswitch2_create(cpl_plugin *plugin);
56static int _moons_science_xswitch2_exec(cpl_plugin *plugin);
57static int _moons_science_xswitch2_destroy(cpl_plugin *plugin);
58static int _moons_science_xswitch2(cpl_frameset *frameset,
59 const cpl_parameterlist *parlist);
64static const char *
const _moons_science_xswitch2_description =
65 "From an observation sequence in XSwitch mode, this recipe removes "
66 "the instrumental signature and provides calibrated science products. "
67 "During the sequence, the telescope nods from one position on the sky "
68 "(labeled as A in Fig. 5-11) to another (B). In the sequence, different "
70 " offset positions can be used: as represented in Fig. 5-11, the "
72 "is done with 1D wavelength calibrated sky subtracted spectra. Using "
74 " slit offset positions implies that different sets of calibration "
75 "(FF, wave maps) are given as inputs.\n"
77 " * science exposure frames n>=1 file(s) (RAW) with tag "
79 "science frame in xswitch mode file\n"
80 " * [OPTIONAL] ReferenceBadPixMask 1 file (QUA) with tag "
82 "cosmetic bad pixel map\n"
83 " * [OPTIONAL] NonLinearityBadPixMask 1 file (QUA) with tag "
85 "cosmetic bad pixel map coming from linearity recipe\n"
86 " * MasterBias 1 file (DET) with tag "
89 " * MasterDarkNir 1 file (DET) with tag "
91 "master dark nir for object\n"
92 " * [OPTIONAL] MasterDarkNir 1 file (DET) with tag "
94 "master dark nir file for sky (if exposure time is different from object)\n"
95 " * [OPTIONAL] MasterDarkVis 1 file (DET) with tag "
97 "master dark vis file\n"
98 " * [OPTIONAL] CoeffsCube 1 or 2 file(s) one by offset (3D) with tag "
99 "LINEARITY_COEFF_CUBE : "
100 "coefficients to correct pixels detector linearity\n"
101 " * [OPTIONAL] P2pMap 1 file (DET) with tag "
103 "pixel to pixel map\n"
104 " * Fftrace 1 or 2 file(s) one by offset (LOC) with tag "
106 "the localisation table\n"
107 " * [OPTIONAL] MasterFlat 1 or 2 file(s) one by offset (PSF) with tag "
109 "the master flat used for optimal extraction\n"
110 " * Ffext 1 or 2 file(s) one by offset (EXT) with tag "
112 "the extracted flat field\n"
113 " * F2f [OPTIONAL] 1 or 2 file(s) one by offset (F2F) with tag "
115 "the fibre-to-fibre relative response\n"
116 " * SFormat 1 file (FMT) with tag "
118 "the spectral format table\n"
119 " * WaveMap 1 or 2 file(s) one by offset (WMAP) with tag "
121 "the wavelength map\n"
122 " * SkyLines 1 file (CAT) with tag "
124 "the sky lines list table\n"
125 " * [OPTIONAL] response 1 file (RESPONSE) with "
127 "the response spectra in the extracted pixel space\n"
128 " * [OPTIONAL] atmosExt 1 file (ATMO) with tag "
130 "the atmospheric extinction table\n"
132 " * SCIENCE_XSWITCHRBNSPECTRA_OFFSET[offset]_[insmode]_i.fits (RBN) with "
134 "xswitch_RBNSPECTRA : "
135 "Science product individual calibrated frames\n"
136 " * SCIENCE_XSWITCHSKSSPECTRA_OFFSET[offset]_[insmode]_i.fits (SCI) with "
138 "xswitch_SKSSPECTRA : "
139 "Science product individual sky subtracted frames\n"
140 " * SCIENCE_XSWITCHSKSSPECTRA_[insmode].fits (SCI) with "
142 "xswitch_SKSSPECTRA : "
143 "Science product coadd calibrated frame\n"
144 " * [OPTIONAL] SCIENCE_XSWITCHFLXSPECTRA_[insmode].fits (SCI) with "
146 "xswitch_FLXSPECTRA : "
147 "Science product flux calibrated frame\n"
167cpl_plugin_get_info(cpl_pluginlist *list)
169 cpl_recipe *recipe = cpl_calloc(1,
sizeof *recipe);
170 cpl_plugin *plugin = &recipe->interface;
172 if (cpl_plugin_init(plugin, CPL_PLUGIN_API, MOONS_BINARY_VERSION,
173 CPL_PLUGIN_TYPE_RECIPE,
"moons_science_xswitch2",
174 "Reduces science exposure in xswitch mode",
175 _moons_science_xswitch2_description,
"Regis Haigron",
177 _moons_science_xswitch2_create,
178 _moons_science_xswitch2_exec,
179 _moons_science_xswitch2_destroy)) {
180 cpl_msg_error(cpl_func,
"Plugin initialization failed");
181 (void)cpl_error_set_where(cpl_func);
185 if (cpl_pluginlist_append(list, plugin)) {
186 cpl_msg_error(cpl_func,
"Error adding plugin to list");
187 (void)cpl_error_set_where(cpl_func);
205_moons_science_xswitch2_create(cpl_plugin *plugin)
210 if (cpl_error_get_code() != CPL_ERROR_NONE) {
211 cpl_msg_error(cpl_func,
"%s():%d: An error is already set: %s",
212 cpl_func, __LINE__, cpl_error_get_where());
213 return (
int)cpl_error_get_code();
216 if (plugin == NULL) {
217 cpl_msg_error(cpl_func,
"Null plugin");
218 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
222 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
223 cpl_msg_error(cpl_func,
"Plugin is not a recipe");
224 cpl_ensure_code(0, (
int)CPL_ERROR_TYPE_MISMATCH);
228 recipe = (cpl_recipe *)plugin;
231 recipe->parameters = cpl_parameterlist_new();
232 if (recipe->parameters == NULL) {
233 cpl_msg_error(cpl_func,
"Parameter list allocation failed");
234 cpl_ensure_code(0, (
int)CPL_ERROR_ILLEGAL_OUTPUT);
237 moo_params *params =
moo_params_new(
"moons",
"moons_science_xswitch2");
243 MOO_CORRECT_BIAS_METHOD_MASTER);
266_moons_science_xswitch2_exec(cpl_plugin *plugin)
270 cpl_errorstate initial_errorstate = cpl_errorstate_get();
273 if (cpl_error_get_code() != CPL_ERROR_NONE) {
274 cpl_msg_error(cpl_func,
"%s():%d: An error is already set: %s",
275 cpl_func, __LINE__, cpl_error_get_where());
276 return (
int)cpl_error_get_code();
279 if (plugin == NULL) {
280 cpl_msg_error(cpl_func,
"Null plugin");
281 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
285 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
286 cpl_msg_error(cpl_func,
"Plugin is not a recipe");
287 cpl_ensure_code(0, (
int)CPL_ERROR_TYPE_MISMATCH);
291 recipe = (cpl_recipe *)plugin;
294 if (recipe->parameters == NULL) {
295 cpl_msg_error(cpl_func,
"Recipe invoked with NULL parameter list");
296 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
298 if (recipe->frames == NULL) {
299 cpl_msg_error(cpl_func,
"Recipe invoked with NULL frame set");
300 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
304 recipe_status = _moons_science_xswitch2(recipe->frames, recipe->parameters);
307 if (cpl_dfs_update_product_header(recipe->frames)) {
309 recipe_status = (int)cpl_error_get_code();
312 if (!cpl_errorstate_is_equal(initial_errorstate)) {
315 cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
318 return recipe_status;
330_moons_science_xswitch2_destroy(cpl_plugin *plugin)
334 if (plugin == NULL) {
335 cpl_msg_error(cpl_func,
"Null plugin");
336 cpl_ensure_code(0, (
int)CPL_ERROR_NULL_INPUT);
340 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
341 cpl_msg_error(cpl_func,
"Plugin is not a recipe");
342 cpl_ensure_code(0, (
int)CPL_ERROR_TYPE_MISMATCH);
346 recipe = (cpl_recipe *)plugin;
348 cpl_parameterlist_delete(recipe->parameters);
354_moons_p2pmap(moo_det *arc,
const cpl_frame *p2pmap)
356 cpl_error_code status = CPL_ERROR_NONE;
358 if (p2pmap != NULL) {
367static const cpl_frame *
368find_masterdark_nir(moo_det *det, cpl_frameset *set)
370 const cpl_frame *result = NULL;
373 double exptime = 0.0;
377 moo_det *current_det = NULL;
379 cpl_ensure(det != NULL, CPL_ERROR_NULL_INPUT, NULL);
381 for (num = 1; num <= 2; num++) {
382 for (type = 1; type <= 2; type++) {
384 if (single != NULL) {
387 exptime = dit * ndit;
397 if (find && set != NULL) {
398 int size = cpl_frameset_get_size(set);
399 for (
int i = 0; i < size; i++) {
400 const cpl_frame *current = cpl_frameset_get_position_const(set, i);
402 moo_single *current_single =
407 double current_exptime = dit * ndit;
408 if (fabs(exptime - current_exptime) <= 1E-9) {
422_moons_xswitch_subtractnod(
int inum,
425 const cpl_frame *obj_frame,
426 const cpl_frame *obj_det_frame,
427 const cpl_frame *sky_det_frame,
428 moo_products *products)
430 cpl_frame *result = NULL;
431 char *nod_det_filename = NULL;
432 moo_det *nod_det = NULL;
437 moo_try_check(
moo_det_load(obj_det, badpix_level),
" ");
438 moo_try_check(
moo_det_load(sky_det, badpix_level),
" ");
441 cpl_sprintf(
"%s_OFFSET%d_%s_%d.fits", MOONS_TAG_XSWITCH_SUBTRACTNOD,
444 moo_try_check(nod_det =
448 CPL_FRAME_LEVEL_INTERMEDIATE,
449 MOONS_TAG_XSWITCH_SUBTRACTNOD,
450 nod_det_filename, obj_frame),
454 cpl_free(nod_det_filename);
463_moons_xswitch_prepare(
int inum,
466 const cpl_frame *frame,
467 const char *bpmap_rp_name,
468 const char *bpmap_nl_name,
469 const cpl_frame *masterbias,
470 const cpl_frame *masterdark_vis,
471 cpl_frameset *masterdark_nir_frameset,
472 const cpl_frame *p2pmap,
473 const cpl_frame *coeffs_cube,
474 moo_prepare_params *prepare_params,
475 moo_correct_bias_params *cbias_params,
476 moo_products *products,
479 cpl_frame *result = NULL;
480 const cpl_frame *masterdark_nir = NULL;
482 char *det_filename = NULL;
483 char *det_p2p_filename = NULL;
485 cpl_ensure(frame != NULL, CPL_ERROR_NULL_INPUT, NULL);
487 moo_try_check(det =
moo_prepare(frame, bpmap_rp_name, bpmap_nl_name,
488 masterbias, coeffs_cube, prepare_params),
492 masterdark_nir = find_masterdark_nir(det, masterdark_nir_frameset);
497 cpl_sprintf(
"%s_%s_OFFSET%d_%s_%d.fits", MOONS_TAG_XSWITCH_CORRECTDARK,
498 prefix, offset, mode, inum);
500 MOONS_TAG_XSWITCH_CORRECTDARK, det_filename,
503 moo_try_check(_moons_p2pmap(det, p2pmap),
" ");
505 cpl_sprintf(
"%s_%s_OFFSET%d_%s_%d.fits", MOONS_TAG_XSWITCH_APPLYP2P,
506 prefix, offset, mode, inum);
508 CPL_FRAME_LEVEL_INTERMEDIATE,
509 MOONS_TAG_XSWITCH_APPLYP2P,
510 det_p2p_filename, frame),
514 cpl_free(det_filename);
515 cpl_free(det_p2p_filename);
521_moons_science_xswitch2_check_sof(cpl_frameset *frameset,
522 cpl_frameset *offset_frameset,
523 const char **bpmap_rp_name,
524 const char **bpmap_nl_name,
525 const cpl_frame **masterbias,
526 const cpl_frame **masterdark_vis,
527 cpl_frameset *masterdark_nir,
528 const cpl_frame **p2pmap,
529 const cpl_frame **sformat,
530 const cpl_frame **sky_lines,
531 const cpl_frame **atmo,
532 const cpl_frame **resp,
533 const cpl_frame **tell,
534 const cpl_frame **airglow_group,
535 const cpl_frame **airglow_var,
536 const cpl_frame **solflux,
537 const moo_sub_sky_stare_params *subsky_params)
540 cpl_error_get_code());
543 for (i = 0; i < cpl_frameset_get_size(frameset); ++i) {
544 cpl_frame *current_frame = cpl_frameset_get_position(frameset, i);
545 if (!strcmp(cpl_frame_get_tag(current_frame),
546 MOONS_TAG_OBJECT_XSWITCH)) {
547 cpl_frameset_insert(offset_frameset,
548 cpl_frame_duplicate(current_frame));
550 else if (!strcmp(cpl_frame_get_tag(current_frame),
551 MOONS_TAG_BP_MAP_RP)) {
552 *bpmap_rp_name = cpl_frame_get_filename(current_frame);
554 else if (!strcmp(cpl_frame_get_tag(current_frame),
555 MOONS_TAG_BP_MAP_NL)) {
556 *bpmap_nl_name = cpl_frame_get_filename(current_frame);
558 else if (!strcmp(cpl_frame_get_tag(current_frame),
559 MOONS_TAG_MASTER_BIAS)) {
560 *masterbias = current_frame;
562 else if (!strcmp(cpl_frame_get_tag(current_frame),
563 MOONS_TAG_MASTER_DARK_VIS)) {
564 *masterdark_vis = current_frame;
566 else if (!strcmp(cpl_frame_get_tag(current_frame),
567 MOONS_TAG_MASTER_DARK_NIR)) {
568 cpl_frameset_insert(masterdark_nir,
569 cpl_frame_duplicate(current_frame));
571 else if (!strcmp(cpl_frame_get_tag(current_frame),
572 MOONS_TAG_MASTER_FLAT)) {
573 cpl_frameset_insert(offset_frameset,
574 cpl_frame_duplicate(current_frame));
576 else if (!strcmp(cpl_frame_get_tag(current_frame), MOONS_TAG_P2P_MAP)) {
577 *p2pmap = current_frame;
579 else if (!strcmp(cpl_frame_get_tag(current_frame),
580 MOONS_TAG_FF_TRACE)) {
581 cpl_frameset_insert(offset_frameset,
582 cpl_frame_duplicate(current_frame));
584 else if (!strcmp(cpl_frame_get_tag(current_frame),
585 MOONS_TAG_LINEARITY_COEFF_CUBE)) {
586 cpl_frameset_insert(offset_frameset,
587 cpl_frame_duplicate(current_frame));
589 else if (!strcmp(cpl_frame_get_tag(current_frame),
590 MOONS_TAG_SPECTRAL_FORMAT)) {
591 *sformat = current_frame;
593 else if (!strcmp(cpl_frame_get_tag(current_frame), MOONS_TAG_WAVEMAP)) {
594 cpl_frameset_insert(offset_frameset,
595 cpl_frame_duplicate(current_frame));
597 else if (!strcmp(cpl_frame_get_tag(current_frame),
598 MOONS_TAG_SKY_LINE_LIST)) {
599 *sky_lines = current_frame;
601 else if (!strcmp(cpl_frame_get_tag(current_frame),
602 MOONS_TAG_FF_EXTSPECTRA)) {
603 cpl_frameset_insert(offset_frameset,
604 cpl_frame_duplicate(current_frame));
606 else if (!strcmp(cpl_frame_get_tag(current_frame),
607 MOONS_TAG_F2F_TABLE)) {
608 cpl_frameset_insert(offset_frameset,
609 cpl_frame_duplicate(current_frame));
611 else if (!strcmp(cpl_frame_get_tag(current_frame),
612 MOONS_TAG_ATMOS_EXT)) {
613 *atmo = current_frame;
615 else if (!strcmp(cpl_frame_get_tag(current_frame),
616 MOONS_TAG_RESPONSE)) {
617 *resp = current_frame;
619 else if (!strcmp(cpl_frame_get_tag(current_frame),
620 MOONS_TAG_TELLURIC_CORR)) {
621 *tell = current_frame;
623 else if (!strcmp(cpl_frame_get_tag(current_frame),
624 MOONS_TAG_AIRGLOW_GROUP)) {
625 *airglow_group = current_frame;
627 else if (!strcmp(cpl_frame_get_tag(current_frame),
628 MOONS_TAG_AIRGLOW_VAR)) {
629 *airglow_var = current_frame;
631 else if (!strcmp(cpl_frame_get_tag(current_frame), MOONS_TAG_SOLFLUX)) {
632 *solflux = current_frame;
636 if (*sformat == NULL) {
637 return (
int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
638 "SOF does not have any file tagged "
640 MOONS_TAG_SPECTRAL_FORMAT);
643 if (*sky_lines == NULL) {
644 return (
int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
645 "SOF does not have any file tagged "
647 MOONS_TAG_SKY_LINE_LIST);
650 if (*airglow_group == NULL &&
651 strcmp(subsky_params->method, MOO_SUB_SKY_STARE_METHOD_SKYCORR) == 0) {
652 return (
int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
653 "SOF does not have any file tagged "
655 MOONS_TAG_AIRGLOW_GROUP);
657 if (*airglow_var == NULL &&
658 strcmp(subsky_params->method, MOO_SUB_SKY_STARE_METHOD_SKYCORR) == 0) {
659 return (
int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
660 "SOF does not have any file tagged "
662 MOONS_TAG_AIRGLOW_VAR);
664 if (*solflux == NULL &&
665 strcmp(subsky_params->method, MOO_SUB_SKY_STARE_METHOD_SKYCORR) == 0) {
666 return (
int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
667 "SOF does not have any file tagged "
671 return CPL_ERROR_NONE;
675_moons_science_xswitch2_check_sof_byoffset(cpl_frameset *frameset,
676 cpl_frameset *objA_frameset,
677 cpl_frameset *objB_frameset,
678 const cpl_frame **master_flat,
679 const cpl_frame **fftrace,
680 const cpl_frame **coeffs_cube,
681 const cpl_frame **wmap,
682 const cpl_frame **flat,
683 const cpl_frame **f2f,
684 moo_extract_params *ext_params)
687 cpl_error_get_code());
690 for (i = 0; i < cpl_frameset_get_size(frameset); ++i) {
691 cpl_frame *current_frame = cpl_frameset_get_position(frameset, i);
692 if (!strcmp(cpl_frame_get_tag(current_frame),
693 MOONS_TAG_OBJECT_XSWITCH)) {
694 if (nb_object % 2 == 0) {
695 cpl_frameset_insert(objA_frameset,
696 cpl_frame_duplicate(current_frame));
699 cpl_frameset_insert(objB_frameset,
700 cpl_frame_duplicate(current_frame));
704 else if (!strcmp(cpl_frame_get_tag(current_frame),
705 MOONS_TAG_MASTER_FLAT)) {
706 *master_flat = current_frame;
709 else if (!strcmp(cpl_frame_get_tag(current_frame),
710 MOONS_TAG_FF_TRACE)) {
711 *fftrace = current_frame;
713 else if (!strcmp(cpl_frame_get_tag(current_frame),
714 MOONS_TAG_LINEARITY_COEFF_CUBE)) {
715 *coeffs_cube = current_frame;
717 else if (!strcmp(cpl_frame_get_tag(current_frame), MOONS_TAG_WAVEMAP)) {
718 *wmap = current_frame;
720 else if (!strcmp(cpl_frame_get_tag(current_frame),
721 MOONS_TAG_FF_EXTSPECTRA)) {
722 *flat = current_frame;
724 else if (!strcmp(cpl_frame_get_tag(current_frame),
725 MOONS_TAG_F2F_TABLE)) {
726 *f2f = current_frame;
730 if (nb_object <= 0) {
731 return (
int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
732 "SOF does not have any file tagged "
734 MOONS_TAG_OBJECT_XSWITCH);
737 if (*fftrace == NULL) {
738 return (
int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
739 "SOF does not have any file tagged "
745 return (
int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
746 "SOF does not have any file tagged "
751 return (
int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
752 "SOF does not have any file tagged "
754 MOONS_TAG_FF_EXTSPECTRA);
756 if (*master_flat == NULL &&
757 strcmp(ext_params->method, MOO_EXTRACT_METHOD_OPTIMAL) == 0) {
758 return (
int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
759 "SOF does not have any file tagged "
761 MOONS_TAG_MASTER_FLAT);
763 return CPL_ERROR_NONE;
767_moons_apply_flat(moo_ext *ext,
768 const cpl_frame *flat_frame,
769 const cpl_frame *f2f_frame)
771 cpl_error_code status = CPL_ERROR_NONE;
772 moo_ext *flat = NULL;
776 if (f2f_frame != NULL) {
788_moons_xswitch_rebin(
int inum,
792 const cpl_frame *ref_frame,
793 moo_spectral_format *sformat,
794 moo_sky_lines_list *sky_lines,
796 const cpl_frame *atmo_frame,
797 const cpl_frame *resp_frame,
798 const cpl_frame *tell_frame,
799 moo_rebin_params *rbn_params,
800 moo_products *products,
803 cpl_frame *rbn_frame = NULL;
805 moo_resp *resp = NULL;
806 moo_telluric *telluric = NULL;
809 char *rbn_filename = NULL;
810 char *calibflux_filename = NULL;
811 char *tellcorr_filename = NULL;
813 cpl_ensure(ext != NULL, CPL_ERROR_NULL_INPUT, NULL);
814 cpl_ensure(ref_frame != NULL, CPL_ERROR_NULL_INPUT, NULL);
816 rbn_filename = cpl_sprintf(
"%s_RBNSPECTRA_OFFSET%d_%s_%d.fits", prefix,
818 moo_try_check(rbn =
moo_rebin(ext, wmap, sformat, rbn_params, rbn_filename),
821 moo_try_check(rbn_frame =
823 MOONS_TAG_SCIENCE_XSWITCH_RBNSPECTRA,
824 rbn_filename, ref_frame),
827 if (atmo_frame != NULL && resp_frame != NULL) {
831 calibflux_filename = cpl_sprintf(
"%s_RBNFLXSPECTRA_OFFSET%d_%s_%d.fits",
832 prefix, offset, mode, inum);
835 products, rbn, CPL_FRAME_LEVEL_FINAL,
836 MOONS_TAG_SCIENCE_XSWITCH_RBNFLXSPECTRA,
837 calibflux_filename, ref_frame),
841 cpl_msg_info(__func__,
"No flux calibration");
844 if (tell_frame != NULL) {
848 cpl_sprintf(
"%s_RBNTELLCORRSPECTRA_OFFSET%d_%s_%d.fits", prefix,
852 products, rbn, CPL_FRAME_LEVEL_FINAL,
853 MOONS_TAG_SCIENCE_XSWITCH_RBNTELLCORRSPECTRA,
854 tellcorr_filename, ref_frame),
858 cpl_msg_info(__func__,
"No telluric correction");
862 cpl_free(tellcorr_filename);
863 cpl_free(calibflux_filename);
864 cpl_free(rbn_filename);
873_moons_xswitch_extract(
int inum,
876 const cpl_frame *ref_frame,
877 const cpl_frame *det_frame,
880 moo_spectral_format *sformat,
881 moo_sky_lines_list *skylines,
882 const cpl_frame *masterflat_frame,
883 const cpl_frame *flat_frame,
884 const cpl_frame *f2f_frame,
885 moo_extract_params *extract_params,
886 moo_products *products,
889 cpl_frame *ext_frame = NULL;
894 char *ext_filename = NULL;
895 char *extff_filename = NULL;
897 cpl_ensure(det_frame != NULL, CPL_ERROR_NULL_INPUT, NULL);
899 ext_filename = cpl_sprintf(
"%s_EXTSPECTRA_OFFSET%d_%s_%d.fits", prefix,
901 if (masterflat_frame != NULL) {
906 moo_extract(det, loc, psf, extract_params, ext_filename),
908 moo_try_check(ext_frame =
910 CPL_FRAME_LEVEL_INTERMEDIATE,
911 MOONS_TAG_SCIENCE_XSWITCH_EXTSPECTRA,
912 ext_filename, ref_frame),
915 moo_try_check(_moons_apply_flat(ext, flat_frame, f2f_frame),
" ");
917 extff_filename = cpl_sprintf(
"%s_EXTFFSPECTRA_OFFSET%d_%s_%d.fits", prefix,
920 moo_try_check(ext_frame =
922 CPL_FRAME_LEVEL_INTERMEDIATE,
923 MOONS_TAG_SCIENCE_XSWITCH_EXTSPECTRA,
924 extff_filename, ref_frame),
928 cpl_free(ext_filename);
929 cpl_free(extff_filename);
937_moons_sort_mjdobs(
const cpl_frame *a,
const cpl_frame *b)
941 const char *filenameA = cpl_frame_get_filename(a);
942 const char *filenameB = cpl_frame_get_filename(b);
944 cpl_propertylist *lista = cpl_propertylist_load(filenameA, 0);
945 cpl_propertylist *listb = cpl_propertylist_load(filenameB, 0);
947 if (cpl_propertylist_has(lista, MOO_PFITS_MJDOBS) &&
948 cpl_propertylist_has(listb, MOO_PFITS_MJDOBS)) {
954 else if (mjdA > mjdB) {
961 cpl_propertylist_delete(listb);
962 cpl_propertylist_delete(lista);
967_moons_compare_offset(
const cpl_frame *a,
const cpl_frame *b)
970 const char *filenameA = cpl_frame_get_filename(a);
971 cpl_propertylist *lista = cpl_propertylist_load(filenameA, 0);
974 const char *filenameB = cpl_frame_get_filename(b);
975 cpl_propertylist *listb = cpl_propertylist_load(filenameB, 0);
978 if (fabs(oA - oB) < 1E-12) {
982 cpl_propertylist_delete(lista);
983 cpl_propertylist_delete(listb);
988_xswitch_target_table(cpl_frame *frameA,
991 moo_target_table_params *params)
995 moo_rbn *objA_rbn = NULL;
996 moo_rbn *objB_rbn = NULL;
1001 moo_try_check(result =
1011_xswitch_nod_rebin(cpl_frameset *det_frameset,
1014 const cpl_frame *ref_frame,
1017 moo_spectral_format *sformat,
1018 moo_sky_lines_list *skylines,
1019 const cpl_frame *masterflat_frame,
1020 const cpl_frame *flat_frame,
1021 const cpl_frame *f2f_frame,
1022 const cpl_frame *atmo_frame,
1023 const cpl_frame *resp_frame,
1024 const cpl_frame *tell_frame,
1025 moo_extract_params *extract_params,
1026 moo_rebin_params *rbn_params,
1027 moo_products *products,
1030 cpl_frame *result = NULL;
1031 moo_detlist *detlist = NULL;
1032 moo_det *combined = NULL;
1034 moo_psf *psf = NULL;
1035 moo_ext *ext = NULL;
1036 moo_crh_params *crh_params = NULL;
1037 moo_atm *atm = NULL;
1038 moo_resp *resp = NULL;
1039 moo_telluric *telluric = NULL;
1040 moo_rbn *rbn = NULL;
1042 char *comb_filename = NULL;
1043 char *ext_filename = NULL;
1044 char *extff_filename = NULL;
1046 char *rbn_filename = NULL;
1047 char *calibflux_filename = NULL;
1048 char *tellcorr_filename = NULL;
1050 cpl_ensure(det_frameset != NULL, CPL_ERROR_NULL_INPUT, NULL);
1052 cpl_errorstate prestate = cpl_errorstate_get();
1053 crh_params = moo_crh_params_new();
1054 crh_params->method = MOO_CRH_METHOD_MEDIAN;
1056 moo_try_check(combined =
moo_remove_CRH(detlist, NULL, crh_params),
" ");
1058 cpl_sprintf(
"%s_COMB2D_OFFSET%d_%s.fits", prefix, offset, mode);
1061 CPL_FRAME_LEVEL_INTERMEDIATE,
1062 MOONS_TAG_XSWITCH_REMOVECRH, comb_filename,
1067 cpl_sprintf(
"%s_EXTSPECTRA_OFFSET%d_%s.fits", prefix, offset, mode);
1068 if (masterflat_frame != NULL) {
1072 moo_try_check(ext =
moo_extract(combined, loc, psf, extract_params,
1076 CPL_FRAME_LEVEL_INTERMEDIATE,
1077 MOONS_TAG_SCIENCE_XSWITCH_EXTSPECTRA,
1078 ext_filename, ref_frame),
1081 moo_try_check(_moons_apply_flat(ext, flat_frame, f2f_frame),
" ");
1084 cpl_sprintf(
"%s_EXTFFSPECTRA_OFFSET%d_%s.fits", prefix, offset, mode);
1087 CPL_FRAME_LEVEL_INTERMEDIATE,
1088 MOONS_TAG_SCIENCE_XSWITCH_EXTSPECTRA,
1089 extff_filename, ref_frame),
1093 cpl_sprintf(
"%s_RBNSPECTRA_OFFSET%d_%s.fits", prefix, offset, mode);
1094 moo_try_check(rbn =
moo_rebin(ext, wmap, sformat, rbn_params, rbn_filename),
1097 moo_try_check(result =
1099 MOONS_TAG_SCIENCE_XSWITCH_RBNSPECTRA,
1100 rbn_filename, ref_frame),
1103 if (atmo_frame != NULL && resp_frame != NULL) {
1107 calibflux_filename = cpl_sprintf(
"%s_RBNFLXSPECTRA_OFFSET%d_%s.fits",
1108 prefix, offset, mode);
1111 products, rbn, CPL_FRAME_LEVEL_FINAL,
1112 MOONS_TAG_SCIENCE_XSWITCH_RBNFLXSPECTRA,
1113 calibflux_filename, ref_frame),
1117 cpl_msg_info(__func__,
"No flux calibration");
1120 if (tell_frame != NULL) {
1124 cpl_sprintf(
"%s_RBNTELLCORRSPECTRA_OFFSET%d_%s.fits", prefix,
1128 products, rbn, CPL_FRAME_LEVEL_FINAL,
1129 MOONS_TAG_SCIENCE_XSWITCH_RBNTELLCORRSPECTRA,
1130 tellcorr_filename, ref_frame),
1134 cpl_msg_info(__func__,
"No telluric correction");
1136 result = cpl_frame_duplicate(result);
1139 if (!cpl_errorstate_is_equal(prestate)) {
1140 cpl_frame_delete(result);
1144 moo_crh_params_delete(crh_params);
1146 cpl_free(comb_filename);
1150 cpl_free(ext_filename);
1151 cpl_free(extff_filename);
1152 cpl_free(rbn_filename);
1155 cpl_free(tellcorr_filename);
1156 cpl_free(calibflux_filename);
1166_moons_xswitch_sci1d(
int inum,
1169 const cpl_frame *obja_frame,
1170 const cpl_frame *obja_rbn_frame,
1171 const cpl_frame *objb_frame,
1172 const cpl_frame *objb_rbn_frame,
1173 moo_sky_lines_list *sky_lines,
1174 const cpl_frame *f2f_frame,
1175 const cpl_frame *airglow_group_frame,
1176 const cpl_frame *airglow_var_frame,
1177 const cpl_frame *solflux_frame,
1179 moo_sub_sky_stare_params *sky_params,
1180 moo_products *products,
1182 cpl_frame **result_psci1d)
1184 cpl_frame *result_sci1d = NULL;
1185 moo_rbn *objb_rbn = NULL;
1186 moo_rbn *obja_rbn = NULL;
1187 moo_sci *sci1d = NULL;
1188 moo_sci *psci1d = NULL;
1189 moo_f2f *f2f = NULL;
1191 char *sci1d_filename = NULL;
1192 char *psci1d_filename = NULL;
1194 cpl_ensure(obja_rbn_frame != NULL, CPL_ERROR_NULL_INPUT, NULL);
1195 cpl_ensure(objb_rbn_frame != NULL, CPL_ERROR_NULL_INPUT, NULL);
1197 cpl_errorstate prestate = cpl_errorstate_get();
1203 cpl_sprintf(
"%s_SCI1D_OFFSET%d_%s_%d.fits", prefix, offset, mode, inum);
1205 if (f2f_frame != NULL) {
1208 moo_try_check(sci1d =
1210 solflux_frame, airglow_group_frame,
1211 airglow_var_frame, sky_params,
1212 sci1d_filename, MOO_SCI1D_NOT_PAIRED),
1217 moo_try_check(result_sci1d =
1219 CPL_FRAME_LEVEL_FINAL,
1220 MOONS_TAG_SCIENCE_XSWITCH_SKSSPECTRA,
1221 sci1d_filename, obja_frame),
1223 psci1d_filename = cpl_sprintf(
"%s_SCI1D_PAIRED_OFFSET%d_%s_%d.fits", prefix,
1224 offset, mode, inum);
1225 moo_try_check(psci1d =
1227 solflux_frame, airglow_group_frame,
1228 airglow_var_frame, sky_params,
1229 psci1d_filename, MOO_SCI1D_PAIRED),
1234 moo_try_check(*result_psci1d =
1236 CPL_FRAME_LEVEL_FINAL,
1237 MOONS_TAG_SCIENCE_XSWITCH_SKSSPECTRA,
1238 psci1d_filename, objb_frame),
1242 if (!cpl_errorstate_is_equal(prestate)) {
1243 cpl_frame_delete(result_sci1d);
1244 result_sci1d = NULL;
1245 *result_psci1d = NULL;
1247 cpl_free(sci1d_filename);
1248 cpl_free(psci1d_filename);
1254 return result_sci1d;
1258_moons_xswitch_sci2d(
const char *mode,
1260 const cpl_frame *ref_frame,
1261 const cpl_frame *nod_rbn_frame,
1262 const cpl_frameset *objB_rbn_frameset,
1263 const cpl_frameset *objA_rbn_frameset,
1264 moo_sky_lines_list *sky_lines,
1267 moo_products *products,
1270 cpl_frame *result = NULL;
1271 moo_rbnlist *objA_rbnlist = NULL;
1272 moo_rbnlist *objB_rbnlist = NULL;
1273 moo_rbn *nod_rbn = NULL;
1274 moo_rbn *objB_rbn = NULL;
1275 moo_rbn *objA_rbn = NULL;
1277 moo_sci *sci2d = NULL;
1278 char *sci2d_filename = NULL;
1280 cpl_ensure(nod_rbn_frame != NULL, CPL_ERROR_NULL_INPUT, NULL);
1281 cpl_ensure(objA_rbn_frameset != NULL, CPL_ERROR_NULL_INPUT, NULL);
1282 cpl_ensure(objB_rbn_frameset != NULL, CPL_ERROR_NULL_INPUT, NULL);
1284 cpl_errorstate prestate = cpl_errorstate_get();
1293 cpl_sprintf(
"%s_SCI2D_OFFSET%d_%s.fits", prefix, offset, mode);
1295 moo_try_check(sci2d =
1296 moo_create_sci2d(nod_rbn, objB_rbn, objA_rbn,
1297 target_table, ispaired, sci2d_filename),
1302 moo_try_check(result =
1304 CPL_FRAME_LEVEL_FINAL,
1305 MOONS_TAG_SCIENCE_XSWITCH_SKSSPECTRA,
1306 sci2d_filename, ref_frame),
1310 if (!cpl_errorstate_is_equal(prestate)) {
1311 cpl_frame_delete(result);
1314 cpl_free(sci2d_filename);
1325_moons_science_xswitch2_byoffset(cpl_frameset *frameset,
1326 cpl_frameset *ref_frameset,
1327 const char *bpmap_rp_name,
1328 const char *bpmap_nl_name,
1329 const cpl_frame *masterbias,
1330 const cpl_frame *masterdark_vis,
1331 cpl_frameset *masterdark_nir,
1332 const cpl_frame *p2pmap,
1333 const cpl_frame *sformat_frame,
1334 moo_sky_lines_list *sky_lines,
1335 const cpl_frame *airglow_group_frame,
1336 const cpl_frame *solflux_frame,
1337 const cpl_frame *airglow_var_frame,
1338 const cpl_frame *atmo_frame,
1339 const cpl_frame *resp_frame,
1340 const cpl_frame *tell_frame,
1341 moo_prepare_params *prepare_params,
1342 moo_correct_bias_params *correct_bias_params,
1343 moo_extract_params *extract_params,
1344 moo_wavesol_params *wavesol_params,
1345 moo_rebin_params *rbn_params,
1346 moo_target_table_params *target_table_params,
1347 moo_sub_sky_stare_params *sky_params,
1348 moo_coadd_params *coadd_params,
1349 moo_products *products)
1352 cpl_frame *result = NULL;
1353 moo_loc *loc = NULL;
1354 moo_spectral_format *sformat = NULL;
1355 moo_map *wmap = NULL;
1356 moo_map *wmap_tuned = NULL;
1357 moo_extlist *objA_extlist = NULL;
1358 moo_extlist *objB_extlist = NULL;
1359 moo_extlist *wavemap_extlist = NULL;
1360 moo_ext *sum_ext = NULL;
1362 cpl_frameset *objA_frameset = NULL;
1363 cpl_frameset *objB_frameset = NULL;
1365 cpl_frameset *objA_det_frameset = NULL;
1366 cpl_frameset *objB_det_frameset = NULL;
1367 cpl_frameset *nod_det_frameset = NULL;
1369 cpl_frameset *objB_ext_frameset = NULL;
1370 cpl_frameset *objA_ext_frameset = NULL;
1372 cpl_frameset *objB_rbn_frameset = NULL;
1373 cpl_frameset *objA_rbn_frameset = NULL;
1374 cpl_frame *nod_rbn_frame = NULL;
1376 cpl_frameset *objB_ref_frameset = NULL;
1377 cpl_frameset *objA_sci1d_frameset = NULL;
1378 cpl_frameset *objB_sci1d_frameset = NULL;
1380 const cpl_frame *master_flat = NULL;
1381 const cpl_frame *fftrace = NULL;
1382 const cpl_frame *coeffs_cube = NULL;
1383 const cpl_frame *wmap_frame = NULL;
1384 const cpl_frame *flat_frame = NULL;
1385 const cpl_frame *f2f_frame = NULL;
1387 char *sum_ext_filename = NULL;
1388 const char *refA_filename = NULL;
1389 cpl_propertylist *refA_header = NULL;
1392 const char *mode_name = NULL;
1394 char *wmap_tuned_filename = NULL;
1395 int wavemap_extlist_size = 0;
1398 char *xswitch_ttable_filename = NULL;
1400 moo_scilist *sci1d_list = NULL;
1401 moo_sci *sci1d_coadd = NULL;
1402 char *coadd1d_filename = NULL;
1404 moo_scilist *psci1d_list = NULL;
1405 moo_sci *psci1d_coadd = NULL;
1406 char *pcoadd1d_filename = NULL;
1408 cpl_errorstate prestate = cpl_errorstate_get();
1409 objA_frameset = cpl_frameset_new();
1410 objB_frameset = cpl_frameset_new();
1412 objA_det_frameset = cpl_frameset_new();
1413 objB_det_frameset = cpl_frameset_new();
1414 nod_det_frameset = cpl_frameset_new();
1416 objA_ext_frameset = cpl_frameset_new();
1417 objB_ext_frameset = cpl_frameset_new();
1419 objA_rbn_frameset = cpl_frameset_new();
1420 objB_rbn_frameset = cpl_frameset_new();
1422 objA_sci1d_frameset = cpl_frameset_new();
1423 objB_sci1d_frameset = cpl_frameset_new();
1425 objB_ref_frameset = cpl_frameset_new();
1427 moo_try_check(_moons_science_xswitch2_check_sof_byoffset(
1428 frameset, objA_frameset, objB_frameset, &master_flat,
1429 &fftrace, &coeffs_cube, &wmap_frame, &flat_frame,
1430 &f2f_frame, extract_params),
1433 int nb_objA = cpl_frameset_get_size(objA_frameset);
1434 int nb_objB = cpl_frameset_get_size(objB_frameset);
1435 cpl_frame *ref_frameA = cpl_frameset_get_position(objA_frameset, 0);
1436 cpl_frameset_insert(ref_frameset, cpl_frame_duplicate(ref_frameA));
1438 cpl_frame *ref_frameB = cpl_frameset_get_position(objB_frameset, 0);
1439 refA_filename = cpl_frame_get_filename(ref_frameA);
1444 moo_try_check(refA_header = cpl_propertylist_load(refA_filename, 0),
" ");
1446 cpl_propertylist_delete(refA_header);
1449 cpl_msg_info(__func__,
"Do offset %d use mode %s", offset, mode_name);
1451 for (
int i = 0; i < nb_objA; i++) {
1452 cpl_msg_info(__func__,
"---Prepare object A: %d/%d", i + 1, nb_objA);
1453 cpl_frame *objA_frame = NULL;
1454 moo_try_check(objA_frame = cpl_frameset_get_position(objA_frameset, i),
1457 _moons_xswitch_prepare(i, mode_name, offset, objA_frame,
1458 bpmap_rp_name, bpmap_nl_name, masterbias,
1459 masterdark_vis, masterdark_nir, p2pmap,
1460 coeffs_cube, prepare_params,
1461 correct_bias_params, products,
"A");
1462 cpl_frameset_insert(objA_det_frameset, cpl_frame_duplicate(frame));
1465 for (
int i = 0; i < nb_objB; i++) {
1466 cpl_msg_info(__func__,
"---Prepare object B: %d/%d", i + 1, nb_objA);
1467 cpl_frame *objB_frame = NULL;
1468 moo_try_check(objB_frame = cpl_frameset_get_position(objB_frameset, i),
1471 _moons_xswitch_prepare(i, mode_name, offset, objB_frame,
1472 bpmap_rp_name, bpmap_nl_name, masterbias,
1473 masterdark_vis, masterdark_nir, p2pmap,
1474 coeffs_cube, prepare_params,
1475 correct_bias_params, products,
"B");
1476 cpl_frameset_insert(objB_det_frameset, cpl_frame_duplicate(frame));
1479 moo_try_check(wmap = moo_map_load(wmap_frame),
" ");
1482 for (
int i = 0; i < nb_objA; i++) {
1483 cpl_frame *objA_frame = NULL;
1484 cpl_frame *objA_det_frame = NULL;
1485 cpl_frame *objB_det_frame = NULL;
1486 moo_try_check(objA_frame = cpl_frameset_get_position(objA_frameset, i),
1488 moo_try_check(objA_det_frame =
1489 cpl_frameset_get_position(objA_det_frameset, i),
1491 moo_try_check(objB_det_frame =
1492 cpl_frameset_get_position(objB_det_frameset, i),
1494 cpl_msg_info(__func__,
"---Prepare nod %d/%d using object A:%s B:%s",
1495 i + 1, nb_objA, cpl_frame_get_filename(objA_det_frame),
1496 cpl_frame_get_filename(objB_det_frame));
1498 _moons_xswitch_subtractnod(i, mode_name, offset, objA_frame,
1499 objA_det_frame, objB_det_frame,
1501 cpl_frameset_insert(nod_det_frameset, cpl_frame_duplicate(frame));
1503 int nb_nod = cpl_frameset_get_size(nod_det_frameset);
1505 for (
int i = 0; i < nb_objA; i++) {
1506 cpl_frame *objA_frame = NULL;
1507 cpl_frame *objA_det_frame = NULL;
1508 cpl_msg_info(__func__,
"---Extract object A: %d/%d", i + 1, nb_objA);
1509 moo_try_check(objA_frame = cpl_frameset_get_position(objA_frameset, i),
1511 moo_try_check(objA_det_frame =
1512 cpl_frameset_get_position(objA_det_frameset, i),
1515 _moons_xswitch_extract(i, mode_name, offset, objA_frame,
1516 objA_det_frame, loc, wmap, sformat,
1517 sky_lines, master_flat, flat_frame,
1518 f2f_frame, extract_params, products,
1520 cpl_frameset_insert(objA_ext_frameset, cpl_frame_duplicate(frame));
1523 for (
int i = 0; i < nb_objB; i++) {
1524 cpl_frame *objB_frame = NULL;
1525 cpl_frame *objB_det_frame = NULL;
1526 cpl_msg_info(__func__,
"---Extract object B: %d/%d", i + 1, nb_objB);
1527 moo_try_check(objB_frame = cpl_frameset_get_position(objB_frameset, i),
1529 moo_try_check(objB_det_frame =
1530 cpl_frameset_get_position(objB_det_frameset, i),
1533 _moons_xswitch_extract(i, mode_name, offset, objB_frame,
1534 objB_det_frame, loc, wmap, sformat,
1535 sky_lines, master_flat, flat_frame,
1536 f2f_frame, extract_params, products,
1538 cpl_frameset_insert(objB_ext_frameset, cpl_frame_duplicate(frame));
1545 for (
int i = 0; i < nb_objA; i++) {
1548 wavemap_extlist_size++;
1550 for (
int i = 0; i < nb_objB; i++) {
1553 wavemap_extlist_size++;
1557 cpl_sprintf(
"XSWITCH_EXT_SUM_OFFSET%d_%s.fits", offset, mode_name);
1560 CPL_FRAME_LEVEL_TEMPORARY,
1561 MOONS_TAG_SCIENCE_XSWITCH_EXTSPECTRA,
1562 sum_ext_filename, ref_frameA),
1564 moo_map *used_wmap = NULL;
1565 const char *wavesol_control = wavesol_params->control;
1566 if ((strcmp(wavesol_control, MOO_WAVESOL_CONTROL_CHECK) == 0) ||
1567 (strcmp(wavesol_control, MOO_WAVESOL_CONTROL_UPDATE) == 0)) {
1568 const char *sky_lines_name = sky_lines->filename;
1569 moo_try_check(wmap_tuned =
moo_wavesol(sum_ext, sky_lines_name, sformat,
1570 loc, wmap, wavesol_params),
1572 if (strcmp(wavesol_control, MOO_WAVESOL_CONTROL_UPDATE) == 0) {
1573 used_wmap = wmap_tuned;
1574 wmap_tuned_filename =
1575 cpl_sprintf(
"XSWICTH_WMAP_TUNED_OFFSET%d_%s.fits", offset,
1584 for (
int i = 0; i < nb_objA; i++) {
1585 cpl_frame *objA_frame = NULL;
1587 cpl_msg_info(__func__,
"---Rebin object A: %d/%d", i + 1, nb_objA);
1588 moo_try_check(objA_frame = cpl_frameset_get_position(objA_frameset, i),
1591 _moons_xswitch_rebin(i, mode_name, offset, objA_ext, objA_frame,
1592 sformat, sky_lines, used_wmap, atmo_frame,
1593 resp_frame, tell_frame, rbn_params, products,
1595 cpl_frameset_insert(objA_rbn_frameset, cpl_frame_duplicate(frame));
1598 for (
int i = 0; i < nb_objB; i++) {
1599 cpl_frame *objB_frame = NULL;
1601 cpl_msg_info(__func__,
"---Rebin object B: %d/%d", i + 1, nb_objB);
1602 moo_try_check(objB_frame = cpl_frameset_get_position(objB_frameset, i),
1605 _moons_xswitch_rebin(i, mode_name, offset, objB_ext, objB_frame,
1606 sformat, sky_lines, used_wmap, atmo_frame,
1607 resp_frame, tell_frame, rbn_params, products,
1609 cpl_frameset_insert(objB_rbn_frameset, cpl_frame_duplicate(frame));
1613 moo_try_check(nod_rbn_frame =
1614 _xswitch_nod_rebin(nod_det_frameset, mode_name,
1615 offset, ref_frameA, loc, used_wmap,
1616 sformat, sky_lines, master_flat,
1617 flat_frame, f2f_frame, atmo_frame,
1618 resp_frame, tell_frame,
1619 extract_params, rbn_params,
1620 products,
"XSWITCH_NOD"),
1623 cpl_frame *objA_rbn_frame = NULL;
1624 cpl_frame *objB_rbn_frame = NULL;
1625 cpl_frame *sci_frameA = NULL;
1626 cpl_frame *sci_frameB = NULL;
1628 moo_try_check(objA_rbn_frame =
1629 cpl_frameset_get_position(objA_rbn_frameset, 0),
1631 moo_try_check(objB_rbn_frame =
1632 cpl_frameset_get_position(objB_rbn_frameset, 0),
1635 moo_try_check(xswitch_target_table =
1636 _xswitch_target_table(objA_rbn_frame, objB_rbn_frame,
1638 target_table_params),
1640 xswitch_ttable_filename =
1641 cpl_sprintf(
"%s_OFFSET%d_%s.fits", MOONS_TAG_XSWITCH_TARGET_TABLE,
1646 CPL_FRAME_LEVEL_INTERMEDIATE,
1647 MOONS_TAG_XSWITCH_TARGET_TABLE,
1648 xswitch_ttable_filename, ref_frameA),
1651 moo_try_check(sci_frameA =
1652 _moons_xswitch_sci2d(mode_name, offset, ref_frameA,
1653 nod_rbn_frame, objB_rbn_frameset,
1654 objA_rbn_frameset, sky_lines,
1655 xswitch_target_table,
1656 MOO_SCI2D_NOT_PAIRED, products,
1659 moo_try_check(sci_frameB =
1660 _moons_xswitch_sci2d(mode_name, offset, ref_frameB,
1661 nod_rbn_frame, objB_rbn_frameset,
1662 objA_rbn_frameset, sky_lines,
1663 xswitch_target_table,
1664 MOO_SCI2D_PAIRED, products,
1665 "XSWITCH_NOD_PAIRED"),
1667 for (
int i = 0; i < nb_objA; i++) {
1668 cpl_frame *objA_frame = NULL;
1669 cpl_frame *objA_rbn_framel = NULL;
1670 cpl_frame *objB_frame = NULL;
1671 cpl_frame *objB_rbn_framel = NULL;
1672 cpl_frame *sci_frame = NULL;
1673 cpl_frame *psci_frame = NULL;
1674 moo_try_check(objA_frame =
1675 cpl_frameset_get_position(objA_frameset, i),
1677 moo_try_check(objA_rbn_framel =
1678 cpl_frameset_get_position(objA_rbn_frameset, i),
1680 moo_try_check(objB_frame =
1681 cpl_frameset_get_position(objB_frameset, i),
1683 moo_try_check(objB_rbn_framel =
1684 cpl_frameset_get_position(objB_rbn_frameset, i),
1687 cpl_msg_info(__func__,
1688 "---Create sci1d: %d/%d use objectA:%s objectB: %s",
1690 cpl_frame_get_filename(objA_rbn_framel),
1691 cpl_frame_get_filename(objB_rbn_framel));
1693 moo_try_check(sci_frame = _moons_xswitch_sci1d(
1694 i, mode_name, offset, objA_frame, objA_rbn_framel,
1695 objB_frame, objB_rbn_framel, sky_lines, f2f_frame,
1696 airglow_group_frame, airglow_var_frame,
1697 solflux_frame, xswitch_target_table, sky_params,
1698 products,
"XSWITCH_OBJECTA", &psci_frame),
1700 cpl_frameset_insert(objA_sci1d_frameset,
1701 cpl_frame_duplicate(sci_frame));
1702 cpl_frameset_insert(objB_sci1d_frameset,
1703 cpl_frame_duplicate(psci_frame));
1705 int sci1d_size = cpl_frameset_get_size(objA_sci1d_frameset);
1706 if (sci1d_size > 0) {
1708 coadd1d_filename = cpl_sprintf(
"XSWITCH_SCI1D_OFFSET%d_%s.fits",
1711 sci1d_coadd =
moo_coadd(sci1d_list, coadd_params, coadd1d_filename);
1716 CPL_FRAME_LEVEL_FINAL,
1717 MOONS_TAG_XSWITCH_SKSSPECTRA,
1718 coadd1d_filename, ref_frameA),
1721 int psci1d_size = cpl_frameset_get_size(objA_sci1d_frameset);
1722 if (psci1d_size > 0) {
1725 cpl_sprintf(
"XSWITCH_SCI1D_PAIRED_OFFSET%d_%s.fits", offset,
1729 moo_coadd(psci1d_list, coadd_params, pcoadd1d_filename);
1734 CPL_FRAME_LEVEL_FINAL,
1735 MOONS_TAG_XSWITCH_SKSSPECTRA,
1736 pcoadd1d_filename, ref_frameB),
1740 moo_sci *sci2d = NULL;
1741 moo_sci *psci2d = NULL;
1742 moo_sci *scicomb = NULL;
1743 char *result_filename = NULL;
1747 result_filename = cpl_sprintf(
"XSWITCH_SCI_OFFSET%d_%s.fits",
1750 scicomb = moo_combine_pair_sci(xswitch_target_table, sci1d_coadd,
1751 psci1d_coadd, sci2d, psci2d,
1757 products, scicomb, CPL_FRAME_LEVEL_FINAL,
1758 MOONS_TAG_XSWITCH_SKSSPECTRA, result_filename,
1762 cpl_free(result_filename);
1770 if (!cpl_errorstate_is_equal(prestate)) {
1771 cpl_propertylist_delete(refA_header);
1776 if (wavemap_extlist != NULL) {
1777 for (
int i = 0; i < nb_objA * 2; i++) {
1787 cpl_free(xswitch_ttable_filename);
1789 cpl_free(sum_ext_filename);
1790 cpl_free(wmap_tuned_filename);
1793 cpl_frameset_delete(objA_frameset);
1794 cpl_frameset_delete(objB_frameset);
1796 cpl_frameset_delete(nod_det_frameset);
1797 cpl_frameset_delete(objA_det_frameset);
1798 cpl_frameset_delete(objB_det_frameset);
1800 cpl_frameset_delete(objB_ext_frameset);
1801 cpl_frameset_delete(objA_ext_frameset);
1803 cpl_frameset_delete(objB_rbn_frameset);
1804 cpl_frameset_delete(objA_rbn_frameset);
1806 cpl_frameset_delete(objA_sci1d_frameset);
1807 cpl_frameset_delete(objB_sci1d_frameset);
1808 cpl_frame_delete(nod_rbn_frame);
1810 cpl_frameset_delete(objB_ref_frameset);
1812 cpl_free(coadd1d_filename);
1816 cpl_free(pcoadd1d_filename);
1824_moons_science_xswitch2(cpl_frameset *frameset,
1825 const cpl_parameterlist *parlist)
1828 moo_prepare_params *prepare_params = NULL;
1829 moo_correct_bias_params *correct_bias_params = NULL;
1830 moo_extract_params *extract_params = NULL;
1831 moo_wavesol_params *wavesol_params = NULL;
1832 moo_rebin_params *rbn_params = NULL;
1833 moo_target_table_params *target_table_params = NULL;
1834 moo_combine_pair_params *combine_pair_params = NULL;
1835 moo_sub_sky_stare_params *sky_params = NULL;
1836 moo_coadd_params *coadd_params = NULL;
1837 moo_create_s1d_params *s1d_params = NULL;
1839 moo_scilist *sci_list = NULL;
1840 moo_sci *sci_coadd = NULL;
1842 cpl_frameset *offset_frameset = NULL;
1843 cpl_frameset *set = NULL;
1844 cpl_frameset *sci_set = NULL;
1845 cpl_frameset *ref_frameset = NULL;
1847 const char *bpmap_rp_name = NULL;
1848 const char *bpmap_nl_name = NULL;
1849 const cpl_frame *masterbias = NULL;
1850 const cpl_frame *masterdark_vis = NULL;
1851 cpl_frameset *masterdark_nir = NULL;
1852 const cpl_frame *p2pmap = NULL;
1853 const cpl_frame *sformat_frame = NULL;
1854 const cpl_frame *sky_lines_frame = NULL;
1855 const cpl_frame *atmo_frame = NULL;
1856 const cpl_frame *resp_frame = NULL;
1857 const cpl_frame *tell_frame = NULL;
1859 const cpl_frame *airglow_group_frame = NULL;
1860 const cpl_frame *solflux_frame = NULL;
1861 const cpl_frame *airglow_var_frame = NULL;
1862 const cpl_frame *ref_frame = NULL;
1864 cpl_size *selection = NULL;
1865 moo_sky_lines_list *skylines = NULL;
1866 char *coadd_filename = NULL;
1867 char *calibflux_filename = NULL;
1869 cpl_errorstate prestate = cpl_errorstate_get();
1871 moo_products *products =
1873 PACKAGE
"/" PACKAGE_VERSION);
1878 moo_try_check(correct_bias_params =
1884 moo_try_check(target_table_params =
1887 moo_try_check(combine_pair_params =
1893 moo_try_check(wavesol_params =
1898 offset_frameset = cpl_frameset_new();
1899 sci_set = cpl_frameset_new();
1901 ref_frameset = cpl_frameset_new();
1902 masterdark_nir = cpl_frameset_new();
1904 moo_try_check(_moons_science_xswitch2_check_sof(
1905 frameset, offset_frameset, &bpmap_rp_name, &bpmap_nl_name,
1906 &masterbias, &masterdark_vis, masterdark_nir, &p2pmap,
1907 &sformat_frame, &sky_lines_frame, &atmo_frame,
1908 &resp_frame, &tell_frame, &airglow_group_frame,
1909 &airglow_var_frame, &solflux_frame, sky_params),
1913 moo_try_check(selection =
1914 cpl_frameset_labelise(offset_frameset,
1915 &_moons_compare_offset, &nsel),
1920 for (
int i = 0; i < nsel; i++) {
1921 cpl_frame *result = NULL;
1922 moo_try_check(set = cpl_frameset_extract(offset_frameset, selection, i),
1924 moo_try_check(result = _moons_science_xswitch2_byoffset(
1925 set, ref_frameset, bpmap_rp_name, bpmap_nl_name,
1926 masterbias, masterdark_vis, masterdark_nir, p2pmap,
1927 sformat_frame, skylines, airglow_group_frame,
1928 solflux_frame, airglow_var_frame, atmo_frame,
1929 resp_frame, tell_frame, prepare_params,
1930 correct_bias_params, extract_params, wavesol_params,
1931 rbn_params, target_table_params, sky_params,
1932 coadd_params, products),
1934 cpl_frameset_insert(sci_set, result);
1935 cpl_frameset_delete(set);
1939 moo_try_check(ref_frame = cpl_frameset_get_position_const(ref_frameset, 0),
1945 cpl_sprintf(
"%s_%s.fits", MOONS_TAG_XSWITCH2_COMBINED_SPECTRA,
1948 sci_coadd =
moo_coadd(sci_list, coadd_params, coadd_filename);
1951 cpl_frame *sci_final = NULL;
1953 moo_try_check(sci_final =
1955 CPL_FRAME_LEVEL_FINAL,
1956 MOONS_TAG_XSWITCH2_COMBINED_SPECTRA,
1957 coadd_filename, ref_frame),
1959 moo_create_s1d(sci_final, s1d_params, MOONS_TAG_SCIENCE_XSWITCH2_1DSPECTRUM,
1964 if (!cpl_errorstate_is_equal(prestate)) {
1965 cpl_frameset_delete(set);
1967 cpl_free(coadd_filename);
1968 cpl_free(calibflux_filename);
1969 cpl_free(selection);
1974 cpl_frameset_delete(sci_set);
1976 cpl_frameset_delete(ref_frameset);
1977 cpl_frameset_delete(offset_frameset);
1978 cpl_frameset_delete(masterdark_nir);
1980 moo_extract_params_delete(extract_params);
1981 moo_wavesol_params_delete(wavesol_params);
1982 moo_rebin_params_delete(rbn_params);
1983 moo_target_table_params_delete(target_table_params);
1985 moo_combine_pair_params_delete(combine_pair_params);
1986 moo_sub_sky_stare_params_delete(sky_params);
1987 moo_coadd_params_delete(coadd_params);
1988 moo_correct_bias_params_delete(correct_bias_params);
1989 moo_prepare_params_delete(prepare_params);
1991 moo_products_delete(products);
1992 return (
int)cpl_error_get_code();
moo_atm * moo_atm_load(const cpl_frame *frame)
Load a ATM frame and create a moo_atm.
void moo_atm_delete(moo_atm *self)
Delete a moo_atm.
moo_det * moo_det_create(const cpl_frame *frame)
Create a new moo_det from the given DET frame.
cpl_error_code moo_det_load(moo_det *self, unsigned int level)
Load all parts in DET.
void moo_det_delete(moo_det *self)
Delete a moo_det.
moo_single * moo_det_get_single(moo_det *self, moo_detector_type type, int num)
Get the type part in DET and return it.
moo_mode_type moo_mode_get(const cpl_frame *frame)
Get the name of a mode from a frame.
const char * moo_mode_get_name(moo_mode_type type)
Get the name of a mode.
moo_detlist * moo_detlist_create(cpl_frameset *frameset)
Create a new moo_detlist from the given DET frameset.
void moo_detlist_delete(moo_detlist *self)
Free all memory used by a moo_detlist object including the DET.
moo_ext * moo_ext_create(const cpl_frame *frame)
Create a new empty EXT filename.
void moo_ext_delete(moo_ext *self)
Delete a moo_ext.
cpl_error_code moo_ext_compute_snr(moo_ext *self, moo_map *wmap, moo_spectral_format *sformat, moo_sky_lines_list *skylines)
Compute SNR for all fibres EXT.
moo_ext * moo_extlist_get(moo_extlist *self, int i)
Get the DET at the position i in the list.
cpl_error_code moo_extlist_set(moo_extlist *self, moo_ext *ext, cpl_size pos)
Insert a DET into an moo_extlist.
moo_ext * moo_extlist_unset(moo_extlist *self, cpl_size pos)
Remove a DET from a DET list.
moo_ext * moo_extlist_sum(moo_extlist *self, const char *filename)
Sum EXT element from the list and save result in filename.
void moo_extlist_delete(moo_extlist *self)
Free all memory used by a moo_extlist object including the DET.
moo_extlist * moo_extlist_create(cpl_frameset *frameset)
Create a new moo_extlist from the given DET frameset.
moo_extlist * moo_extlist_new(void)
Create a new moo_extlist.
void moo_f2f_delete(moo_f2f *self)
Delete a moo_f2f.
moo_f2f * moo_f2f_load(const cpl_frame *f2f_frame)
Load a F2F table from a fits file.
moo_loc * moo_loc_load(const cpl_frame *locframe)
Load a LOC frame and create a moo_loc.
void moo_loc_delete(moo_loc *self)
Delete a moo_loc.
void moo_map_save(moo_map *self, const char *filename)
Save a moo_map to a FITS file.
void moo_map_delete(moo_map *self)
Delete a moo_map.
moo_coadd_params * moo_params_get_coadd(const moo_params *self, const cpl_parameterlist *list)
Get coadd parameters from moons parameters list.
cpl_error_code moo_params_add_create_s1d(moo_params *self, cpl_parameterlist *list)
Add default parameters for create_s1d.
void moo_create_s1d_params_delete(moo_create_s1d_params *self)
Delete a moo_create_s1d_params.
cpl_error_code moo_params_add_extract(moo_params *self, cpl_parameterlist *list)
Add default parameters for extraction.
cpl_error_code moo_params_add_sub_sky_stare(moo_params *self, cpl_parameterlist *list)
Add default parameters for moo_sub_sky_stare.
moo_create_s1d_params * moo_params_get_create_s1d(const moo_params *self, const cpl_parameterlist *list)
Get create s1d parameters from moons parameters list.
moo_prepare_params * moo_params_get_prepare(const moo_params *self, const cpl_parameterlist *list)
Get remove prepare parameters from moons parameters list.
moo_sub_sky_stare_params * moo_params_get_sub_sky_stare(const moo_params *self, const cpl_parameterlist *list)
Get sub sky stare parameters from moons parameters list.
moo_combine_pair_params * moo_params_get_combine_pair(const moo_params *self, const cpl_parameterlist *list)
Get combine_pair parameters from moons parameters list.
cpl_error_code moo_params_add_target_table(moo_params *self, cpl_parameterlist *list, int value)
Add default parameters for moo_create_target_table.
cpl_error_code moo_params_add_combine_pair(moo_params *self, cpl_parameterlist *list, int value)
Add default parameters for moo_combine_pair.
moo_target_table_params * moo_params_get_target_table(const moo_params *self, const cpl_parameterlist *list)
Get target_table parameters from moons parameters list.
cpl_error_code moo_params_add_science_wavesol(moo_params *self, cpl_parameterlist *list)
Add default science parameters for moo_wavesol.
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.
moo_extract_params * moo_params_get_extract(const moo_params *self, const cpl_parameterlist *list)
Get extraction parameters from moons parameters list.
moo_wavesol_params * moo_params_get_science_wavesol(const moo_params *self, const cpl_parameterlist *list)
Get science_wavesol parameters from moons parameters list.
void moo_params_delete(moo_params *self)
Delete a moo_params.
cpl_error_code moo_params_add_correct_bias(moo_params *self, cpl_parameterlist *list, const char *method)
Add default parameters for correct_bias.
cpl_error_code moo_params_add_keep_temp(moo_params *self, cpl_parameterlist *list)
Add default parameters for keep-temp.
cpl_error_code moo_params_add_prepare(moo_params *self, cpl_parameterlist *list)
Add default parameters for prepare.
moo_rebin_params * moo_params_get_rebin(const moo_params *self, const cpl_parameterlist *list)
Get rebin parameters from moons parameters list.
cpl_error_code moo_params_add_coadd(moo_params *self, cpl_parameterlist *list)
Add default parameters for moo_coadd.
moo_params * moo_params_new(const char *pid, const char *recipe_id)
Create a new moo_params.
cpl_error_code moo_params_add_rebin(moo_params *self, cpl_parameterlist *list)
Add default parameters for moo_rebin.
void moo_psf_delete(moo_psf *self)
Delete a moo_psf.
moo_psf * moo_psf_load(const cpl_frame *psfframe)
Load a PSF frame and create a moo_psf.
void moo_rbn_delete(moo_rbn *self)
Delete a moo_rbn.
moo_rbn * moo_rbn_create(const cpl_frame *frame)
Create a new empty RBN filename.
cpl_error_code moo_rbn_compute_snr(moo_rbn *self, moo_sky_lines_list *skylines)
Compute SNR for targets in RBN.
void moo_rbnlist_delete(moo_rbnlist *self)
Free all memory used by a moo_rbnlist object including the RBN.
moo_rbnlist * moo_rbnlist_create(const cpl_frameset *frameset)
Create a new moo_rbnlist from the given RBN frameset.
void moo_resp_delete(moo_resp *self)
Delete a moo_resp.
moo_resp * moo_resp_load(const cpl_frame *frame)
Load a RESP frame and create a moo_resp.
void moo_sci_delete(moo_sci *self)
Delete a moo_sci.
moo_sci * moo_sci_create(const cpl_frame *frame)
Create a new empty SCI filename.
cpl_error_code moo_sci_compute_snr(moo_sci *self, moo_sky_lines_list *skylines)
Compute SNR for all targets in SCI.
void moo_scilist_delete(moo_scilist *self)
Free all memory used by a moo_scilist object including the SCI.
moo_scilist * moo_scilist_create(cpl_frameset *frameset)
Create a new moo_scilist from the given SCI frameset.
moo_sky_lines_list * moo_sky_lines_list_load(const cpl_frame *frame)
Load a SKY_LINES_LIST frame and create a moo_sky_lines_list.
void moo_sky_lines_list_delete(moo_sky_lines_list *self)
Delete a moo_sky_lines_list.
void moo_target_table_delete(moo_target_table *self)
Delete a moo_target_table.
enum _moo_target_table_mode_ moo_target_table_mode
The type code type.
moo_target_table * moo_create_target_table(moo_rbn *rbnA, moo_rbn *rbnB, moo_target_table_mode mode, moo_target_table_params *params)
Prepare target table for SCI frames using their attached fibre.
moo_telluric * moo_telluric_load(const cpl_frame *frame)
Load a TELLURIC frame and create a moo_telluric.
void moo_telluric_delete(moo_telluric *self)
Delete a moo_telluric.
cpl_error_code moo_dfs_set_groups(cpl_frameset *set)
Set the group as RAW or CALIB in a frameset.
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_ext * moo_extract(moo_det *det, moo_loc *loc, moo_psf *master_flat, moo_extract_params *params, const char *filename)
extract the 1D spectrum of fibres
moo_rbn * moo_combine_sky(moo_rbnlist *rbnlist)
Combine RBN sky frames.
cpl_error_code moo_correct_tell(moo_rbn *rbn, moo_telluric *tell)
Apply the telluric correction to 1D rebinned spectra.
moo_sci * moo_coadd(moo_scilist *scilist, moo_coadd_params *params, const char *filename)
Co-add reduced science frames in SCI format.
moo_map * moo_wavesol(moo_ext *arc_ext, const char *lineCatname, moo_spectral_format *sformat, moo_loc *loc, moo_map *wmap, moo_wavesol_params *params)
Computes the wavelength solution from 1D extracted arc spectra.
cpl_error_code moo_apply_p2p(moo_det *flat, moo_det *p2pmap)
Divide DET by the pixel-to-pixel variation map.
cpl_error_code moo_create_s1d(cpl_frame *sci_frame, moo_create_s1d_params *params, const char *tag, moo_products *products)
Apply the telluric correction to SCI.
moo_rbn * moo_rebin(moo_ext *ext, moo_map *wmap, moo_spectral_format *sformat, moo_rebin_params *params, const char *filename)
Rebin an EXT spectra in RBN format.
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...
cpl_error_code moo_calib_flux(moo_rbn *rbn, moo_atm *atm, moo_resp *resp)
Apply the relative flux calibration to 1D rebinned spectra.
cpl_error_code moo_apply_flat(moo_ext *ext, moo_ext *flat, moo_f2f *f2f)
Divide spectra by 1D flat-field.
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.
moo_det * moo_subtract_nod(moo_det *object, moo_det *sky, const char *filename)
Sky from object subtraction.
moo_sci * moo_sub_sky_stare(moo_rbn *obja_rbn, moo_target_table *target_table, moo_rbn *objb_rbn, moo_f2f *f2f, const cpl_frame *solflux_frame, const cpl_frame *airglow_group_frame, const cpl_frame *airglow_var_frame, moo_sub_sky_stare_params *params, const char *filename, int ispaired)
This function subtracts the sky in wavelength calibrated and extracted science frames obtain in Stare...
cpl_error_code moo_correct_dark(moo_det *det, moo_det *detoff, const cpl_frame *masterDarkVis, const cpl_frame *masterDarkNir)
Subtracts the master dark frame from a frame after scaling for exposure time (RI)....
int moo_pfits_get_ndit(const cpl_propertylist *plist)
find out the ESO DET NDIT value
double moo_pfits_get_dit(const cpl_propertylist *plist)
find out the DIT value
double moo_pfits_get_mjdobs(const cpl_propertylist *plist)
find out the MJD-OBS
int moo_pfits_get_slit_offset(const cpl_propertylist *plist)
find out the INS SLIT OFFSET value
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
cpl_frame * moo_products_add_sci(moo_products *self, moo_sci *sci, cpl_frame_level level, const char *tag, const char *filename, const cpl_frame *inherit_frame)
create a product from a SCI object
cpl_frame * moo_products_add_rbn(moo_products *self, moo_rbn *rbn, cpl_frame_level level, const char *tag, const char *filename, const cpl_frame *inherit_frame)
create a product from a RBN object
cpl_frame * moo_products_add_ext(moo_products *self, moo_ext *ext, cpl_frame_level level, const char *tag, const char *filename, const cpl_frame *inherit_frame)
create a product from a EXT object
cpl_frame * moo_products_add_target_table(moo_products *self, moo_target_table *ttable, cpl_frame_level level, const char *tag, const char *filename, const cpl_frame *inherit_frame)
create a product from a TARGET_TABLE object
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
const moo_params * moo_products_get_params(const moo_products *self)
get the moo_params object
const char * moo_get_license(void)
Get the pipeline copyright and license.
the different type of detectors