X-shooter Pipeline Reference Manual 3.8.15
xsh_scired_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-04-02 13:43:34 $
23 * $Revision: 1.181 $
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 fonctions */
53#include <xsh_utils.h>
54#include <xsh_msg.h>
55#include <xsh_model_utils.h>
57#include <xsh_data_instrument.h>
58#include <xsh_data_spectrum1D.h>
59#include <xsh_utils_image.h>
60#include <xsh_data_spectrum.h>
61/* DFS functions */
62#include <xsh_dfs.h>
63#include <xsh_pfits.h>
64/* DRL functions */
65#include <xsh_drl.h>
66#include <xsh_drl_check.h>
68
69/* Library */
70#include <cpl.h>
71/* CRH Remove */
72
73/*-----------------------------------------------------------------------------
74 Defines
75 ---------------------------------------------------------------------------*/
76
77#define RECIPE_ID "xsh_scired_slit_nod"
78#define RECIPE_AUTHOR "P.Goldoni, L.Guglielmi, R. Haigron, F. Royer, D. Bramich A. Modigliani"
79#define RECIPE_CONTACT "amodigli@eso.org"
80
81/*-----------------------------------------------------------------------------
82 Functions prototypes
83 ----------------------------------------------------------------------------*/
84
85/*
86 * Plugin initalization, execute and cleanup handlers
87 */
88
89static int xsh_scired_slit_nod_create(cpl_plugin *);
90static int xsh_scired_slit_nod_exec(cpl_plugin *);
91static int xsh_scired_slit_nod_destroy(cpl_plugin *);
92
93/* The actual executor function */
94static void xsh_scired_slit_nod(cpl_parameterlist *, cpl_frameset *);
95
96/*-----------------------------------------------------------------------------
97 Static variables
98 ----------------------------------------------------------------------------*/
100"Reduce science frames in SLIT configuration and nod mode";
101
103"This recipe reduces science exposure in SLIT configuration and NOD mode\n\
104Input Frames : \n\
105 - A set of n Science frames ( n even ), \
106Tag = OBJECT_SLIT_NOD_arm\n\
107 - Spectral format table (Tag = SPECTRAL_FORMAT_TAB_arm)\n\
108 - [UVB,VIS] A master bias frame (Tag = MASTER_BIAS_arm)\n\
109 - A master flat frame (Tag = MASTER_FLAT_SLIT_arm)\n\
110 - An order table frame(Tag = ORDER_TABLE_EDGES_SLIT_arm)\n\
111 - [poly mode] A wave solution frame(Tag = WAVE_TAB_2D_arm)\n\
112 - [poly mode] A wave map frame(Tag = WAVE_MAP_arm)\n\
113 - [poly mode] A disp table frame(Tag = DISP_TAB_arm)\n\
114 - [physical model mode]A model cfg table (Format = TABLE, Tag = XSH_MOD_CFG_TAB_arm)\n\
115 - [OPTIONAL] A non-linear badpixel map (Tag = BP_MAP_NL_arm)\n\
116 - [OPTIONAL] A reference badpixel map (Tag = BP_MAP_RP_arm)\n\
117 - [OPTIONAL] The instrument response table (Tag = RESPONSE_MERGE1D_SLIT_arm)\n\
118 - [OPTIONAL] An atmospheric extinction table (Tag = ATMOS_EXT_arm)\n\
119 - [OPTIONAL] A telluric mask (Tag = TELL_MASK_arm)\n\
120 - [OPTIONAL] The instrument master response table (Tag = MRESPONSE_MERGE1D_SLIT_arm).\n\
121 If both master and individual response are provided the individual response is preferred.\n\
122Products : \n\
123 - PREFIX_ORDER2D_arm (2 dimension)\n\
124 - PREFIX_ORDER1D_arm (1 dimension)\n\
125 - PREFIX_MERGE2D_arm (2 dimension)\n\
126 - PREFIX_MERGE1D_arm (1 dimension)\n\
127 - PREFIX_WAVE_MAP_arm, wave map image\n\
128 - PREFIX_SLIT_MAP_arm, slit map image\n\
129 - [OPTIONAL, if response and atm ext are provided] PREFIX_FLUX_ORDER2D_arm (2 dimension)\n\
130 - [OPTIONAL, if response and atm ext are provided] PREFIX_FLUX_ORDER1D_arm (1 dimension)\n\
131 - [OPTIONAL, if response and atm ext are provided] PREFIX_FLUX_MERGE2D_arm (2 dimension)\n\
132 - [OPTIONAL, if response and atm ext are provided] PREFIX_FLUX_MERGE1D_arm (1 dimension)\n\
133 - where PREFIX is SCI, FLUX, TELL if input raw DPR.TYPE contains OBJECT or FLUX or TELLURIC";
134/*-----------------------------------------------------------------------------
135 Functions code
136 ----------------------------------------------------------------------------*/
137/*----------------------------------------------------------------------------*/
146/*----------------------------------------------------------------------------*/
147
148int cpl_plugin_get_info(cpl_pluginlist *list) {
149 cpl_recipe *recipe = NULL;
150 cpl_plugin *plugin = NULL;
151
152 recipe = cpl_calloc(1, sizeof(*recipe));
153 if ( recipe == NULL ){
154 return -1;
155 }
156
157 plugin = &recipe->interface ;
158
159 cpl_plugin_init(plugin,
160 CPL_PLUGIN_API, /* Plugin API */
161 XSH_BINARY_VERSION, /* Plugin version */
162 CPL_PLUGIN_TYPE_RECIPE, /* Plugin type */
163 RECIPE_ID, /* Plugin name */
165 xsh_scired_slit_nod_description, /* Detailed help */
166 RECIPE_AUTHOR, /* Author name */
167 RECIPE_CONTACT, /* Contact address */
168 xsh_get_license(), /* Copyright */
172
173 cpl_pluginlist_append(list, plugin);
174
175 return (cpl_error_get_code() != CPL_ERROR_NONE);
176}
177
178
179
180
181/*---------------------------------------------------------------------------*/
191/*---------------------------------------------------------------------------*/
192
193static int xsh_scired_slit_nod_create(cpl_plugin *plugin){
194
195 cpl_recipe *recipe = NULL;
196 xsh_remove_crh_single_param crh_single = {0.1, 5.0, 2.0, -1};
197 xsh_rectify_param rectify = { "tanh",
198 CPL_KERNEL_DEFAULT,
199 2,
200 -1.0,
201 -1.0,
202 1,
203 0,0. };
204 xsh_localize_obj_param loc_obj =
205 {10, 0.1, 0, 0, LOC_MANUAL_METHOD, 0, 2.0,3,3, FALSE};
206 xsh_extract_param extract_par =
207 { NOD_METHOD};
208 xsh_combine_nod_param nod_param = { 5, TRUE, 5, 2, 0.1, "throwlist.asc", COMBINE_MEAN_METHOD} ;
209 xsh_slit_limit_param slit_limit_param = { MIN_SLIT, MAX_SLIT, 0, 0 } ;
210
211 xsh_stack_param stack_param = {"median",5.,5.};
212 xsh_interpolate_bp_param ipol_par = {30 };
213 xsh_bary_corr_param bary_corr = {BARY_CORR_NONE };
214 /* Reset library state */
215 xsh_init();
216
217 /* parameters default */
218 nod_param.nod_min = 5;
219 nod_param.nod_clip = TRUE;
220 nod_param.nod_clip_sigma = 5.;
221 nod_param.nod_clip_niter = 2;
222 nod_param.nod_clip_diff = 0.1;
223 nod_param.throwname = "throwlist.asc";
224
225 /* Check input */
226 assure( plugin != NULL, CPL_ERROR_NULL_INPUT, "Null plugin");
227
228 /* Get the recipe out of the plugin */
229 assure( cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE,
230 CPL_ERROR_TYPE_MISMATCH,
231 "Plugin is not a recipe");
232
233 recipe = (cpl_recipe *)plugin;
234
235 /* Create the parameter list in the cpl_recipe object */
236 recipe->parameters = cpl_parameterlist_new();
237 assure( recipe->parameters != NULL,
238 CPL_ERROR_ILLEGAL_OUTPUT,
239 "Memory allocation failed!");
240
241 /* Set generic parameters (common to all recipes) */
242 check( xsh_parameters_generic( RECIPE_ID, recipe->parameters ) ) ;
244 check( xsh_parameters_pre_overscan( RECIPE_ID, recipe->parameters ) ) ;
245 check(xsh_parameters_stack_create(RECIPE_ID,recipe->parameters,stack_param));
246
247 /* remove_crh_single */
249 recipe->parameters, crh_single));
250
251 /* xsh_rectify */
253 rectify )) ;
254 check( xsh_parameters_new_boolean( recipe->parameters, RECIPE_ID,
255 "rectify-fast", TRUE,
256 "Fast if TRUE (Rect[B-A] = -Rect[A-B]), in that case only entire pixel shifts are applied. "));
257
258 /* PIPE-10061 - barycentric correction param */
260 bary_corr)) ;
261
262
263 /* xsh_localize_object */
265 loc_obj )) ;
266
267 check( xsh_parameters_new_double( recipe->parameters, RECIPE_ID,
268 "localize-nod-throw", loc_obj.nod_step,
269 "Step (arcsec) between A and B images in nodding mode."));
270
271 /* xsh_subtract_sky_single */
272 /* trivial extract (Just temporary) */
274 recipe->parameters,
275 extract_par,NOD_METHOD )) ;
276
278 recipe->parameters,ipol_par)) ;
279
281 recipe->parameters,
282 nod_param )) ;
283
285 recipe->parameters,
286 slit_limit_param )) ;
287 check( xsh_parameters_new_boolean( recipe->parameters, RECIPE_ID,
288 "correct-sky-by-median", TRUE,
289 "TRUE if the resampled spectrum at each wavelength is median subtracted to remove sky lines"));
290
291 check( xsh_parameters_new_boolean( recipe->parameters, RECIPE_ID,
292 "cut-uvb-spectrum", TRUE,
293 "TRUE if recipe cuts the UVB spectrum at 556 nm (dichroich)"));
294/*
295 check( xsh_parameters_new_boolean( recipe->parameters, RECIPE_ID,
296 "do-flatfield", TRUE,
297 "TRUE if we do the flatfielding"));
298*/
299
300 /* Flag for generation of data in SDP format. */
301 check( xsh_parameters_new_boolean( recipe->parameters, RECIPE_ID,
302 "generate-SDP-format", FALSE,
303 "TRUE if additional files should be generated in Science Data Product"
304 " (SDP) format."));
305
306 /* Flag for adding dummy ASSO[NCM]i keywords. */
307 check( xsh_parameters_new_int( recipe->parameters, RECIPE_ID,
308 "dummy-association-keys", 0,
309 "Sets the number of dummy (empty) ASSONi, ASSOCi and ASSOMi keywords to"
310 " create."));
311
312/*
313 check( xsh_parameters_new_int( recipe->parameters, RECIPE_ID,
314 "scale-stack-method",4,
315 "frame stacking scaling method (<=3): 0 (on-scaling); 1 (scaling-uniform on slit); 2 (scaling-slice on slit); 3 (pix-pix scaling)"));
316*/
317 check( xsh_parameters_new_int( recipe->parameters, RECIPE_ID,
318 "scale-combine-nod-method",1,
319 "frame scaling when nod frames are combined: 0 (no-scaling); 1 (scaling)"));
320
321
322 cleanup:
323 if ( cpl_error_get_code() != CPL_ERROR_NONE ){
324 xsh_error_dump(CPL_MSG_ERROR);
325 return 1;
326 }
327 else {
328 return 0;
329 }
330}
331
332/*----------------------------------------------------------------------------*/
338/*----------------------------------------------------------------------------*/
339
340static int xsh_scired_slit_nod_exec(cpl_plugin *plugin) {
341 cpl_recipe *recipe = NULL;
342
343 /* Check parameter */
344
345 assure( plugin != NULL, CPL_ERROR_NULL_INPUT, "Null plugin" );
346
347 /* Get the recipe out of the plugin */
348 assure( cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE,
349 CPL_ERROR_TYPE_MISMATCH, "Plugin is not a recipe");
350
351 recipe = (cpl_recipe *)plugin;
352
353 /* Check recipe */
354 xsh_scired_slit_nod(recipe->parameters, recipe->frames);
355
356 cleanup:
357 if ( cpl_error_get_code() != CPL_ERROR_NONE ) {
358 xsh_error_dump(CPL_MSG_ERROR);
360 return 1;
361 }
362 else {
363 return 0;
364 }
365}
366
367/*----------------------------------------------------------------------------*/
373/*----------------------------------------------------------------------------*/
374static int xsh_scired_slit_nod_destroy(cpl_plugin *plugin)
375{
376 cpl_recipe *recipe = NULL;
377
378 /* reset error state before detroying recipe */
380 /* Check parameter */
381 assure( plugin != NULL, CPL_ERROR_NULL_INPUT, "Null plugin" );
382
383 /* Get the recipe out of the plugin */
384 assure( cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE,
385 CPL_ERROR_TYPE_MISMATCH, "Plugin is not a recipe");
386
387 recipe = (cpl_recipe *)plugin;
388
389 xsh_free_parameterlist(&recipe->parameters);
390
391 cleanup:
392 if (cpl_error_get_code() != CPL_ERROR_NONE)
393 {
394 return 1;
395 }
396 else
397 {
398 return 0;
399 }
400}
401#if 0
402static void change_file_name( cpl_frame * frame, const char * name )
403{
404 const char * old_name ;
405 char * cmd ;
406
407 old_name = cpl_frame_get_filename( frame ) ;
408 cmd = xsh_stringcat_any( "mv ", old_name, " ", name, (void*)NULL ) ;
409 cpl_frame_set_filename( frame, name ) ;
410
411 system( cmd ) ;
412 XSH_FREE( cmd ) ;
413}
414#endif
415
416
424static void
425xsh_get_binning(cpl_frameset* raws,int* binx, int* biny)
426{
427 cpl_frame* frame=NULL;
428 const char* name=NULL;
429 cpl_propertylist* plist=NULL;
430 int nraw=0;
431
432 XSH_ASSURE_NOT_NULL_MSG(raws,"Null pointer for input raw frameset");
433 nraw=cpl_frameset_get_size(raws);
434 /* xsh_msg("nraw=%d",nraw); */
435 XSH_ASSURE_NOT_ILLEGAL_MSG(nraw > 0,"nraw = 0 Provide at least a raw frame");
436
437 check(frame=cpl_frameset_get_frame(raws,0));
438 check(name=cpl_frame_get_filename(frame));
439 check(plist=cpl_propertylist_load(name,0));
442
443 cleanup:
444 xsh_free_propertylist(&plist);
445
446 return;
447}
448
449
450/*--------------------------------------------------------------------------*/
458/*--------------------------------------------------------------------------*/
459
460/*
461static cpl_error_code
462xsh_params_bin_scale(int binx,int biny)
463{
464
465 if(biny>1) {
466
467 rectify_par->rectif_radius=rectify_par->rectif_radius/biny;
468 //Rectify Interpolation radius.
469 //For the moment not bin dependent, but for optimal results probably yes
470
471 rectify_par->rectif_bin_lambda=rectify_par->rectif_bin_lambda/biny;
472 //Rectify Wavelength Step.
473 //For the moment not bin dependent, but for optimal results probably yes
474
475 loc_obj_par->loc_chunk_nb=loc_obj_par->loc_chunk_nb/biny;
476 //Localization Nb of chunks.
477 //Not bin dependent
478
479 }
480
481 if(binx>1) {
482
483 rectify_par->rectif_bin_space=rectify_par->rectif_bin_space/binx;
484 //Rectify Position Step.
485 //For the moment not bin dependent, but for optimal results probably yes
486
487 loc_obj_par->nod_step=loc_obj_par->nod_step/binx;
488 //Step (arcsec) between A and B images in nodding mode.
489 //For the moment not bin dependent, but for optimal results probably yes
490
491 }
492
493 return cpl_error_get_code();
494
495}
496*/
497
498/*----------------------------------------------------------------------------*/
506/*----------------------------------------------------------------------------*/
507static void xsh_scired_slit_nod( cpl_parameterlist* parameters,
508 cpl_frameset* frameset)
509{
511 int recipe_tags_size = 3;
512
513 /* Input frames */
514 cpl_frameset *raws = NULL;
515 cpl_frameset *raws_ord_set = NULL;
516 cpl_frameset *calib = NULL;
517 cpl_frameset *usedframes = NULL;
518 /* Beware, do not "free" the following input frames, they are part
519 of the input frameset */
520 cpl_frame* bpmap = NULL;
521 cpl_frame *master_bias = NULL;
522 cpl_frame* master_flat = NULL;
523 cpl_frame* order_tab_edges = NULL;
524 cpl_frame * wave_tab = NULL ;
525 cpl_frame * model_config_frame = NULL;
526 cpl_frame * wavemap = NULL;
527 cpl_frame * spectral_format = NULL;
528 cpl_frame *tellmask_frame = NULL;
529
530 /* Parameters */
531 int rectify_fast = 0 ;
533 xsh_remove_crh_single_param * crh_single_par = NULL;
534 xsh_rectify_param * rectify_par = NULL;
535 xsh_localize_obj_param * loc_obj_par = NULL;
536 int merge_par = 0;
537 xsh_extract_param * extract_par = NULL;
538 xsh_combine_nod_param * combine_nod_par = NULL;
539 xsh_slit_limit_param * slit_limit_par = NULL;
540 xsh_stack_param* stack_par=NULL;
541 xsh_bary_corr_param * bary_par = NULL ;
542 //cpl_frame *throw_frame = NULL;
543 char comb_tag[256];
544 int binx=0;
545 int biny=0;
546
547 int nb_raw_frames;
548
549 /* Intermediate frames */
550
551 //cpl_vector* offsets=NULL;
552 //cpl_vector* offsets_dif=NULL;
553 //int ngroups=0;
554 cpl_frameset* raws_avg=NULL;
555 cpl_frame* disp_tab_frame=NULL;
556 cpl_frame* slitmap=NULL;
557 cpl_frame *skymask_frame = NULL;
558
559 int do_computemap=1;
560 int do_flatfield = CPL_TRUE;
561 //int noffs=0;
562 char *rec_prefix = NULL;
563
564 cpl_frameset *nod_set = NULL;
565 cpl_frameset *comb_set = NULL;
566 cpl_frameset *comb_eff_set = NULL;
567 cpl_frame *comb_frame = NULL;
568 cpl_frame *combeso_frame = NULL;
569 cpl_frame *res2D_frame = NULL;
570 cpl_frame *loc_table_frame = NULL;
571 cpl_frame *res1D_frame = NULL;
572 cpl_frame *res1Deso_frame = NULL;
573 cpl_frame *s1D_frame = NULL;
574 cpl_frame* response_ord_frame=NULL;
575 cpl_frame * fluxcal_1D_frame = NULL ;
576 cpl_frame * fluxcal_2D_frame = NULL ;
577 cpl_frame * fluxcal_rect_1D_frame = NULL ;
578 cpl_frame * fluxcal_rect_2D_frame = NULL ;
579 cpl_frame * fluxframe = NULL;
580 cpl_frame * uncalframe = NULL;
581 cpl_frame* sky_map_frm = NULL;
582 cpl_frame* frm_atmext=NULL;
583 int pre_overscan_corr=0;
584 int generate_sdp_format=0;
585 xsh_interpolate_bp_param *ipol_bp=NULL;
586 int corr_sky=0;
587 int cut_uvb_spectrum=0;
588 int scale_nod=0;
589 //int scale_stack=4;
590 cpl_frame* frm_rejected=NULL;
591 cpl_propertylist* qclist = cpl_propertylist_new();
592
593 /**************************************************************************/
594 /* DFS management */
595 /**************************************************************************/
596 check( xsh_begin( frameset, parameters, &instrument, &raws, &calib,
597 recipe_tags, recipe_tags_size, RECIPE_ID,
598 XSH_BINARY_VERSION,
600
601
602 assure( instrument->mode == XSH_MODE_SLIT, CPL_ERROR_ILLEGAL_INPUT,
603 "Instrument NOT in Slit Mode");
604
605 //get average airm, iwv and fwhm from raws; add keywords to qclist
607
608 check(frm_rejected=xsh_ensure_raws_number_is_even(raws));
610 if(instrument->arm == XSH_ARM_NIR) {
612 }
613 /**************************************************************************/
614 /* Recipe frames */
615 /**************************************************************************/
616 check( rec_prefix = xsh_set_recipe_file_prefix(raws,"xsh_scired_slit_nod"));
617
618 /* One should have a multiple of 2 input frames: A1,B1[,B2,A2,...] */
619 check( nb_raw_frames = cpl_frameset_get_size( raws));
620 check( raws_ord_set = xsh_order_frameset_by_date( raws));
621
622 xsh_msg_dbg_low( "Nb of Raw frames: %d", nb_raw_frames);
623
624 /**************************************************************************/
625 /* Recipe parameters */
626 /**************************************************************************/
627
628 cut_uvb_spectrum=xsh_parameters_cut_uvb_spectrum_get(RECIPE_ID,parameters);
629 check( stack_par = xsh_stack_frames_get( RECIPE_ID, parameters));
630/*
631 check( do_flatfield = xsh_parameters_get_boolean( parameters, RECIPE_ID,
632 "do-flatfield"));
633*/
634
636 xsh_get_binning(raws, &binx, &biny);
637 } else {
638 binx=1;
639 biny=1;
640 }
641
643 &crh_single_par, &rectify_par,
644 &extract_par,
645 &combine_nod_par,
646 &slit_limit_par, &loc_obj_par,
647 &rectify_fast, &pre_overscan_corr,
648 &generate_sdp_format,
649 RECIPE_ID));
650
652 check( corr_sky = xsh_parameters_get_boolean( parameters, RECIPE_ID,
653 "correct-sky-by-median"));
654 check( scale_nod = xsh_parameters_get_int( parameters, RECIPE_ID,
655 "scale-combine-nod-method"));
656
657 /* PIPE-10665 */
659 instrument, crh_single_par));
660
661 cpl_msg_info(__func__, " Now have crh_single to %f, %f, %f, %d",
662 crh_single_par->crh_frac_max,
663 crh_single_par->sigma_lim, crh_single_par->f_lim,
664 crh_single_par->nb_iter);
665/*
666 check( scale_stack = xsh_parameters_get_int( parameters, RECIPE_ID,
667 "scale-stack-method"));
668*/
669
671 &bpmap,&master_bias,&master_flat,
672 &order_tab_edges,&wave_tab,
673 &model_config_frame,&wavemap,&slitmap,
674 &disp_tab_frame,
675 &spectral_format,
676 &skymask_frame,
677 &response_ord_frame,
678 &frm_atmext,
679 do_computemap,
680 loc_obj_par->use_skymask,
681 pre_overscan_corr,
682 rec_prefix,RECIPE_ID));
683
684 tellmask_frame = xsh_find_frame_with_tag(calib,XSH_TELL_MASK, instrument);
685
686 if ( rectify_fast == CPL_FALSE && loc_obj_par->method == LOC_MANUAL_METHOD){
687 xsh_error_msg( "Mode accurate can not be use with localize-method MANUAL");
688 }
689
690 // PIPE-10061 - get barycentric corr param
691 check(bary_par = xsh_parameters_bary_corr_get( RECIPE_ID, parameters)) ;
692
693 /**************************************************************************/
694 /* Recipe code */
695 /**************************************************************************/
696 rectify_par->conserve_flux=FALSE;
697 check( xsh_prepare( raws_ord_set, bpmap, master_bias, XSH_OBJECT_SLIT_NOD,
698 instrument,pre_overscan_corr,CPL_TRUE));
699
700 /* make sure each input raw frame has the same exp time */
702 /* we fist flag CRH from each raw frame */
703 cpl_frameset* crh_clean=NULL;
704 sky_map_frm = xsh_find_frame_with_tag(calib,XSH_SKY_MAP, instrument);
705 check(crh_clean = xsh_frameset_crh_single(raws_ord_set, crh_single_par,
706 sky_map_frm, instrument, rec_prefix, "NOD"));
707
708 /* combine nod frames: AAA BBB BBB AAA AAAAA BBBBB BBBBB AAAAAA--> A B B A A B B A */
709 check( raws_avg = xsh_nod_group_by_reloff( crh_clean,instrument,stack_par));
710 xsh_free_frameset(&crh_clean);
711 /* creates pairs [A-B]s and [B-A]s */
712 check( nod_set = xsh_subtract_sky_nod( raws_avg, instrument, rectify_fast));
713
714
715 if ( rectify_fast ){
716
718 nod_set,
719 spectral_format,
720 master_flat,
721 order_tab_edges,
722 wave_tab,
723 model_config_frame,
724 disp_tab_frame,
725 wavemap,
727 crh_single_par,
728 rectify_par,
729 do_flatfield,corr_sky,1,
730 rec_prefix,
731 &comb_eff_set));
732
733 }
734 else {
736 nod_set,
737 spectral_format,
738 master_flat,
739 order_tab_edges,
740 wave_tab,
741 model_config_frame,
742 disp_tab_frame,
743 wavemap,
744 skymask_frame,
746 crh_single_par,
747 rectify_par,
748 loc_obj_par,
749 combine_nod_par->throwname,
750 do_flatfield,
751 rec_prefix
752 ));
753
754
755 }
756
757 /***************************************************************************/
758 /* merge at combine nod part */
759 /***************************************************************************/
760 sprintf( comb_tag,"%s_%s",
762 check( comb_frame = xsh_combine_nod( comb_set, combine_nod_par,
763 comb_tag, instrument,&combeso_frame,scale_nod));
764
765 /* 2D product */
766 check( res2D_frame = xsh_merge_ord( comb_frame, instrument,
767 merge_par,rec_prefix));
768
769 /* 1D product */
770 if ( extract_par->method == LOCALIZATION_METHOD ||
771 extract_par->method == CLEAN_METHOD ) {
772 xsh_msg( "Re-Localize before extraction" ) ;
773 check( loc_table_frame = xsh_localize_obj( comb_frame, skymask_frame,instrument,
774 loc_obj_par, slit_limit_par, "LOCALIZE.fits"));
775 }
776
777 xsh_msg( "Extract 1D order-by-order spectrum" ) ;
778 check( res1D_frame = xsh_extract_clean( comb_frame, loc_table_frame,
779 instrument, extract_par, ipol_bp, &res1Deso_frame, rec_prefix));
780 xsh_msg( "Merge orders with 1D frame" ) ;
781 check( s1D_frame = xsh_merge_ord( res1D_frame, instrument,
782 merge_par,rec_prefix));
783 check( xsh_mark_tell( s1D_frame, tellmask_frame));
784
785
786
787 if(response_ord_frame != NULL && frm_atmext != NULL) {
788 check(xsh_flux_calibrate(combeso_frame,res1Deso_frame,frm_atmext,
789 response_ord_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
796 if(model_config_frame!=NULL && wavemap != NULL&& slitmap != NULL) {
797
798 check(xsh_compute_resampling_accuracy(wavemap,slitmap,order_tab_edges,model_config_frame,res2D_frame,instrument));
799
800 check(xsh_compute_resampling_accuracy(wavemap,slitmap,order_tab_edges,model_config_frame,combeso_frame,instrument));
801
802 check(xsh_compute_wavelength_resampling_accuracy(wavemap,order_tab_edges,model_config_frame,res1Deso_frame,instrument));
803
804 check(xsh_compute_wavelength_resampling_accuracy(wavemap,order_tab_edges,model_config_frame,s1D_frame,instrument));
805
806 xsh_add_afc_info(model_config_frame,wavemap);
807 xsh_add_afc_info(model_config_frame,slitmap);
808
809 if(fluxcal_rect_2D_frame != NULL) {
810
811 check(xsh_compute_resampling_accuracy(wavemap,slitmap,order_tab_edges,model_config_frame,fluxcal_rect_2D_frame,instrument));
812 check(xsh_compute_resampling_accuracy(wavemap,slitmap,order_tab_edges,model_config_frame,fluxcal_2D_frame,instrument));
813
814 check(xsh_compute_wavelength_resampling_accuracy(wavemap,order_tab_edges,model_config_frame,fluxcal_rect_1D_frame,instrument));
815 check(xsh_compute_wavelength_resampling_accuracy(wavemap,order_tab_edges,model_config_frame,fluxcal_1D_frame,instrument));
816
817 }
818
819 }
820
821 if(cut_uvb_spectrum) {
822 if(instrument->arm == XSH_ARM_UVB) {
823 check(xsh_image_cut_dichroic_uvb(combeso_frame));
827 if(fluxcal_rect_2D_frame != NULL) {
828 check(xsh_image_cut_dichroic_uvb(fluxcal_rect_2D_frame));
830 check(xsh_image_cut_dichroic_uvb(fluxcal_2D_frame));
831 check(xsh_spectrum_cut_dichroic_uvb(fluxcal_1D_frame));
832 }
833 }
834 }
835
836
837 /* Save products */
838 usedframes = cpl_frameset_duplicate(frameset);
839
840 check( xsh_add_product_image( combeso_frame, frameset,
841 parameters, RECIPE_ID, instrument,NULL));
842
843 check( xsh_add_product_orders_spectrum( res1Deso_frame, frameset, parameters,
844 RECIPE_ID, instrument,NULL));
845
846 /* Calculate curvature QC params early */
847 cpl_image* itmp = cpl_image_load(cpl_frame_get_filename(res2D_frame),CPL_TYPE_DOUBLE,0,0);
848 calc_curve_qc(itmp,instrument,qclist);
849 cpl_image_delete(itmp);
850
851 check( xsh_add_product_pre( res2D_frame, frameset, parameters,
852 RECIPE_ID, instrument,qclist));
854
855
856 if(fluxcal_2D_frame != NULL) {
857 check( xsh_add_product_spectrum( fluxcal_2D_frame, frameset, parameters,
858 RECIPE_ID, instrument, NULL,qclist));
859 }
860
862
863 check( xsh_add_product_spectrum( s1D_frame, frameset, parameters,
864 RECIPE_ID, instrument, &uncalframe,qclist));
865
866 if ( do_computemap){
867
868 check( xsh_add_product_image( wavemap, frameset,
869 parameters, RECIPE_ID, instrument,NULL));
870
871
872 check( xsh_add_product_image( slitmap, frameset,
873 parameters, RECIPE_ID, instrument,NULL));
874 }
875
876 if(fluxcal_2D_frame != NULL) {
877 check( xsh_add_product_image(fluxcal_rect_2D_frame,frameset,parameters,
878 RECIPE_ID, instrument,NULL));
879 check( xsh_add_product_orders_spectrum(fluxcal_rect_1D_frame,frameset,parameters,
880 RECIPE_ID, instrument,NULL));
881
882 xsh_monitor_spectrum1D_extra_qc(fluxcal_1D_frame,instrument,qclist);
883 check( xsh_add_product_spectrum( fluxcal_1D_frame, frameset, parameters,
884 RECIPE_ID, instrument, &fluxframe,qclist));
885 }
886
887 if (generate_sdp_format) {
888 cpl_frame * fluxframe_copy = fluxframe;
889 cpl_frame * uncalframe_copy = uncalframe;
890 if (fluxframe != NULL) {
891 check( cpl_frameset_insert(usedframes, fluxframe) );
892 fluxframe = NULL; /* prevent direct deletion in cleanup section,
893 will be deleted together with usedframes. */
894 }
895 if (uncalframe != NULL) {
896 check( cpl_frameset_insert(usedframes, uncalframe) );
897 uncalframe = NULL; /* prevent direct deletion in cleanup section,
898 will be deleted together with usedframes. */
899 }
900 check( xsh_add_sdp_product_spectrum(fluxframe_copy, uncalframe_copy,
901 frameset, usedframes, parameters, RECIPE_ID, instrument,qclist) );
902 /* Restore usedframes to what it was before in case we want to reuse it */
903 if (fluxframe_copy != NULL) {
904 check( cpl_frameset_erase_frame(usedframes, fluxframe_copy) );
905 }
906 if (uncalframe_copy != NULL) {
907 check( cpl_frameset_erase_frame(usedframes, uncalframe_copy) );
908 }
909 }
910
911 cleanup:
912
913 xsh_end( RECIPE_ID, frameset, parameters);
915 xsh_free_frameset( &raws);
916 xsh_free_frameset( &calib);
917 xsh_free_frameset(&usedframes);
918 XSH_FREE( rec_prefix);
919 XSH_FREE(ipol_bp);
920 xsh_free_frameset(&raws_ord_set);
921 xsh_free_frameset(&raws_avg);
922 xsh_free_frame(&wavemap);
923 xsh_free_frame(&slitmap);
924 xsh_free_frame(&bpmap);
925
926 XSH_FREE( stack_par);
927 XSH_FREE( rectify_par);
928 XSH_FREE( crh_single_par);
929 XSH_FREE( loc_obj_par);
930 XSH_FREE( slit_limit_par);
931 XSH_FREE( combine_nod_par);
932 XSH_FREE( extract_par);
933 XSH_FREE( bary_par);
934
935
936 xsh_free_frameset( &nod_set);
937 xsh_free_frameset( &comb_set);
938 xsh_free_frameset( &comb_eff_set);
939 xsh_free_frame( &comb_frame);
940 xsh_free_frame( &combeso_frame);
941 xsh_free_frame( &res2D_frame);
942 xsh_free_frame( &loc_table_frame);
943 xsh_free_frame( &res1D_frame);
944
945 xsh_free_frameset(&nod_set);
946 xsh_free_frameset(&comb_set);
947 xsh_free_frameset(&comb_eff_set);
948 xsh_free_frame(&comb_frame);
949 xsh_free_frame(&combeso_frame);
950 xsh_free_frame(&res2D_frame);
951 xsh_free_frame(&loc_table_frame);
952 xsh_free_frame(&res1D_frame);
953
954
955 xsh_free_frame(&fluxframe);
956 xsh_free_frame(&uncalframe);
957
958 cpl_propertylist_delete(qclist);
959
960 return;
961}
962
static xsh_instrument * instrument
int binx
int biny
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.
Definition: xsh_2dmap.c:151
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)
void xsh_mark_tell(cpl_frame *s1d_frame, cpl_frame *tellmask_frame)
Mark telluric in spectrum.
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)
cpl_error_code xsh_spectrum_cut_dichroic_uvb(cpl_frame *frame1d)
cpl_error_code xsh_spectrum_orders_cut_dichroic_uvb(cpl_frame *frame1d, xsh_instrument *instr)
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 XSH_ASSURE_NOT_NULL_MSG(pointer, msg)
Definition: xsh_error.h:103
#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_ASSURE_NOT_ILLEGAL_MSG(cond, msg)
Definition: xsh_error.h:111
#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)
XSH_ARM xsh_instrument_get_arm(xsh_instrument *i)
Get an arm on instrument structure.
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(...)
Print a message on info level.
Definition: xsh_msg.h:121
#define xsh_msg_dbg_low(...)
Definition: xsh_msg.h:48
int xsh_pfits_get_binx(const cpl_propertylist *plist)
find out the BINX value
Definition: xsh_pfits.c:289
int xsh_pfits_get_biny(const cpl_propertylist *plist)
find out the BINY value
Definition: xsh_pfits.c:306
static int xsh_scired_slit_nod_exec(cpl_plugin *)
Execute the plugin instance given by the interface.
static char xsh_scired_slit_nod_description[]
static void xsh_scired_slit_nod(cpl_parameterlist *, cpl_frameset *)
Corrects input parameters for binning.
#define RECIPE_CONTACT
static int xsh_scired_slit_nod_destroy(cpl_plugin *)
Destroy what has been created by the 'create' function.
static char xsh_scired_slit_nod_description_short[]
static int xsh_scired_slit_nod_create(cpl_plugin *)
Setup the recipe options.
#define RECIPE_ID
#define RECIPE_AUTHOR
static void xsh_get_binning(cpl_frameset *raws, int *binx, int *biny)
set binning
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
char * xsh_stringcat_any(const char *s,...)
Concatenate an arbitrary number of strings.
Definition: xsh_utils.c:1925
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_remove_crh_single_params_set_defaults(cpl_parameterlist *pars, const char *rec_id, xsh_instrument *inst, xsh_remove_crh_single_param *crh_single_par)
Definition: xsh_utils.c:6723
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
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
@ XSH_ARM_UVB
@ XSH_ARM_NIR
@ XSH_MODE_SLIT
#define MIN_SLIT
#define MAX_SLIT
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
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_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
void xsh_add_sdp_product_spectrum(const cpl_frame *flux_cal_frame, const cpl_frame *uncal_frame, cpl_frameset *frameset, const cpl_frameset *usedframes, const cpl_parameterlist *parameters, const char *recipe_id, xsh_instrument *instrument, cpl_propertylist *qclist)
Creates a 1D spectrum product in the Science Data Product format.
Definition: xsh_dfs.c:6326
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_OBJECT_SLIT_NOD
Definition: xsh_dfs.h:228
#define XSH_TELL_MASK
Definition: xsh_dfs.h:1183
#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_GET_TAG_FROM_ARM(TAG, instr)
Definition: xsh_dfs.h:1548
#define XSH_STD_FLUX_SLIT_NOD
Definition: xsh_dfs.h:486
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)
xsh_bary_corr_param * xsh_parameters_bary_corr_get(const char *recipe_id, cpl_parameterlist *list)
get the barycentric correction parameters in a parameters list
void xsh_parameters_bary_corr_create(const char *recipe_id, cpl_parameterlist *list, xsh_bary_corr_param p)
create the barycentric correction parameters in a parameters list
void xsh_parameters_remove_crh_single_create(const char *recipe_id, cpl_parameterlist *plist, xsh_remove_crh_single_param p)
int xsh_parameters_cut_uvb_spectrum_get(const char *recipe_id, const cpl_parameterlist *list)
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
@ BARY_CORR_NONE
#define DECODE_BP_FLAG_NOD
@ LOC_MANUAL_METHOD
@ NOD_METHOD
@ LOCALIZATION_METHOD
@ CLEAN_METHOD
#define XSH_FREE(POINTER)
Definition: xsh_utils.h:92
cpl_error_code xsh_image_cut_dichroic_uvb(cpl_frame *frame1d)
cpl_error_code xsh_scired_slit_nod_get_calibs(cpl_frameset *raws, 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_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_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_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)