X-shooter Pipeline Reference Manual 3.8.15
xsh_respon_slit_nod.c
Go to the documentation of this file.
1/* *
2 * This file is part of the ESO X-shooter Pipeline *
3 * Copyright (C) 2006 European Southern Observatory *
4 * *
5 * This library 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 P1ARTICULAR 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, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA *
18 * */
19
20/*
21 * $Author: amodigli $
22 * $Date: 2013-05-07 09:14:15 $
23 * $Revision: 1.92 $
24 *
25
26*/
27
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31
32/*----------------------------------------------------------------------------*/
40/*----------------------------------------------------------------------------*/
43/*-----------------------------------------------------------------------------
44 Includes
45 ----------------------------------------------------------------------------*/
46
47
48/* DRL steps */
49
50/* Error handling */
51#include <xsh_error.h>
52/* Utility functions */
53#include <xsh_utils.h>
54#include <xsh_utils_table.h>
55#include <xsh_utils_image.h>
57
58#include <xsh_msg.h>
59#include <xsh_model_utils.h>
60#include <xsh_data_instrument.h>
61#include <xsh_data_spectrum1D.h>
62/* DFS functions */
63#include <xsh_dfs.h>
64#include <xsh_pfits.h>
65/* DRL functions */
66#include <xsh_drl.h>
67#include <xsh_drl_check.h>
70
71/* Library */
72#include <cpl.h>
73/* CRH Remove */
74
75/*-----------------------------------------------------------------------------
76 Defines
77 ---------------------------------------------------------------------------*/
78
79#define RECIPE_ID "xsh_respon_slit_nod"
80#define RECIPE_AUTHOR "P.Goldoni, L.Guglielmi, R. Haigron, F. Royer, D. Bramich A. Modigliani"
81#define RECIPE_CONTACT "amodigli@eso.org"
82
83/*-----------------------------------------------------------------------------
84 Functions prototypes
85 ----------------------------------------------------------------------------*/
86
87/*
88 * Plugin initialization, execute and cleanup handlers
89 */
90
91static int xsh_respon_slit_nod_create(cpl_plugin *);
92static int xsh_respon_slit_nod_exec(cpl_plugin *);
93static int xsh_respon_slit_nod_destroy(cpl_plugin *);
94
95/* The actual executor function */
96static cpl_error_code xsh_respon_slit_nod(cpl_parameterlist *, cpl_frameset *);
97
98/*-----------------------------------------------------------------------------
99 Static variables
100 ----------------------------------------------------------------------------*/
102"Reduce STD star frames in SLIT configuration and nod mode";
103
105"This recipe reduces science exposure in SLIT configuration and NOD mode\n\
106Input Frames : \n\
107 - A set of n Science frames ( n even ), \
108Tag = OBJECT_SLIT_NOD_arm\n\
109 - Spectral format table (Tag = SPECTRAL_FORMAT_TAB_arm)\n\
110 - [UVB,VIS] A master bias frame (Tag = MASTER_BIAS_arm)\n\
111 - A master flat frame (Tag = MASTER_FLAT_SLIT_arm)\n\
112 - An order table frame(Tag = ORDER_TABLE_EDGES_SLIT_arm)\n\
113 - [poly mode] A wave solution frame(Tag = WAVE_TAB_2D_arm)\n\
114 - [poly mode] A wave map frame(Tag = WAVE_MAP_arm)\n\
115 - [poly mode] A disp table frame(Tag = DISP_TAB_arm)\n\
116 - [physical model mode]A model cfg table (Format = TABLE, Tag = XSH_MOD_CFG_TAB_arm)\n\
117 - [OPTIONAL] A telluric model catalog (Tag = TELL_MOD_CAT_arm arm=VIS,NIR)\n\
118 - A standard star fluxes catalog (Tag = FLUX_STD_CATALOG_arm Type = FLX)\n\
119 - A table to set response sampling points (Tag = RESP_FIT_POINTS_CAT_arm)\n\
120 - [OPTIONAL] An atmospheric extinction table (Tag = ATMOS_EXT_arm)\n\
121 if provided this is the one used to flux calibrate the spectra\n\
122Products : \n\
123 - [If STD is in catal] The response function (Tag = PREFIX_RESPONSE_ORDER1D_SLIT_arm)\n\
124 - [If STD is in catal] The response function (Tag = PREFIX_RESPONSE_MERGE1D_SLIT_arm)\n\
125 - PREFIX_ORDER2D_arm (2 dimension)\n\
126 - PREFIX_ORDER1D_arm (1 dimension)\n\
127 - PREFIX_MERGE2D_arm (2 dimension)\n\
128 - PREFIX_MERGE1D_arm (1 dimension)\n\
129 - PREFIX_WAVE_MAP_arm, wave map image\n\
130 - PREFIX_SLIT_MAP_arm, slit map image\n\
131 - [If STD is in catal] Flux calibrated order-by-order 2D spectrum (Tag = PREFIX_FLUX_ORDER2D_arm)\n\
132 - [If STD is in catal] Flux calibrated order-by-order 1D spectrum (Tag = PREFIX_FLUX_ORDER1D_arm)\n\
133 - [If STD is in catal] Flux calibrated merged 2D spectrum (Tag = PREFIX_FLUX_MERGE2D_arm)\n\
134 - [If STD is in catal] Flux calibrated merged 1D spectrum (Tag = PREFIX_FLUX_MERGE1D_arm)\n\
135 - [If STD is in catal] The efficiency (Tag = EFFICIENCY_SLIT_arm)\n\
136 - where PREFIX is SCI, FLUX, TELL if input raw DPR.TYPE contains OBJECT or FLUX or TELLURIC";
137
138/*-----------------------------------------------------------------------------
139 Functions code
140 ----------------------------------------------------------------------------*/
141/*----------------------------------------------------------------------------*/
150/*----------------------------------------------------------------------------*/
151
152int cpl_plugin_get_info(cpl_pluginlist *list) {
153 cpl_recipe *recipe = NULL;
154 cpl_plugin *plugin = NULL;
155
156 recipe = cpl_calloc(1, sizeof(*recipe));
157 if ( recipe == NULL ){
158 return -1;
159 }
160
161 plugin = &recipe->interface ;
162
163 cpl_plugin_init(plugin,
164 CPL_PLUGIN_API, /* Plugin API */
165 XSH_BINARY_VERSION, /* Plugin version */
166 CPL_PLUGIN_TYPE_RECIPE, /* Plugin type */
167 RECIPE_ID, /* Plugin name */
169 xsh_respon_slit_nod_description, /* Detailed help */
170 RECIPE_AUTHOR, /* Author name */
171 RECIPE_CONTACT, /* Contact address */
172 xsh_get_license(), /* Copyright */
176
177 cpl_pluginlist_append(list, plugin);
178
179 return (cpl_error_get_code() != CPL_ERROR_NONE);
180}
181
182/*---------------------------------------------------------------------------*/
192/*---------------------------------------------------------------------------*/
193
194static int xsh_respon_slit_nod_create(cpl_plugin *plugin){
195
196
197 cpl_recipe *recipe = NULL;
198 xsh_remove_crh_single_param crh_single = { 0.1, 20.0, 2.0, 4} ;
199 cpl_msg_info(__func__, "Set crh_single to %f, %f, %f, %d",
200 crh_single.crh_frac_max,
201 crh_single.sigma_lim, crh_single.f_lim, crh_single.nb_iter);
202 xsh_rectify_param rectify = { "tanh",
203 CPL_KERNEL_DEFAULT,
204 2,
205 -1.0,
206 -1.0,
207 1,
208 0,0. };
209
210 xsh_localize_obj_param loc_obj =
211 {10, 0.1, 0, 0, LOC_MANUAL_METHOD, 0, 2.0,3,3, FALSE};
212 xsh_extract_param extract_par =
213 { NOD_METHOD};
214 xsh_combine_nod_param nod_param = { 5, TRUE, 5, 2, 0.1, "throwlist.asc", COMBINE_MEAN_METHOD} ;
215 xsh_slit_limit_param slit_limit_param = { MIN_SLIT, MAX_SLIT, 0, 0 } ;
216
217 xsh_stack_param stack_param = {"median",5.,5.};
218 xsh_interpolate_bp_param ipol_par = {30 };
219 /* Reset library state */
220 xsh_init();
221
222 /* parameters default */
223 nod_param.nod_min = 5;
224 nod_param.nod_clip = TRUE;
225 nod_param.nod_clip_sigma = 5.;
226 nod_param.nod_clip_niter = 2;
227 nod_param.nod_clip_diff = 0.1;
228 nod_param.throwname = "throwlist.asc";
229
230 /* Check input */
231 assure( plugin != NULL, CPL_ERROR_NULL_INPUT, "Null plugin");
232
233 /* Get the recipe out of the plugin */
234 assure( cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE,
235 CPL_ERROR_TYPE_MISMATCH,
236 "Plugin is not a recipe");
237
238 recipe = (cpl_recipe *)plugin;
239
240 /* Create the parameter list in the cpl_recipe object */
241 recipe->parameters = cpl_parameterlist_new();
242 assure( recipe->parameters != NULL,
243 CPL_ERROR_ILLEGAL_OUTPUT,
244 "Memory allocation failed!");
245
246 /* Set generic parameters (common to all recipes) */
247 check( xsh_parameters_generic( RECIPE_ID, recipe->parameters ) ) ;
249 check( xsh_parameters_pre_overscan( RECIPE_ID, recipe->parameters ) ) ;
250 check(xsh_parameters_stack_create(RECIPE_ID,recipe->parameters,stack_param));
251
252 /* remove_crh_single */
254 recipe->parameters, crh_single));
255
256 /* xsh_rectify */
258 rectify )) ;
259 check( xsh_parameters_new_boolean( recipe->parameters, RECIPE_ID,
260 "rectify-fast", TRUE,
261 "Fast if TRUE (Rect[B-A] = -Rect[A-B]), in that case only entire pixel shifts are applied. "));
262
263
264 /* xsh_localize_object */
266 loc_obj )) ;
267
268 check( xsh_parameters_new_double( recipe->parameters, RECIPE_ID,
269 "localize-nod-throw", loc_obj.nod_step,
270 "Step (arcsec) between A and B images in nodding mode."));
271
272 /* xsh_subtract_sky_single */
273 /* trivial extract (Just temporary) */
275 recipe->parameters,
276 extract_par,NOD_METHOD )) ;
277
279 recipe->parameters,ipol_par)) ;
280
282 recipe->parameters,
283 nod_param )) ;
284
286 recipe->parameters,
287 slit_limit_param )) ;
288/*
289 check( xsh_parameters_new_boolean( recipe->parameters, RECIPE_ID,
290 "do-flatfield", TRUE,
291 "TRUE if we do the flatfielding"));
292*/
293 check( xsh_parameters_new_boolean( recipe->parameters, RECIPE_ID,
294 "correct-tellurics", TRUE,
295 "TRUE if during response computation we apply telluric correction"));
296
297 check( xsh_parameters_new_boolean( recipe->parameters, RECIPE_ID,
298 "correct-sky-by-median", TRUE,
299 "TRUE if the resampled spectrum at each wavelength is median subtracted to remove sky lines"));
300
301/*
302 check( xsh_parameters_new_int( recipe->parameters, RECIPE_ID,
303 "scale-stack-method",4,
304 "frame stacking scaling method (<=3): 0 (on-scaling); 1 (scaling-uniform on slit); 2 (scaling-slice on slit); 3 (pix-pix scaling)"));
305*/
306
307 check( xsh_parameters_new_int( recipe->parameters, RECIPE_ID,
308 "scale-combine-nod-method",1,
309 "frame scaling when nod frames are combined: 0 (no-scaling); 1 (scaling)"));
310
311
312 cleanup:
313 if ( cpl_error_get_code() != CPL_ERROR_NONE ){
314 xsh_error_dump(CPL_MSG_ERROR);
315 return 1;
316 }
317 else {
318 return 0;
319 }
320}
321
322/*----------------------------------------------------------------------------*/
328/*----------------------------------------------------------------------------*/
329
330static int xsh_respon_slit_nod_exec(cpl_plugin *plugin) {
331 cpl_recipe *recipe = NULL;
332
333 /* Check parameter */
334
335 assure( plugin != NULL, CPL_ERROR_NULL_INPUT, "Null plugin" );
336
337 /* Get the recipe out of the plugin */
338 assure( cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE,
339 CPL_ERROR_TYPE_MISMATCH, "Plugin is not a recipe");
340
341 recipe = (cpl_recipe *)plugin;
342
343 /* Check recipe */
344 xsh_respon_slit_nod(recipe->parameters, recipe->frames);
345
346 cleanup:
347 if ( cpl_error_get_code() != CPL_ERROR_NONE ) {
348 xsh_error_dump(CPL_MSG_ERROR);
350 return 1;
351 }
352 else {
353 return 0;
354 }
355}
356
357/*----------------------------------------------------------------------------*/
363/*----------------------------------------------------------------------------*/
364static int xsh_respon_slit_nod_destroy(cpl_plugin *plugin)
365{
366 cpl_recipe *recipe = NULL;
367
368 /* reset error state before destroying recipe */
370 /* Check parameter */
371 assure( plugin != NULL, CPL_ERROR_NULL_INPUT, "Null plugin" );
372
373 /* Get the recipe out of the plugin */
374 assure( cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE,
375 CPL_ERROR_TYPE_MISMATCH, "Plugin is not a recipe");
376
377 recipe = (cpl_recipe *)plugin;
378
379 xsh_free_parameterlist(&recipe->parameters);
380
381 cleanup:
382 if (cpl_error_get_code() != CPL_ERROR_NONE)
383 {
384 return 1;
385 }
386 else
387 {
388 return 0;
389 }
390}
391
392/*----------------------------------------------------------------------------*/
400/*----------------------------------------------------------------------------*/
401static cpl_error_code
402xsh_respon_slit_nod( cpl_parameterlist* parameters,
403 cpl_frameset* frameset)
404{
406 int recipe_tags_size = 3;
407
408 /* Input frames */
409 cpl_frameset *raws = NULL;
410 cpl_frameset *raws_ord_set = NULL;
411 cpl_frameset *calib = NULL;
412 /* Beware, do not "free" the following input frames, they are part
413 of the input frameset */
414 cpl_frame* bpmap = NULL;
415 cpl_frame *master_bias = NULL;
416 cpl_frame* master_flat = NULL;
417 cpl_frame* order_tab_edges = NULL;
418 cpl_frame * wave_tab = NULL ;
419 cpl_frame * model_config_frame = NULL;
420 cpl_frame * wavemap = NULL;
421 cpl_frame * spectral_format = NULL;
422
423 /* Parameters */
424 int rectify_fast = 0 ;
426 xsh_remove_crh_single_param * crh_single_par = NULL;
427 xsh_rectify_param * rectify_par = NULL;
428 xsh_localize_obj_param * loc_obj_par = NULL;
429 xsh_extract_param * extract_par = NULL;
430 xsh_combine_nod_param * combine_nod_par = NULL;
431 xsh_slit_limit_param * slit_limit_par = NULL;
432 xsh_stack_param* stack_par=NULL;
433
434 char comb_tag[256];
435 //int binx=0;
436 //int biny=0;
437
438 int nb_raw_frames;
439
440 /* Intermediate frames */
441 cpl_frameset* raws_avg=NULL;
442 cpl_frame* disp_tab_frame=NULL;
443 cpl_frame* slitmap=NULL;
444 cpl_frame *skymask_frame = NULL;
445
446 int do_computemap=1;
447 int do_flatfield = CPL_TRUE;
448
449 char *rec_prefix = NULL;
450
451
452 cpl_frameset *nod_set = NULL;
453 cpl_frameset *comb_set = NULL;
454 cpl_frameset *comb_eff_set = NULL;
455 cpl_frame *comb_frame = NULL;
456 cpl_frame *comb_eff_frame = NULL;
457 cpl_frame *combeso_frame = NULL;
458 cpl_frame *combeffeso_frame = NULL;
459 cpl_frame *res2D_frame = NULL;
460 cpl_frame *loc_table_frame = NULL;
461 cpl_frame *res1D_frame = NULL;
462 cpl_frame *res1D_eff_frame = NULL;
463 cpl_frame *res1Deso_frame = NULL;
464 cpl_frame *res1Deso_eff_frame = NULL;
465 cpl_frame *s1D_frame = NULL;
466 cpl_frame *frm_eff = NULL;
467 cpl_frame* response_ord_frame=NULL;
468 cpl_frame* response_frame=NULL;
469 cpl_frame * fluxcal_1D_frame = NULL ;
470 cpl_frame * fluxcal_2D_frame = NULL ;
471 cpl_frame * fluxcal_rect_1D_frame = NULL ;
472 cpl_frame * fluxcal_rect_2D_frame = NULL ;
473 cpl_frame* frm_atmext=NULL;
474 cpl_frame * nrm_1D_frame = NULL ;
475 cpl_frame * nrm_2D_frame = NULL ;
476 int pre_overscan_corr=0;
477 int generate_sdp_format=0;
478 cpl_frame* frm_std_cat=NULL;
479 cpl_frame* high_abs_win=NULL;
480 cpl_frame* tell_mod_cat=NULL;
481 cpl_frameset* crh_clean = NULL;
482 cpl_frame* resp_fit_points_cat_frame=NULL;
483 cpl_frame* sky_map_frm = NULL;
484 //double airm=0;
485 double exptime = 1. ;
486 int merge_par=0;
487 xsh_interpolate_bp_param *ipol_bp=NULL;
488 int corr_tell=0;
489 int corr_sky=0;
490 int scale_nod=0;
491 cpl_frame* frm_rejected=NULL;
492 cpl_propertylist* qclist = cpl_propertylist_new();
493 cpl_frame* reference_response = NULL;
494 /**************************************************************************/
495 /* DFS management */
496 /**************************************************************************/
497 check( xsh_begin( frameset, parameters, &instrument, &raws, &calib,
498 recipe_tags, recipe_tags_size, RECIPE_ID,
499 XSH_BINARY_VERSION,
501
502 //get average airm and iwv from raws; add keywords to qclist
504
505 if(instrument->arm == XSH_ARM_NIR) {
508 }
509
510 assure( instrument->mode == XSH_MODE_SLIT, CPL_ERROR_ILLEGAL_INPUT,
511 "Instrument NOT in Slit Mode");
512
513 check(frm_rejected=xsh_ensure_raws_number_is_even(raws));
515 //check(airm=xsh_utils_compute_airm_eff(raws));
516
517
518
519 /**************************************************************************/
520 /* Recipe frames */
521 /**************************************************************************/
522 check( rec_prefix = xsh_set_recipe_file_prefix(raws,"xsh_respon_slit_nod"));
523
524 /* One should have a multiple of 2 input frames: A1,B1[,B2,A2,...] */
525 check( nb_raw_frames = cpl_frameset_get_size( raws));
526 check( raws_ord_set = xsh_order_frameset_by_date( raws));
527
528 xsh_msg_dbg_low( "Nb of Raw frames: %d", nb_raw_frames);
529
530
531 /* prepare RAW frames in XSH format: NB we moved this piece of REDUCTION here
532 * because we need to have the calib frameset with input frames already with correct binning
533 * that is done by xsh_set_recipe_file_prefix (which needs frames in PRE format)
534 */
535 /* PIPE-9018: But we also need to have pre-overscan-corr properly set */
536 /* This assignment of pre_overscan_corr does not need to be replicated in
537 * xsh_scired_slit_nod because xsh_scired_nod_get_calibs sets the parameter correctly
538 * before xsh_prepare is called - as described above, this needs to be triggered
539 * earlier in this recipe */
540 check( pre_overscan_corr = xsh_parameters_get_int( parameters, RECIPE_ID,
541 "pre-overscan-corr"));
542
543 check( xsh_prepare( raws_ord_set, bpmap, master_bias, XSH_OBJECT_SLIT_NOD,
544 instrument,pre_overscan_corr,CPL_TRUE));
545
546 /* in case the input master flat/bias do not match in bin size with the raw data,
547 * correct the binning so that :
548 *
549 * 1x1 std 2x2 mflat,mbias --> correct bin of std
550 * 2x2 std 1x1 mflat,mbias --> correct bin of mflat,mbias
551 *
552 */
553
554 /**************************************************************************/
555 /* Recipe parameters */
556 /**************************************************************************/
557/*
558 check( do_flatfield = xsh_parameters_get_boolean( parameters, RECIPE_ID,
559 "do-flatfield"));
560 */
561 check( stack_par = xsh_stack_frames_get( RECIPE_ID, parameters));
562 /*
563 if ( xsh_instrument_get_arm(instrument) != XSH_ARM_NIR){
564 binx=instrument->binx;
565 biny=instrument->biny;
566 } else {
567 binx=1;
568 biny=1;
569 }
570 */
572 &crh_single_par, &rectify_par,
573 &extract_par, &combine_nod_par,
574 &slit_limit_par, &loc_obj_par,
575 &rectify_fast, &pre_overscan_corr,
576 &generate_sdp_format,
577 RECIPE_ID));
578
580 check( corr_tell = xsh_parameters_get_boolean( parameters, RECIPE_ID,
581 "correct-tellurics"));
582 check( corr_sky = xsh_parameters_get_boolean( parameters, RECIPE_ID,
583 "correct-sky-by-median"));
584 check( scale_nod = xsh_parameters_get_int( parameters, RECIPE_ID,
585 "scale-combine-nod-method"));
586 /*
587 check( scale_stack = xsh_parameters_get_int( parameters, RECIPE_ID,
588 "scale-stack-method"));
589 */
590 check(xsh_frameset_uniform_bin(&raws_ord_set, &calib,instrument));
592 &bpmap,&master_bias,&master_flat,
593 &order_tab_edges,&wave_tab,
594 &model_config_frame,&wavemap,&slitmap,
595 &disp_tab_frame,
596 &spectral_format,
597 &skymask_frame,
598 &response_ord_frame,
599 &frm_atmext,
600 do_computemap,
601 loc_obj_par->use_skymask,
602 pre_overscan_corr,
603 rec_prefix,RECIPE_ID));
604
605 rectify_par->conserve_flux=FALSE;
606 if ( rectify_fast == CPL_FALSE && loc_obj_par->method == LOC_MANUAL_METHOD){
607 xsh_error_msg( "Mode accurate can not be use with localize-method MANUAL");
608 }
609
610 /* QC extra frames */
611 resp_fit_points_cat_frame=xsh_find_frame_with_tag(calib,XSH_RESP_FIT_POINTS_CAT,instrument);
612 if(resp_fit_points_cat_frame==NULL) {
613 xsh_msg_warning("Missing input %s_%s response will not be computed",
616 xsh_msg_warning("and data will not be flux calibrated");
617 }
618 /* response extra frames */
620 if(frm_atmext==NULL) {
621 xsh_msg_error("Provide atmospheric extinction frame");
622 return CPL_ERROR_DATA_NOT_FOUND;
623 }
624
626 if(frm_std_cat==NULL) {
627 xsh_msg_error("Provide std star catalog frame");
628 return CPL_ERROR_DATA_NOT_FOUND;
629 }
630
632
633 reference_response=xsh_find_frame_with_tag(calib,"RRESPONSE_MERGE1D_SLIT",instrument);
634
635 /**************************************************************************/
636 /* Recipe code */
637 /**************************************************************************/
638
639
640
641 int recipe_use_model=FALSE;
642 cpl_frame* ref_pre_frame=NULL;
644 /*raws_ord_set contains frames in PRE format */
645 recipe_use_model=TRUE;
646 ref_pre_frame=cpl_frameset_get_frame(raws_ord_set,0);
647 }
648 else{
649 ref_pre_frame = master_flat;
650 }
651
652 /* create proper size wave and slit maps */
653 check( xsh_check_get_map( disp_tab_frame, order_tab_edges,
654 ref_pre_frame, model_config_frame, calib, instrument,
655 do_computemap, recipe_use_model, rec_prefix,
656 &wavemap, &slitmap));
657
658 /* make sure each input raw frame has the same exp time */
660 /* remove crh on each obj or sky frame */
661 sky_map_frm = xsh_find_frame_with_tag(calib,XSH_SKY_MAP, instrument);
662 crh_clean = xsh_frameset_crh_single(raws_ord_set, crh_single_par, sky_map_frm,
663 instrument,rec_prefix,"NOD");
664
665
666 check( raws_avg = xsh_nod_group_by_reloff(crh_clean,instrument,stack_par));
667
668
669 check( nod_set = xsh_subtract_sky_nod( raws_avg, instrument, rectify_fast));
670 if ( rectify_fast ){
671
672
674 nod_set,
675 spectral_format,
676 master_flat,
677 order_tab_edges,
678 wave_tab,
679 model_config_frame,
680 disp_tab_frame,
681 wavemap,
683 crh_single_par,
684 rectify_par,
685 do_flatfield,corr_sky,1,
686 rec_prefix,
687 &comb_eff_set));
688
689 }
690 else {
692 nod_set,
693 spectral_format,
694 master_flat,
695 order_tab_edges,
696 wave_tab,
697 model_config_frame,
698 disp_tab_frame,
699 wavemap,
700 skymask_frame,
702 crh_single_par,
703 rectify_par,
704 loc_obj_par,
705 combine_nod_par->throwname,
706 do_flatfield,
707 rec_prefix
708 ));
709 comb_eff_set=cpl_frameset_duplicate(comb_set);
710
711 }
712
713 /***************************************************************************/
714 /* merge at combine nod part */
715 /***************************************************************************/
716 sprintf( comb_tag,"%s_%s",
718 check( comb_frame = xsh_combine_nod( comb_set, combine_nod_par,
719 comb_tag, instrument,&combeso_frame,scale_nod));
720
721
722 /* 2D product */
723 check( res2D_frame = xsh_merge_ord( comb_frame, instrument,
724 merge_par,rec_prefix));
725
726 /* 1D product */
727 if ( extract_par->method == LOCALIZATION_METHOD ||
728 extract_par->method == CLEAN_METHOD ) {
729 xsh_msg( "Re-Localize before extraction" ) ;
730 check( loc_table_frame = xsh_localize_obj( comb_frame, skymask_frame,instrument,
731 loc_obj_par, slit_limit_par, "LOCALIZE.fits"));
732 }
733 xsh_msg( "Extract 1D order-by-order spectrum" ) ;
734 check( res1D_frame = xsh_extract_clean( comb_frame, loc_table_frame,
735 instrument, extract_par, ipol_bp,&res1Deso_frame, rec_prefix));
736 xsh_msg( "Merge orders with 1D frame" ) ;
737 check( s1D_frame = xsh_merge_ord( res1D_frame, instrument,
738 merge_par,rec_prefix));
739
740
741
742 /* Get Exptime */
743 {
744 cpl_propertylist * plist = NULL ;
745 plist=cpl_propertylist_load(cpl_frame_get_filename(comb_frame),0) ;
747 xsh_msg_dbg_medium( "EXPTIME: %lf", exptime ) ;
748
749 xsh_free_propertylist( &plist ) ;
750 }
751
752
753 /* Response computation */
754 if(frm_std_cat!=NULL && frm_atmext!=NULL
755 && resp_fit_points_cat_frame!= NULL) {
756 xsh_msg( "Calling xsh_compute_response" ) ;
757 if( (response_ord_frame = xsh_compute_response_ord( res1Deso_frame,
758 frm_std_cat,
759 frm_atmext,
760 high_abs_win,
762 exptime )) == NULL) {
763 xsh_msg_warning("Some error occurred during order by order response computation");
765 cpl_error_reset();
766 }
767
768 if( (response_frame = xsh_compute_response2( s1D_frame,
769 frm_std_cat,
770 frm_atmext,
771 high_abs_win,
772 resp_fit_points_cat_frame,
773 tell_mod_cat,
775 exptime,
776 corr_tell )) == NULL) {
777 xsh_msg_warning("Some error occurred during merged response computation");
779 cpl_error_reset();
780 } else {
781
782 check(xsh_frame_table_monitor_flux_qc(response_frame,"LAMBDA",
783 "RESPONSE","RESP",instrument));
784 }
785 }
786
787 if (response_frame != NULL && frm_atmext != NULL) {
788 check(xsh_flux_calibrate(combeso_frame,res1Deso_frame,frm_atmext,
789 response_frame,merge_par,instrument,rec_prefix,
790 &fluxcal_rect_2D_frame,&fluxcal_rect_1D_frame,
791 &fluxcal_2D_frame,&fluxcal_1D_frame));
792 }
793
794
795 /* efficiency computation */
796 if(response_frame != NULL && frm_atmext != NULL &&
797 disp_tab_frame != NULL && comb_eff_set != NULL) {
798 check( comb_eff_frame = xsh_combine_nod( comb_eff_set, combine_nod_par,
799 comb_tag, instrument,
800 &combeffeso_frame,scale_nod));
801
802 xsh_msg( "Extract 1D order-by-order spectrum" ) ;
803 check( res1D_eff_frame = xsh_extract_clean( comb_eff_frame, loc_table_frame,
804 instrument, extract_par, ipol_bp,
805 &res1Deso_eff_frame, rec_prefix));
806
807 frm_eff=xsh_compute_efficiency(res1Deso_eff_frame,frm_std_cat,
808 frm_atmext,high_abs_win,
809 instrument);
810 }
811
812
813 if(model_config_frame!=NULL && wavemap != NULL&& slitmap != NULL) {
814
815 check(xsh_compute_resampling_accuracy(wavemap,slitmap,order_tab_edges,model_config_frame,res2D_frame,instrument));
816
817 check(xsh_compute_resampling_accuracy(wavemap,slitmap,order_tab_edges,model_config_frame,combeso_frame,instrument));
818
819 check(xsh_compute_wavelength_resampling_accuracy(wavemap,order_tab_edges,model_config_frame,res1Deso_frame,instrument));
820
821 check(xsh_compute_wavelength_resampling_accuracy(wavemap,order_tab_edges,model_config_frame,s1D_frame,instrument));
822
823 xsh_add_afc_info(model_config_frame,wavemap);
824 xsh_add_afc_info(model_config_frame,slitmap);
825
826 if(fluxcal_rect_2D_frame != NULL) {
827
828 check(xsh_compute_resampling_accuracy(wavemap,slitmap,order_tab_edges,model_config_frame,fluxcal_rect_2D_frame,instrument));
829 check(xsh_compute_resampling_accuracy(wavemap,slitmap,order_tab_edges,model_config_frame,fluxcal_2D_frame,instrument));
830
831 check(xsh_compute_wavelength_resampling_accuracy(wavemap,order_tab_edges,model_config_frame,fluxcal_rect_1D_frame,instrument));
832 check(xsh_compute_wavelength_resampling_accuracy(wavemap,order_tab_edges,model_config_frame,fluxcal_1D_frame,instrument));
833
834 }
835
836 }
837
838 /* Save products */
839 if(frm_rejected != NULL ) {
840 //cpl_frameset_erase_frame(frameset,frm_rejected);
841 }
842 if(response_ord_frame!=NULL) {
843 check( xsh_add_product_table(response_ord_frame, frameset, parameters,
844 RECIPE_ID, instrument,NULL));
845 }
846 if(response_frame!=NULL) {
847 check( xsh_add_product_table( response_frame, frameset, parameters,
848 RECIPE_ID, instrument,NULL));
849
850 if(reference_response != NULL){
851 //if an optional ref response has been added to the sof, try to load the table...
852 //TODO: Set error handling here to be robust (no errors introduced by this routine)
853 cpl_table* ref_resp = cpl_table_load(cpl_frame_get_filename(reference_response),1,0);
854 cpl_table* master_resp = cpl_table_load(cpl_frame_get_filename(response_frame),1,0);
855 if(ref_resp != NULL && master_resp != NULL){
856 if(instrument->arm == XSH_ARM_UVB) {
857 calc_resp_qc(master_resp,ref_resp,instrument,4741,13408,"QTH",qclist);
858 calc_resp_qc(master_resp,ref_resp,instrument,408,4074,"D2",qclist);
859 } else {
860 calc_resp_qc(master_resp,ref_resp,instrument,0,0,NULL,qclist);
861 }
862 }
863 cpl_error_reset();
864 }
865 }
866
867
868 check( xsh_add_product_image( combeso_frame, frameset,
869 parameters, RECIPE_ID, instrument,NULL));
870
871 check( xsh_add_product_orders_spectrum( res1Deso_frame, frameset, parameters,
872 RECIPE_ID, instrument,NULL));
873
874 /* Calculate curvature QC params early */
875 cpl_image* itmp = cpl_image_load(cpl_frame_get_filename(res2D_frame),CPL_TYPE_DOUBLE,0,0);
876 calc_curve_qc(itmp,instrument,qclist);
877 cpl_image_delete(itmp);
878
879 check( xsh_add_product_pre( res2D_frame, frameset, parameters,
880 RECIPE_ID, instrument,qclist));
882
883 check(get_chromatic_eff(frm_eff,qclist));
885 check( xsh_add_product_spectrum( s1D_frame, frameset, parameters,
886 RECIPE_ID, instrument, NULL,qclist));
887
888 if ( do_computemap){
889
890 check( xsh_add_product_image( wavemap, frameset,
891 parameters, RECIPE_ID, instrument,NULL));
892
893
894 check( xsh_add_product_image( slitmap, frameset,
895 parameters, RECIPE_ID, instrument,NULL));
896 }
897
898 if(fluxcal_2D_frame != NULL) {
899 check( xsh_add_product_image(fluxcal_rect_2D_frame,frameset,parameters,
900 RECIPE_ID, instrument,NULL));
901 check( xsh_add_product_orders_spectrum(fluxcal_rect_1D_frame,frameset,parameters,
902 RECIPE_ID, instrument,NULL));
903
904 check( xsh_add_product_spectrum( fluxcal_2D_frame, frameset, parameters,
905 RECIPE_ID, instrument, NULL,qclist));
906 check( xsh_add_product_spectrum( fluxcal_1D_frame, frameset, parameters,
907 RECIPE_ID, instrument, NULL,qclist));
908 }
909
910 if(frm_eff!=NULL) {
911 check(xsh_add_product_table(frm_eff, frameset,parameters,
912 RECIPE_ID, instrument,NULL));
913 }
914
915 cleanup:
916
917 xsh_end( RECIPE_ID, frameset, parameters);
918
920 xsh_free_frameset( &raws);
921 xsh_free_frameset( &calib);
922 XSH_FREE( rec_prefix);
923 XSH_FREE(ipol_bp);
924
925 xsh_free_frameset( &raws_ord_set);
926 xsh_free_frameset( &raws_avg);
927 xsh_free_frame( &wavemap);
928 xsh_free_frame( &slitmap);
929 xsh_free_frame( &comb_frame);
930 xsh_free_frameset(&crh_clean);
931
932 XSH_FREE( rectify_par);
933 XSH_FREE( crh_single_par);
934 XSH_FREE( loc_obj_par);
935 XSH_FREE( slit_limit_par);
936 XSH_FREE( combine_nod_par);
937 XSH_FREE( extract_par);
938 XSH_FREE( stack_par);
939
940 xsh_free_frameset( &nod_set);
941 xsh_free_frameset( &comb_set);
942 xsh_free_frameset( &comb_eff_set);
943 xsh_free_frame( &comb_eff_frame);
944 xsh_free_frame( &bpmap);
945 xsh_free_frame( &response_ord_frame);
946 xsh_free_frame( &response_frame);
947 xsh_free_frame( &combeso_frame);
948 xsh_free_frame( &combeffeso_frame);
949 xsh_free_frame( &res2D_frame);
950 xsh_free_frame( &loc_table_frame);
951 xsh_free_frame( &res1D_frame);
952 xsh_free_frame( &res1D_eff_frame);
953
954 xsh_free_frame( &res1Deso_eff_frame);
955 xsh_free_frame( &res1Deso_frame);
956 xsh_free_frame( &s1D_frame);
957 xsh_free_frame(&fluxcal_rect_1D_frame) ;
958 xsh_free_frame(&fluxcal_rect_2D_frame) ;
959 xsh_free_frame(&fluxcal_1D_frame) ;
960 xsh_free_frame(&fluxcal_2D_frame) ;
961 xsh_free_frame(&nrm_1D_frame) ;
962 xsh_free_frame(&nrm_2D_frame) ;
963 xsh_free_frame(&frm_eff) ;
964
965 return cpl_error_get_code();
966}
967
static double exptime
static xsh_instrument * instrument
cpl_frame * xsh_combine_nod(cpl_frameset *nod_frames, xsh_combine_nod_param *nod_par, const char *tag, xsh_instrument *instrument, cpl_frame **res_frame_ext, const int scale_nod)
cpl_error_code xsh_monitor_spectrum1D_extra_qc(cpl_frame *in_frm, xsh_instrument *instrument, cpl_propertylist *qclist)
cpl_error_code xsh_monitor_spectrum1D_flux(cpl_frame *in_frm, xsh_instrument *instrument)
void xsh_prepare(cpl_frameset *frames, cpl_frame *bpmap, cpl_frame *mbias, const char *prefix, xsh_instrument *instr, const int pre_overscan_corr, const bool flag_neg_and_thresh_pix)
This function transform RAW frames dataset in PRE frames dataset attaching the default bad pixel map ...
Definition: xsh_prepare.c:122
#define assure(CONDITION, ERROR_CODE,...)
Definition: xsh_error.h:54
#define check(COMMAND)
Definition: xsh_error.h:71
#define xsh_error_dump(level)
Definition: xsh_error.h:92
#define xsh_error_reset()
Definition: xsh_error.h:87
#define xsh_error_msg(...)
Definition: xsh_error.h:94
cpl_frame * xsh_extract_clean(cpl_frame *rec_frame, cpl_frame *loc_frame, xsh_instrument *instrument, xsh_extract_param *extract_par, xsh_interpolate_bp_param *ipol_bp, cpl_frame **res_frame_ext, const char *rec_prefix)
simple 1D extraction of point source like object
Definition: xsh_extract.c:836
cpl_error_code xsh_instrument_nir_corr_if_JH(cpl_frameset *raws, xsh_instrument *instr)
const char * xsh_instrument_arm_tostring(xsh_instrument *i)
Get the string associated with an arm.
void xsh_instrument_free(xsh_instrument **instrument)
free an instrument structure
cpl_frame * xsh_localize_obj(cpl_frame *sci_frame, cpl_frame *skymask_frame, xsh_instrument *instrument, xsh_localize_obj_param *loc_obj_par, xsh_slit_limit_param *slit_limit_param, const char *fname)
Build the localization table.
cpl_frame * xsh_merge_ord(cpl_frame *sci_frame, xsh_instrument *instrument, int merge, const char *rec_prefix)
Merge orders of the rectified frame using merge parameters.
#define xsh_msg_warning(...)
Print an warning message.
Definition: xsh_msg.h:88
#define xsh_msg_dbg_medium(...)
Definition: xsh_msg.h:44
#define xsh_msg_error(...)
Print an error message.
Definition: xsh_msg.h:62
#define xsh_msg(...)
Print a message on info level.
Definition: xsh_msg.h:121
#define xsh_msg_dbg_low(...)
Definition: xsh_msg.h:48
double xsh_pfits_get_exptime(const cpl_propertylist *plist)
find out the exposure time
Definition: xsh_pfits.c:2254
#define RECIPE_CONTACT
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.
static int xsh_respon_slit_nod_create(cpl_plugin *)
Setup the recipe options.
static char xsh_respon_slit_nod_description[]
static cpl_error_code xsh_respon_slit_nod(cpl_parameterlist *, cpl_frameset *)
Interpret the command line options and execute the data processing.
static char xsh_respon_slit_nod_description_short[]
static int xsh_respon_slit_nod_exec(cpl_plugin *)
Execute the plugin instance given by the interface.
static int xsh_respon_slit_nod_destroy(cpl_plugin *)
Destroy what has been created by the 'create' function.
#define RECIPE_ID
#define RECIPE_AUTHOR
cpl_frameset * xsh_subtract_sky_nod(cpl_frameset *raws, xsh_instrument *instrument, int mode_fast)
void xsh_free_parameterlist(cpl_parameterlist **p)
Deallocate a parameter list and set the pointer to NULL.
Definition: xsh_utils.c:2224
cpl_error_code get_average_qc_from_raws(cpl_frameset *fset, xsh_instrument *instrument, cpl_propertylist *qclist)
Definition: xsh_utils.c:7216
void xsh_free_frame(cpl_frame **f)
Deallocate a frame and set the pointer to NULL.
Definition: xsh_utils.c:2269
void xsh_free_frameset(cpl_frameset **f)
Deallocate a frame set and set the pointer to NULL.
Definition: xsh_utils.c:2254
char * xsh_set_recipe_file_prefix(cpl_frameset *raw, const char *recipe)
Set recipe frames prefix.
Definition: xsh_utils.c:601
cpl_error_code calc_curve_qc(cpl_image *im, xsh_instrument *instrument, cpl_propertylist *qclist)
Definition: xsh_utils.c:7322
const char * xsh_get_license(void)
Get the pipeline copyright and license.
Definition: xsh_utils.c:1193
cpl_error_code get_chromatic_eff(cpl_frame *eff, cpl_propertylist *qclist)
Definition: xsh_utils.c:7306
void xsh_init(void)
Reset library state.
Definition: xsh_utils.c:1160
cpl_frameset * xsh_order_frameset_by_date(cpl_frameset *frameset)
Order frameset by date.
Definition: xsh_utils.c:3306
cpl_error_code xsh_frame_table_monitor_flux_qc(cpl_frame *frm, const char *colw, const char *colf, const char *prefix, xsh_instrument *instrument)
Computes statistics on spectrum for QC.
cpl_error_code xsh_begin(cpl_frameset *frames, const cpl_parameterlist *parameters, xsh_instrument **instrument, cpl_frameset **raws, cpl_frameset **calib, const char *tag_list[], int tag_list_size, const char *recipe_id, unsigned int binary_version, const char *short_descr)
Recipe initialization.
Definition: xsh_utils.c:1244
cpl_error_code calc_resp_qc(cpl_table *mtab, cpl_table *rtab, xsh_instrument *instrument, int lower, int upper, const char *label, cpl_propertylist *qclist)
Definition: xsh_utils.c:7504
void xsh_free_propertylist(cpl_propertylist **p)
Deallocate a property list and set the pointer to NULL.
Definition: xsh_utils.c:2179
cpl_error_code xsh_end(const char *recipe_id, cpl_frameset *frames, cpl_parameterlist *parameters)
Recipe termination.
Definition: xsh_utils.c:1519
enum extract_method method
enum localize_method method
cpl_frame * xsh_compute_response_ord(cpl_frame *spectrum_frame, cpl_frame *flux_std_star_cat_frame, cpl_frame *atmos_ext_frame, cpl_frame *high_abs_win_frame, xsh_instrument *instrument, double exptime)
cpl_frame * xsh_compute_response2(cpl_frame *obs_std_star, cpl_frame *flux_std_star_cat, cpl_frame *atmos_ext, cpl_frame *high_abs, cpl_frame *resp_fit_points, cpl_frame *tell_mod_cat, xsh_instrument *instrument, double exptime, const int tell_corr)
@ XSH_ARM_UVB
@ XSH_ARM_NIR
@ XSH_MODE_SLIT
#define MIN_SLIT
#define MAX_SLIT
cpl_error_code xsh_calib_nir_respon_corr_if_JH(cpl_frameset *calib, xsh_instrument *instr)
Definition: xsh_dfs.c:4974
void xsh_add_product_pre(cpl_frame *frame, cpl_frameset *frameset, const cpl_parameterlist *parameters, const char *recipe_id, xsh_instrument *instr, cpl_propertylist *qclist)
Add DFS keywords to a product frame.
Definition: xsh_dfs.c:2465
cpl_error_code xsh_frameset_uniform_bin(cpl_frameset **raws, cpl_frameset **calib, xsh_instrument *instrument)
Definition: xsh_dfs.c:4664
int xsh_print_rec_status(const int val)
Check if an error has happened and returns error kind and location.
Definition: xsh_dfs.c:877
cpl_boolean xsh_mode_is_physmod(cpl_frameset *set, xsh_instrument *instrument)
Definition: xsh_dfs.c:4411
void xsh_add_product_image(cpl_frame *frame, cpl_frameset *frameset, const cpl_parameterlist *parameters, const char *recipe_id, xsh_instrument *instrument, const char *final_prefix)
Definition: xsh_dfs.c:2965
void xsh_add_product_table(cpl_frame *frame, cpl_frameset *frameset, const cpl_parameterlist *parameters, const char *recipe_id, xsh_instrument *instrument, const char *final_prefix)
Save Table product (input frame has several extensions, 1 table per extension)
Definition: xsh_dfs.c:3146
void xsh_add_product_spectrum(cpl_frame *frame, cpl_frameset *frameset, const cpl_parameterlist *parameters, const char *recipe_id, xsh_instrument *instr, cpl_frame **result_frame, cpl_propertylist *qclist)
Definition: xsh_dfs.c:2067
void xsh_add_product_orders_spectrum(cpl_frame *frame, cpl_frameset *frameset, const cpl_parameterlist *parameters, const char *recipe_id, xsh_instrument *instr, cpl_frame **result_frame)
Definition: xsh_dfs.c:2260
cpl_error_code xsh_add_afc_info(cpl_frame *frm_m, cpl_frame *frm_o)
Definition: xsh_dfs.c:5199
cpl_frame * xsh_ensure_raws_number_is_even(cpl_frameset *raws)
Make sure input frames is an even number (eventually removes the last from the input list)
Definition: xsh_dfs.c:792
cpl_frame * xsh_find_frame_with_tag(cpl_frameset *frames, const char *tag, xsh_instrument *instr)
Find frame with a given tag.
Definition: xsh_dfs.c:3347
cpl_error_code xsh_frameset_check_uniform_exptime(cpl_frameset *raws, xsh_instrument *inst)
Definition: xsh_dfs.c:5119
#define XSH_TELL_MOD_CAT
Definition: xsh_dfs.h:181
#define XSH_OBJECT_SLIT_NOD
Definition: xsh_dfs.h:228
#define XSH_ORDER2D
Definition: xsh_dfs.h:588
#define XSH_SKY_MAP
Definition: xsh_dfs.h:282
#define XSH_STD_TELL_SLIT_NOD
Definition: xsh_dfs.h:481
#define XSH_ATMOS_EXT
Definition: xsh_dfs.h:1191
#define XSH_FLUX_STD_CAT
Definition: xsh_dfs.h:272
#define XSH_GET_TAG_FROM_ARM(TAG, instr)
Definition: xsh_dfs.h:1548
#define XSH_RESP_FIT_POINTS_CAT
Definition: xsh_dfs.h:126
#define XSH_STD_FLUX_SLIT_NOD
Definition: xsh_dfs.h:486
void xsh_check_get_map(cpl_frame *disp_tab_frame, cpl_frame *order_tab_edges, cpl_frame *crhm_frame, cpl_frame *model_config_frame, cpl_frameset *calib, xsh_instrument *instrument, int do_computemap, int recipe_use_model, const char *rec_prefix, cpl_frame **wavemap_frame, cpl_frame **slitmap_frame)
Check function to get wave and slit maps.
void xsh_parameters_pre_overscan(const char *recipe_id, cpl_parameterlist *plist)
void xsh_parameters_new_boolean(cpl_parameterlist *list, const char *recipe_id, const char *name, int value, const char *comment)
void xsh_parameters_stack_create(const char *recipe_id, cpl_parameterlist *list, xsh_stack_param sp)
create the RON determination parameters in a parameters list
int xsh_parameters_get_boolean(const cpl_parameterlist *list, const char *recipe_id, const char *name)
xsh_stack_param * xsh_stack_frames_get(const char *recipe_id, cpl_parameterlist *list)
get the detect arclines parameters in a parameters list
cpl_error_code xsh_parameters_decode_bp(const char *recipe_id, cpl_parameterlist *plist, const int ival)
void xsh_parameters_combine_nod_create(const char *recipe_id, cpl_parameterlist *list, xsh_combine_nod_param p)
create the crh clipping parameters in a parameters list
void xsh_parameters_new_double(cpl_parameterlist *list, const char *recipe_id, const char *name, double value, const char *comment)
void xsh_parameters_localize_obj_create(const char *recipe_id, cpl_parameterlist *plist, xsh_localize_obj_param p)
void xsh_parameters_slit_limit_create(const char *recipe_id, cpl_parameterlist *list, xsh_slit_limit_param p)
xsh_interpolate_bp_param * xsh_parameters_interpolate_bp_get(const char *recipe_id, cpl_parameterlist *list)
void xsh_parameters_rectify_create(const char *recipe_id, cpl_parameterlist *plist, xsh_rectify_param p)
void xsh_parameters_interpolate_bp_create(const char *recipe_id, cpl_parameterlist *plist, xsh_interpolate_bp_param p)
void xsh_parameters_extract_create(const char *recipe_id, cpl_parameterlist *plist, xsh_extract_param p, enum extract_method method)
void xsh_parameters_remove_crh_single_create(const char *recipe_id, cpl_parameterlist *plist, xsh_remove_crh_single_param p)
int xsh_parameters_get_int(const cpl_parameterlist *list, const char *recipe_id, const char *name)
void xsh_parameters_generic(const char *recipe_id, cpl_parameterlist *plist)
cpl_error_code xsh_recipe_params_check(cpl_parameterlist *parameters, xsh_instrument *instrument, const char *rec_id)
void xsh_parameters_new_int(cpl_parameterlist *list, const char *recipe_id, const char *name, int value, const char *comment)
@ COMBINE_MEAN_METHOD
#define DECODE_BP_FLAG_NOD
@ LOC_MANUAL_METHOD
@ NOD_METHOD
@ LOCALIZATION_METHOD
@ CLEAN_METHOD
#define XSH_FREE(POINTER)
Definition: xsh_utils.h:92
cpl_frameset * xsh_nod_group_by_reloff(cpl_frameset *ord_set, xsh_instrument *instrument, xsh_stack_param *stack_par)
cpl_frameset * xsh_scired_slit_nod_accurate(cpl_frameset *nod_set, cpl_frame *spectral_format, cpl_frame *master_flat, cpl_frame *order_tab_edges, cpl_frame *wave_tab, cpl_frame *model_config_frame, cpl_frame *disp_tab_frame, cpl_frame *wavemap, cpl_frame *skymask_frame, xsh_instrument *instrument, xsh_remove_crh_single_param *crh_single_par, xsh_rectify_param *rectify_par, xsh_localize_obj_param *loc_obj_par, const char *throw_name, const int do_flatfield, const char *rec_prefix)
cpl_error_code xsh_respon_slit_nod_get_calibs(cpl_frameset *calib, xsh_instrument *instrument, cpl_frame **bpmap, cpl_frame **master_bias, cpl_frame **master_flat, cpl_frame **order_tab_edges, cpl_frame **wave_tab, cpl_frame **model_config_frame, cpl_frame **wavemap, cpl_frame **slitmap, cpl_frame **disp_tab_frame, cpl_frame **spectral_format, cpl_frame **skymask_frame, cpl_frame **response_ord_frame, cpl_frame **frm_atmext, int do_computemap, int use_skymask, int pscan, const char *rec_prefix, const char *recipe_id)
cpl_frameset * xsh_frameset_crh_single(cpl_frameset *raws, xsh_remove_crh_single_param *crh_single_par, cpl_frame *sky_map_frm, xsh_instrument *instrument, const char *prefix, const char *spec)
Generates a new frameset with each frame CRH-single rejected from input frameset.
cpl_error_code xsh_flux_calibrate(cpl_frame *rect2D, cpl_frame *rect1D, cpl_frame *atmext, cpl_frame *response, int mpar, xsh_instrument *inst, const char *rec_prefix, cpl_frame **fcal_rect_2D, cpl_frame **fcal_rect_1D, cpl_frame **fcal_2D, cpl_frame **fcal_1D)
cpl_frame * xsh_compute_efficiency(cpl_frame *mer1D, cpl_frame *std_cat, cpl_frame *atm_ext, cpl_frame *high_abs_win, xsh_instrument *instr)
cpl_error_code xsh_compute_resampling_accuracy(cpl_frame *wavemap, cpl_frame *slitmap, cpl_frame *order_tab_edges, cpl_frame *model_config, cpl_frame *science, xsh_instrument *instrument)
cpl_error_code xsh_compute_wavelength_resampling_accuracy(cpl_frame *wavemap, cpl_frame *order_tab_edges, cpl_frame *model_config, cpl_frame *science, xsh_instrument *instrument)
cpl_frameset * xsh_scired_slit_nod_fast(cpl_frameset *nod_set, cpl_frame *spectral_format, cpl_frame *master_flat, cpl_frame *order_tab_edges, cpl_frame *wave_tab, cpl_frame *model_config_frame, cpl_frame *disp_tab_frame, cpl_frame *wavemap, xsh_instrument *instrument, xsh_remove_crh_single_param *crh_single_par, xsh_rectify_param *rectify_par, const int do_flatfield, const int corr_sky, const int compute_eff, const char *rec_prefix, cpl_frameset **comb_eff_set)
cpl_error_code xsh_scired_nod_get_parameters(cpl_parameterlist *parameters, xsh_instrument *instrument, xsh_remove_crh_single_param **crh_single_par, xsh_rectify_param **rectify_par, xsh_extract_param **extract_par, xsh_combine_nod_param **combine_nod_par, xsh_slit_limit_param **slit_limit_par, xsh_localize_obj_param **loc_obj_par, int *rectify_fast, int *pscan, int *generate_sdp_format, const char *rec_id)