X-shooter Pipeline Reference Manual 3.8.15
xsh_scired_ifu_offset.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 PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA *
18 * */
19
20/*
21 * $Author: amodigli $
22 * $Date: 2013-01-03 15:40:13 $
23 * $Revision: 1.100 $
24 *
25*/
26
27#ifdef HAVE_CONFIG_H
28#include <config.h>
29#endif
30
31/*----------------------------------------------------------------------------*/
39/*----------------------------------------------------------------------------*/
42/*-----------------------------------------------------------------------------
43 Includes
44 ----------------------------------------------------------------------------*/
45
46/* DRL steps */
47
48/* Error handling */
49#include <xsh_error.h>
50/* Utility fonctions */
51#include <xsh_utils.h>
52#include <xsh_msg.h>
53/* DFS functions */
54#include <xsh_dfs.h>
55#include <xsh_pfits.h>
56#include <xsh_data_spectrum1D.h>
58/* DRL functions */
59#include <xsh_drl.h>
60#include <xsh_drl_check.h>
61/* Library */
62#include <cpl.h>
63#include <xsh_blaze.h>
64#include <xsh_utils_ifu.h>
65#include <xsh_utils_image.h>
66/*-----------------------------------------------------------------------------
67 Defines
68 ---------------------------------------------------------------------------*/
69
70#define RECIPE_ID "xsh_scired_ifu_offset_drl"
71#define RECIPE_AUTHOR "P.Goldoni, L.Guglielmi, R. Haigron, F. Royer"
72#define RECIPE_CONTACT "amodigli@eso.org"
73
74/*-----------------------------------------------------------------------------
75 Functions prototypes
76 ----------------------------------------------------------------------------*/
77
78/*
79 * Plugin initalization, execute and cleanup handlers
80 */
81
82static int xsh_scired_ifu_offset_create( cpl_plugin *);
83static int xsh_scired_ifu_offset_exec( cpl_plugin *);
84static int xsh_scired_ifu_offset_destroy( cpl_plugin *);
85
86/* The actual executor function */
87static void xsh_scired_ifu_offset( cpl_parameterlist *, cpl_frameset *);
88
89/*-----------------------------------------------------------------------------
90 Static variables
91 ----------------------------------------------------------------------------*/
93"Reduce science exposure in IFU configuration and on/off mode";
94
96"This recipe reduces science exposure in IFU configuration and on/off mode\n\
97Input Frames : \n\
98 - A set of 2xn Science frames, \
99 Tag = OBJECT_IFU_OFFSET_arm, SKY_IFU_arm\n\
100 - A spectral format table (Tag = SPECTRAL_FORMAT_TAB_arm)\n\
101 - A master flat frame (Tag = MASTER_FLAT_IFU_arm)\n\
102 - An order table frame(Tag = ORDER_TABLE_EDGES_IFU_arm)\n\
103 - 3 wave solution frames, one per slitlet (Tag = WAVE_TAB_ARC_IFU_slitlet_arm)\n\
104 where 'slitlet' is DOWN, CEN or UP\n\
105 - [OPTIONAL] A dispersion table (Tag = DISP_TAB_IFU_arm)\n\
106 - [OPTIONAL] A badpixel map (Tag = BADPIXEL_MAP_arm)\n\
107Products : \n\
108 - 3 Spectrum order tables 2D (1 per slitlet), PRO.CATG=ORDER2D_slitlet_IFU_arm\n\
109 - 3 Spectrum order tables 1D (1 per slitlet), PRO.CATG=ORDER1D_slitlet_IFU_arm\n\
110 - 3 Spectrum merge tables 2D (1 per slitlet), PRO.CATG=MERGE2D_slitlet_IFU_arm\n\
111 - 3 Spectrum merge tables 1D (1 per slitlet), PRO.CATG=MERGE1D_slitlet_IFU_arm\n\
112 - 1 Spectrum merge 3D, PRO.CATG=MERGE3D_IFU_arm\n" ;
113
114/*-----------------------------------------------------------------------------
115 Functions code
116 ----------------------------------------------------------------------------*/
117/*----------------------------------------------------------------------------*/
126/*----------------------------------------------------------------------------*/
127
128int cpl_plugin_get_info(cpl_pluginlist *list) {
129 cpl_recipe *recipe = NULL;
130 cpl_plugin *plugin = NULL;
131
132 recipe = cpl_calloc(1, sizeof(*recipe));
133 if ( recipe == NULL ){
134 return -1;
135 }
136
137 plugin = &recipe->interface ;
138
139 cpl_plugin_init(plugin,
140 CPL_PLUGIN_API, /* Plugin API */
141 XSH_BINARY_VERSION, /* Plugin version */
142 CPL_PLUGIN_TYPE_RECIPE, /* Plugin type */
143 RECIPE_ID, /* Plugin name */
145 xsh_scired_ifu_offset_description, /* Detailed help */
146 RECIPE_AUTHOR, /* Author name */
147 RECIPE_CONTACT, /* Contact address */
148 xsh_get_license(), /* Copyright */
152
153 cpl_pluginlist_append(list, plugin);
154
155 return (cpl_error_get_code() != CPL_ERROR_NONE);
156}
157
158/*----------------------------------------------------------------------------*/
168/*----------------------------------------------------------------------------*/
169
170static int xsh_scired_ifu_offset_create(cpl_plugin *plugin){
171 cpl_recipe *recipe = NULL;
172 cpl_parameter* p=NULL;
173 char paramname[256];
174 char recipename[256];
175
176 xsh_clipping_param crh_clip_param = {5.0, 5, 0.7, 0,0.3};
177 /* First param (conv_kernel) should be initialized correctly ! */
178 xsh_remove_crh_single_param crh_single = { 0.1, 5, 2.0, 4} ;
179 xsh_rectify_param rectify = { "tanh",
180 CPL_KERNEL_DEFAULT,
181 2,
184 1,0,0.};
185 xsh_stack_param stack_param = {"median",5.,5.};
186 /* 2nd and 3rd params should be initialized correctly */
187 xsh_localize_obj_param loc_obj =
188 {10, 0.1, 0, 0, LOC_MANUAL_METHOD, 0, 2.0,3,3,FALSE};
189 xsh_extract_param extract_par =
191 xsh_interpolate_bp_param ipol_par = {30 };
192 xsh_bary_corr_param bary_corr = {BARY_CORR_NONE };
193 /* Reset library state */
194 xsh_init();
195
196 /* Check input */
197 assure( plugin != NULL, CPL_ERROR_NULL_INPUT, "Null plugin");
198 /* Get the recipe out of the plugin */
199 assure( cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE,
200 CPL_ERROR_TYPE_MISMATCH,
201 "Plugin is not a recipe");
202
203 recipe = (cpl_recipe *)plugin;
204
205 /* Create the parameter list in the cpl_recipe object */
206 recipe->parameters = cpl_parameterlist_new();
207 assure( recipe->parameters != NULL,
208 CPL_ERROR_ILLEGAL_OUTPUT,
209 "Memory allocation failed!");
210
211 /* Set generic parameters (common to all recipes) */
212 check( xsh_parameters_generic( RECIPE_ID, recipe->parameters ) ) ;
213 xsh_parameters_decode_bp(RECIPE_ID,recipe->parameters,-1);
214 check( xsh_parameters_pre_overscan( RECIPE_ID, recipe->parameters ) ) ;
215 check(xsh_parameters_stack_create(RECIPE_ID,recipe->parameters,stack_param));
216 /* crh clipping params */
218 crh_clip_param));
219
220 /* subtract_background_params */
222
223 /* remove_crh_single */
225 crh_single )) ;
226 /* xsh_rectify */
228 rectify )) ;
229 /* xsh_localize_object */
231 loc_obj )) ;
232 /* trivial extract (Just temporary) */
234 recipe->parameters,
235 extract_par,LOCALIZATION_METHOD )) ;
236
238 recipe->parameters,ipol_par)) ;
239
240 /* PIPE-10061 - barycentric correction param */
242 bary_corr)) ;
243
244 check( xsh_parameters_new_double( recipe->parameters, RECIPE_ID,
245 "shift-offsettab-low", 0.0,
246 "Global shift of the lower slitlet slit positions, relative to the central one[arcsec]."));
247check( xsh_parameters_new_double( recipe->parameters, RECIPE_ID,
248 "shift-offsettab-up", 0.0,
249 "Global shift of the upper slitlet slit positions, relative to the central one[arcsec]."));
250
251 check( xsh_parameters_new_boolean( recipe->parameters, RECIPE_ID,
252 "compute-map", TRUE,
253 "if TRUE recompute (wave and slit) maps from the dispersion solution. If sky-subtract is set to TRUE this must be set to TRUE."));
254
255 check( xsh_parameters_new_boolean( recipe->parameters, RECIPE_ID,
256 "check-afc", TRUE,
257 "Input AFC corrected model/wave solution and science frame check."\
258 "If TRUE the recipe verify that the input mode/wave solution is AFC corrected,"\
259 " its INS.OPTIi.NAME is 'Pin_0.5 ', and its OBS.ID and OBS.TARG.NAME values"\
260 " matches with the corresponding values of the science frame."));
261
262 sprintf(recipename,"xsh.%s",RECIPE_ID);
263 sprintf(paramname,"%s.%s",recipename,"flat-method");
264 check( p = cpl_parameter_new_enum( paramname,CPL_TYPE_STRING,
265 "method adopted for flat:",
266 recipename,"master",
267 2,"master","blaze"));
268
269 check(cpl_parameter_set_alias( p,CPL_PARAMETER_MODE_CLI,
270 "flat-method"));
271 check(cpl_parameterlist_append( recipe->parameters, p));
272
273 cleanup:
274 if ( cpl_error_get_code() != CPL_ERROR_NONE ){
275 xsh_error_dump(CPL_MSG_ERROR);
276 return 1;
277 }
278 else {
279 return 0;
280 }
281}
282
283/*----------------------------------------------------------------------------*/
289/*----------------------------------------------------------------------------*/
290
291static int xsh_scired_ifu_offset_exec(cpl_plugin *plugin) {
292 cpl_recipe *recipe = NULL;
293
294 /* Check parameter */
295
296 assure( plugin != NULL, CPL_ERROR_NULL_INPUT, "Null plugin");
297
298 /* Get the recipe out of the plugin */
299 assure( cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE,
300 CPL_ERROR_TYPE_MISMATCH, "Plugin is not a recipe");
301
302 recipe = (cpl_recipe *)plugin;
303
304 /* Check recipe */
305 xsh_scired_ifu_offset(recipe->parameters, recipe->frames);
306
307 cleanup:
308 if ( cpl_error_get_code() != CPL_ERROR_NONE ) {
309 xsh_error_dump(CPL_MSG_ERROR);
311 return 1;
312 }
313 else {
314 return 0;
315 }
316}
317
318
319static cpl_error_code
321 xsh_rectify_param * rectify_par,
322 xsh_localize_obj_param * loc_obj_par)
323{
324
325
326 xsh_msg_dbg_low("bkg params: sampley=%d radius_y=%d",
327 backg->sampley,backg->radius_y);
328
329 xsh_msg_dbg_low("bkg params: radius_x=%d",
330 backg->radius_x);
331
332 xsh_msg_dbg_low("rectify params: radius=%g bin_lambda=%g bin_space=%g",
333 rectify_par->rectif_radius,rectify_par->rectif_bin_lambda,
334 rectify_par->rectif_bin_space);
335
336 xsh_msg_dbg_low("localize params: chunk_nb=%d nod_step=%g",
337 loc_obj_par->loc_chunk_nb,loc_obj_par->nod_step);
338
339 return cpl_error_get_code();
340
341}
342/*--------------------------------------------------------------------------*/
350/*--------------------------------------------------------------------------*/
351
352static cpl_error_code
353xsh_params_bin_scale(cpl_frameset* raws,
355{
356
357 cpl_frame* frame=NULL;
358 const char* name=NULL;
359 cpl_propertylist* plist=NULL;
360 int binx=0;
361 int biny=0;
362
363 check(frame=cpl_frameset_get_frame(raws,0));
364 check(name=cpl_frame_get_filename(frame));
365 check(plist=cpl_propertylist_load(name,0));
368 xsh_free_propertylist(&plist);
369
370 if(biny>1) {
371
372 /*
373 backg->sampley=backg->sampley/biny;
374 Not bin dependent.
375 */
376
377 backg->radius_y=backg->radius_y/biny;
378
379 /*
380 rectify_par->rectif_radius=rectify_par->rectif_radius/biny;
381 Rectify Interpolation radius.
382 For the moment not bin dependent, but for optimal results probably yes
383 */
384
385 /*
386 rectify_par->rectif_bin_lambda=rectify_par->rectif_bin_lambda/biny;
387 Rectify Wavelength Step.
388 For the moment not bin dependent, but for optimal results probably yes
389 */
390
391 /*
392 loc_obj_par->loc_chunk_nb=loc_obj_par->loc_chunk_nb/biny;
393 Localization Nb of chunks.
394 Not bin dependent
395 */
396 }
397
398
399 if(binx>1) {
400
401 backg->radius_x=backg->radius_x/binx;
402
403 /*
404 rectify_par->rectif_bin_space=rectify_par->rectif_bin_space/binx;
405 Rectify Position Step.
406 For the moment not bin dependent, but for optimal results probably yes
407 */
408
409 /*
410 loc_obj_par->nod_step=loc_obj_par->nod_step/binx;
411 Step (arcsec) between A and B images in nodding mode.
412 For the moment not bin dependent, but for optimal results probably yes
413 */
414 }
415
416 cleanup:
417 xsh_free_propertylist(&plist);
418 return cpl_error_get_code();
419
420}
421
422
423/*----------------------------------------------------------------------------*/
429/*----------------------------------------------------------------------------*/
430static int xsh_scired_ifu_offset_destroy(cpl_plugin *plugin)
431{
432 cpl_recipe *recipe = NULL;
433
434 /* reset error state before detroying recipe */
436 /* Check parameter */
437 assure( plugin != NULL, CPL_ERROR_NULL_INPUT, "Null plugin" );
438
439 /* Get the recipe out of the plugin */
440 assure( cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE,
441 CPL_ERROR_TYPE_MISMATCH, "Plugin is not a recipe");
442
443 recipe = (cpl_recipe *)plugin;
444
445 xsh_free_parameterlist(&recipe->parameters);
446
447 cleanup:
448 if (cpl_error_get_code() != CPL_ERROR_NONE)
449 {
450 return 1;
451 }
452 else
453 {
454 return 0;
455 }
456}
457
458/*----------------------------------------------------------------------------*/
466/*----------------------------------------------------------------------------*/
467static void xsh_scired_ifu_offset( cpl_parameterlist* parameters,
468 cpl_frameset* frameset)
469{
471 int recipe_tags_size = 4;
472
473 /* Input frames */
474 cpl_frameset* raws = NULL;
475 cpl_frameset* calib = NULL;
476 /* Beware, do not "free" the following input frames, they are part
477 of the input frameset */
478 cpl_frame* bpmap = NULL;
479 cpl_frame * master_bias = NULL ;
480 cpl_frame * master_dark = NULL ;
481 cpl_frame* master_flat = NULL;
482 cpl_frame* order_tab_edges = NULL;
483 cpl_frameset *wavetab_frameset = NULL ;
484 cpl_frameset *shiftifu_frameset = NULL;
485 cpl_frameset *nshiftifu_frameset = NULL;
486 cpl_frame * model_config_frame = NULL ;
487 cpl_frame * wavemap_frame = NULL ;
488 cpl_frame * slitmap_frame = NULL;
489 cpl_frame * spectral_format = NULL ;
490 cpl_frame *disp_tab_frame = NULL;
491 cpl_frameset * object_frameset = NULL, * sky_frameset = NULL ;
492
493 /* Parameters */
494 xsh_background_param* backg_par = NULL;
495 xsh_remove_crh_single_param * crh_single_par = NULL ;
496 xsh_rectify_param * rectify_par = NULL ;
497 xsh_localize_obj_param * loc_obj_par = NULL ;
498 xsh_extract_param * extract_par = NULL ;
499 xsh_bary_corr_param * bary_par = NULL ;
500 double offset_low =0.0;
501 double offset_up =0.0;
502
503 int recipe_use_model = FALSE;
504 int do_computemap = 0;
505 int check_afc = TRUE;
506
508 int nb_sub_frames ;
509 int nb_raw_frames ;
510
511 /* Intermediate frames */
512
513 cpl_frameset * sub_frameset = NULL ;
514 cpl_frameset * rmbkg_frameset = NULL ;
516 cpl_frameset * nocrh_frameset = NULL;
517 cpl_frameset * clean_frameset = NULL ;
519 cpl_frame * first_frame = NULL;
520 cpl_frame * comb_frame = NULL ;
521 cpl_frameset * rect2_frameset = NULL ;
522 //cpl_frameset * loc_table_frameset = NULL ; /**< Output of xsh_localize_object */
523
524 /* Output Frames (results)*/
525 cpl_frameset * res_1D_frameset = NULL ;
526 cpl_frameset * res_2D_frameset = NULL ;
527 cpl_frame * data_cube = NULL ;
528 cpl_frameset * ext_frameset = NULL ;
529 cpl_frameset * ext_frameset_tables = NULL ;
530
531 int i ;
532 char file_name[256], arm_str[16] ;
533 char file_tag[256];
534 cpl_frame* grid_back=NULL;
535 cpl_frame* frame_backg=NULL;
536 cpl_frameset * ext_frameset_images = NULL ;
537 cpl_frameset * rect2_frameset_tables = NULL ;
538 cpl_frameset * rect2_frameset_tab=NULL;
539 cpl_frameset * rect2_frameset_eso=NULL;
540 char *rec_prefix = NULL;
541 int pre_overscan_corr=0;
542
543 char* flat_method = NULL;
544 cpl_frame * blaze_frame = NULL;
545 cpl_propertylist* plist=NULL;
546 const char* name=NULL;
547 const char* tag="";
548 int naxis2=0;
549 cpl_frame* qc_trace_frame=NULL;
550 int save_size=0;
551 const int peack_search_hsize=5;
552 int method=0;
553
554 xsh_stack_param* stack_par=NULL;
555 int merge_par=0;
556 /**************************************************************************/
557 /* DFS management */
558 /**************************************************************************/
559 check( xsh_begin( frameset, parameters, &instrument, &raws, &calib,
560 recipe_tags, recipe_tags_size,
561 RECIPE_ID, XSH_BINARY_VERSION,
563
564 assure( instrument->mode == XSH_MODE_IFU, CPL_ERROR_ILLEGAL_INPUT,
565 "Instrument NOT in Ifu Mode" ) ;
566
569 /* One should have a multiple of 2 input frames: A-B */
570 check( nb_raw_frames = cpl_frameset_get_size( raws ) ) ;
571 xsh_msg_dbg_low( "Nb of Raw frames: %d", nb_raw_frames ) ;
572 XSH_ASSURE_NOT_ILLEGAL( nb_raw_frames > 1 ) ;
573 {
574 int even_nb = nb_raw_frames % 2 ;
575 XSH_ASSURE_NOT_ILLEGAL( even_nb == 0 ) ;
576 }
577
578 check( rec_prefix = xsh_set_recipe_file_prefix( raws,
579 RECIPE_ID));
580
581
582 /**************************************************************************/
583 /* Recipe frames */
584 /**************************************************************************/
585
586 check(bpmap = xsh_find_master_bpmap(calib));
587
588 /* In UVB and VIS mode */
590 /* RAWS frameset must have only one file */
591 check( master_bias = xsh_find_frame_with_tag(calib,XSH_MASTER_BIAS,
592 instrument));
593 }
594 /* IN NIR mode */
595 else {
596 /* split on and off files */
597 /*check(xsh_dfs_split_nir(raws,&on,&off));
598 XSH_ASSURE_NOT_ILLEGAL(cpl_frameset_get_size(on) >= 3);
599 XSH_ASSURE_NOT_ILLEGAL(cpl_frameset_get_size(off) >= 3);*/
600 }
601
602 check(order_tab_edges = xsh_find_order_tab_edges(calib,instrument));
603
604 /* one should have either model config frame or wave sol frame */
605 if((model_config_frame = xsh_find_frame_with_tag(calib,
607 instrument)) == NULL) {
608
610
611 if ((model_config_frame = xsh_find_frame_with_tag(calib,XSH_MOD_CFG_TAB,
612 instrument)) == NULL) {
614 }
615
616 }
617
618 cpl_error_reset() ;
619
620 /* OPTIONAL */
621 shiftifu_frameset = xsh_find_offset_tab_ifu( calib,
622 instrument);
624
625 wavetab_frameset = xsh_find_wave_tab_ifu( calib, instrument);
626 cpl_error_reset() ;
627
628 /*
629 One of model config and wave tab must be present, but only one !
630 */
631 if ( model_config_frame == NULL){
632 xsh_msg("RECIPE USE WAVE SOLUTION");
633 recipe_use_model = FALSE;
634 }
635 else{
636 xsh_msg("RECIPE USE MODEL");
637 recipe_use_model = TRUE;
638 }
639
640 XSH_ASSURE_NOT_ILLEGAL( (model_config_frame != NULL && wavetab_frameset == NULL ) ||
641 (model_config_frame == NULL && wavetab_frameset != NULL ) );
642
643 check( master_flat = xsh_find_master_flat( calib, instrument ) ) ;
644
645 if((master_dark = xsh_find_frame_with_tag(calib,XSH_MASTER_DARK,
646 instrument)) == NULL){
647 xsh_msg_warning("Frame %s not provided",XSH_MASTER_DARK);
649 }
650
651 check( spectral_format = xsh_find_spectral_format( calib, instrument ) ) ;
652
653
654 /**************************************************************************/
655 /* Recipe parameters */
656 /**************************************************************************/
657 check( stack_par = xsh_stack_frames_get( RECIPE_ID, parameters));
658
660 parameters));
661
663 parameters));
665 parameters));
666 rectify_par->conserve_flux=FALSE;
668 parameters));
669
670 check(extract_par=xsh_parameters_extract_get(RECIPE_ID, parameters));
671
672 check( do_computemap = xsh_parameters_get_boolean( parameters, RECIPE_ID,
673 "compute-map"));
674
675 check( check_afc = xsh_parameters_get_boolean( parameters, RECIPE_ID,
676 "check-afc"));
677
678 if ( do_computemap && recipe_use_model==FALSE){
679 check( disp_tab_frame = xsh_find_disp_tab( calib, instrument));
680 }
681
683
684 /* adjust relevant parameter to binning */
686 check(xsh_params_bin_scale(raws,backg_par));
687 }
688 check(xsh_params_monitor(backg_par,rectify_par,loc_obj_par));
689
690 check( offset_low = xsh_parameters_get_double( parameters, RECIPE_ID,
691 "shift-offsettab-low"));
692
693 check( offset_up = xsh_parameters_get_double( parameters, RECIPE_ID,
694 "shift-offsettab-up"));
695
696 /* update slitlets with manual shift */
697 if ( shiftifu_frameset != NULL){
698 xsh_msg("offset low %f up %f", offset_low, offset_up);
699 check( nshiftifu_frameset = xsh_shift_offsettab( shiftifu_frameset,
700 offset_low, offset_up));
701 }
702
703 // PIPE-10061 - get barycentric corr param
704 check(bary_par = xsh_parameters_bary_corr_get( RECIPE_ID, parameters)) ;
705
706 /**************************************************************************/
707 /* Recipe code */
708 /**************************************************************************/
709
710 /* prepare RAW frames in PRE format */
711 check(xsh_prepare(raws, bpmap, master_bias, XSH_OBJECT_IFU_OFFSET,
712 instrument,pre_overscan_corr,CPL_TRUE));
713 check( first_frame = cpl_frameset_get_frame( raws, 0));
714
715 /* Get wavemap and slitmap */
716 check( xsh_check_get_map( disp_tab_frame, order_tab_edges,
717 first_frame, model_config_frame, calib, instrument,
718 do_computemap, recipe_use_model, rec_prefix,
719 &wavemap_frame, &slitmap_frame));
720
721 /* Separate OBJECT and SKY frames */
722 check( nb_sub_frames = xsh_dfs_split_offset( raws, XSH_OBJECT_IFU_OFFSET,
723 XSH_SKY_IFU, &object_frameset,
724 &sky_frameset ));
725
726 /**************************************************************************/
727 /* Check that OBJECT IFU frame and AFC corrected CFG are proper */
728 /**************************************************************************/
729 for( i = 0 ; i<nb_sub_frames ; i++ ) {
730 cpl_frame *frame = NULL;
731
732 frame = cpl_frameset_get_frame( object_frameset, i );
733 check( xsh_check_afc( check_afc, model_config_frame,
734 frame, wavetab_frameset, order_tab_edges, disp_tab_frame,
735 instrument));
736 }
737 /**************************************************************************/
738 /* Check that SKY IFU frame and AFC corrected CFG are proper */
739 /**************************************************************************/
740 for( i = 0 ; i<nb_sub_frames ; i++ ) {
741 cpl_frame *frame = NULL;
742
743 frame = cpl_frameset_get_frame( sky_frameset, i );
744 check( xsh_check_afc( check_afc, model_config_frame,
745 frame, wavetab_frameset, order_tab_edges, disp_tab_frame,
746 instrument));
747 }
748
749
750 /* For each pair, subtract OBJECT-SKY */
751 check( sub_frameset = xsh_subtract_sky_offset( object_frameset, sky_frameset,
752 nb_sub_frames, instrument )) ;
753 check( rmbkg_frameset = cpl_frameset_new() ) ;
754 check( nocrh_frameset = cpl_frameset_new() ) ;
755 check( clean_frameset = cpl_frameset_new() ) ;
756
757 sprintf( arm_str, "%s_", xsh_instrument_arm_tostring(instrument) ) ;
758
759
760 /* For each sky subtracted frame */
761 for( i = 0 ; i<nb_sub_frames ; i++ ) {
762 cpl_frame * a_b = NULL ;
763 cpl_frame * rm_bkg = NULL ;
764 char str[16] ;
765
766 sprintf( str, "%d", i ) ;
767 a_b = cpl_frameset_get_frame( sub_frameset, i ) ;
768
769 /* subtract background */
770 xsh_msg("Subtract inter-order background %d", i );
771 sprintf(file_name, "%s%s",rec_prefix, str) ;
772 xsh_free_frame( &frame_backg);
773 check(rm_bkg = xsh_subtract_background( a_b,
774 order_tab_edges,
775 backg_par, instrument,
776 file_name,&grid_back,
777 &frame_backg,0,0,0));
778
779 check( cpl_frameset_insert( rmbkg_frameset, rm_bkg ) ) ;
780 }
781
782
783 check( flat_method = xsh_parameters_get_string( parameters, RECIPE_ID,
784 "flat-method"));
785 if ( strcmp( flat_method, "master") != 0){
786 xsh_msg("---Create blaze image");
787 check( blaze_frame = xsh_blaze_image( master_flat, order_tab_edges,
788 instrument));
789 }
790
791 if ( nb_sub_frames < 3 && crh_single_par->nb_iter > 0 ) {
792 xsh_msg( "Less than 3 frames AND crh_single_niter > 0" ) ;
793 for ( i = 0 ; i < nb_sub_frames ; i++ ) {
794 cpl_frame * divided = NULL ;
795 cpl_frame * rm_crh = NULL ;
796 cpl_frame * a_b = NULL ;
797
798 check( a_b = cpl_frameset_get_frame( rmbkg_frameset, i ) ) ;
799 sprintf( file_tag, "NO_CRH_IFU_OFFSET_%s%d", arm_str,i);
800 xsh_msg( "Remove crh (single frame)" );
801 check( rm_crh = xsh_remove_crh_single( a_b,instrument,NULL,
802 crh_single_par,
803 file_tag ));
804 check( cpl_frameset_insert( nocrh_frameset, rm_crh));
805
806 xsh_msg( "Divide by flat" ) ;
807 sprintf( file_tag, "FF_IFU_OFFSET_%s%d", arm_str, i);
808 if ( strcmp( flat_method, "master") == 0){
809 check( divided = xsh_divide_flat( rm_crh, master_flat,
810 file_tag, instrument));
811 }
812 else{
813 check( divided = xsh_divide_by_blaze( rm_crh,
814 blaze_frame, instrument));
815 }
816
817 check( cpl_frameset_insert( clean_frameset, divided));
818 }
819 }
820 else for( i = 0 ; i < nb_sub_frames ; i++ ) {
821 cpl_frame * divided = NULL ;
822 cpl_frame * a_b = NULL ;
823
824 /* If enough frames, the CRH removal is done in xsh_combine_offset */
825 a_b = cpl_frameset_get_frame( rmbkg_frameset, i ) ;
826
827 /* Divide by flat */
828 xsh_msg( "Divide by flat" ) ;
829 sprintf( file_tag, "FF_IFU_OFFSET_%s%d", arm_str, i);
830
831 if ( strcmp( flat_method, "master") == 0){
832 check( divided = xsh_divide_flat( a_b, master_flat,
833 file_tag, instrument));
834 }
835 else{
836 check( divided = xsh_divide_by_blaze( a_b,
837 blaze_frame, instrument));
838 }
839 check( cpl_frameset_insert( clean_frameset, divided ) ) ;
840 }
841
842
843 /* Now combine all frames */
844 xsh_msg( "Combining all frames" );
845 sprintf( file_tag, "COMBINED_IFU_OFFSET_%s_ALL", arm_str);
846
847
848 check( comb_frame = xsh_combine_offset( clean_frameset,
849 file_tag, stack_par,
850 instrument, NULL, NULL,0));
851
852
853 /* Now rectify the combined frame */
854 xsh_msg( "Rectify combined frame" ) ;
855 rect2_frameset_eso=cpl_frameset_new();
856 rect2_frameset_tab=cpl_frameset_new();
857 check( rect2_frameset = xsh_rectify_ifu( comb_frame, order_tab_edges,
858 wavetab_frameset,
859 nshiftifu_frameset,
860 model_config_frame,
861 instrument, rectify_par,
862 spectral_format,
863 slitmap_frame, &rect2_frameset_eso,
864 &rect2_frameset_tab,rec_prefix));
865
866#if 0
867 /* Must localize (if extract-method=localization) */
868 if ( extract_par->method == LOCALIZATION_METHOD &&
869 loc_table_frameset == NULL ) {
870 xsh_msg( "Localize obj ifu frame" ) ;
871 check( loc_table_frameset = xsh_localize_obj_ifu( rect2_frameset, NULL,
873 loc_obj_par, NULL) ) ;
874 }
875
876 xsh_msg( "Extract ifu frame" ) ;
877 check(rect2_frameset_tables=xsh_frameset_ext_table_frames(rect2_frameset));
878 check(ext_frameset = xsh_extract_ifu(rect2_frameset_tables,
879 loc_table_frameset,
880 instrument, extract_par,rec_prefix )) ;
881 xsh_msg( "Merge orders with 1D frame" ) ;
882 check(ext_frameset_tables=xsh_frameset_ext_table_frames(ext_frameset));
883
884 check( res_1D_frameset = xsh_merge_ord_ifu( ext_frameset_tables, instrument,
885 merge_par,rec_prefix ));
886 xsh_free_frameset(&ext_frameset_tables);
887#endif
888
889
890
891 xsh_msg( "Merge orders with 2D frame" ) ;
892 check( res_2D_frameset = xsh_merge_ord_ifu( rect2_frameset,instrument,
893 merge_par,rec_prefix ));
894
895 check( data_cube = xsh_cube( res_2D_frameset, instrument, rec_prefix));
896
897 xsh_msg( "Saving Products for IFU" ) ;
898 check( xsh_add_product_pre_3d( data_cube, frameset, parameters,
900
901 name=cpl_frame_get_filename(data_cube);
902 plist=cpl_propertylist_load(name,0);
903 naxis2=xsh_pfits_get_naxis2(plist);
904 xsh_free_propertylist(&plist);
905 check( qc_trace_frame=xsh_cube_qc_trace_window(data_cube,
906 instrument,tag,rec_prefix,
907 save_size+1,
908 naxis2-save_size,
909 peack_search_hsize,
910 method,0));
911 if(qc_trace_frame) {
912 check( xsh_add_product_table( qc_trace_frame, frameset,parameters,
913 RECIPE_ID, instrument,NULL));
914 }
915#if 0
916 check(ext_frameset_tables=xsh_frameset_ext_table_frames(ext_frameset));
917 check(ext_frameset_images=xsh_frameset_ext_image_frames(ext_frameset));
918 /* saving products*/
919 xsh_msg( "Saving Products for IFU" ) ;
920
921 for( i = 0 ; i<3 ; i++ ) {
922 cpl_frame * rec_frame = NULL ;
923 cpl_frame * ext_frame = NULL ;
924 cpl_frame * res1d_frame = NULL ;
925 cpl_frame * res2d_frame = NULL ;
926
927 check( rec_frame = cpl_frameset_get_frame( rect_frameset_eso, i ) ) ;
928 xsh_msg( "Product from '%s' [%s]",
929 cpl_frame_get_filename( rec_frame ),
930 cpl_frame_get_tag( rec_frame ) ) ;
931 check( xsh_add_product_image( rec_frame, frameset, parameters,
932 RECIPE_ID, instrument,NULL));
933
934 check( ext_frame = cpl_frameset_get_frame( ext_frameset_images, i ) ) ;
935 xsh_msg( "Product from '%s' [%s]",
936 cpl_frame_get_filename( ext_frame ),
937 cpl_frame_get_tag( ext_frame ) ) ;
938 check( xsh_add_product_image( ext_frame, frameset, parameters,
939 RECIPE_ID, instrument,NULL));
940
941 check( res2d_frame = cpl_frameset_get_frame( res_2D_frameset, i ) ) ;
942 xsh_msg( "Product from '%s' [%s]",
943 cpl_frame_get_filename( res2d_frame ),
944 cpl_frame_get_tag( res2d_frame ) ) ;
945 check( xsh_add_product_pre( res2d_frame, frameset, parameters,
947
948
949 check( res1d_frame = cpl_frameset_get_frame( res_1D_frameset, i ) ) ;
951
952
953 xsh_msg( "Product from '%s' [%s]",
954 cpl_frame_get_filename( res1d_frame ),
955 cpl_frame_get_tag( res1d_frame ) ) ;
956 check( xsh_add_product_spectrum( res1d_frame, frameset, parameters,
958
959 }
960 xsh_free_frameset(&rect2_frameset_tables);
961 xsh_free_frameset(&ext_frameset_tables);
962
963 xsh_msg( "Product from '%s' [%s]",
964 cpl_frame_get_filename( data_cube ),
965 cpl_frame_get_tag( data_cube ) ) ;
966 check( xsh_add_product_pre_3d( data_cube, frameset, parameters,
968
969#endif
970 cleanup:
971 xsh_end( RECIPE_ID, frameset, parameters );
972 XSH_FREE( rec_prefix);
973 XSH_FREE( backg_par);
974 XSH_FREE( crh_single_par);
975 XSH_FREE( rectify_par);
976 XSH_FREE( loc_obj_par);
977 XSH_FREE( stack_par);
978 XSH_FREE( bary_par);
979
980 XSH_FREE( extract_par);
982
983 xsh_free_frameset(&ext_frameset_images);
984 xsh_free_frameset(&ext_frameset_tables);
985
986 xsh_free_frameset(&raws);
987 xsh_free_frameset(&calib);
988 xsh_free_frameset( &wavetab_frameset);
989 xsh_free_frameset( &shiftifu_frameset);
990 xsh_free_frameset( &nshiftifu_frameset);
991 xsh_free_frameset( &object_frameset);
992 xsh_free_frameset( &sky_frameset);
993 xsh_free_frameset( &sub_frameset ) ;
994 xsh_free_frameset( &nocrh_frameset);
995 xsh_free_frameset( &clean_frameset ) ;
996 xsh_free_frameset( &rmbkg_frameset ) ;
997 xsh_free_frameset(&res_1D_frameset) ;
998 xsh_free_frameset(&res_2D_frameset) ;
999
1000 xsh_free_frameset( &rect2_frameset) ;
1001 xsh_free_frameset( &rect2_frameset_eso);
1002 xsh_free_frameset( &rect2_frameset_tab);
1003 xsh_free_frameset(&rect2_frameset_tables);
1004
1005 xsh_free_frameset(&ext_frameset) ;
1006 xsh_free_frame( &slitmap_frame);
1007 xsh_free_frame( &wavemap_frame);
1008 xsh_free_frame( &comb_frame);
1009 xsh_free_frame( &data_cube);
1010 xsh_free_frame( &grid_back);
1011 xsh_free_frame( &frame_backg);
1012 xsh_free_frame( &blaze_frame);
1013 xsh_free_frame( &qc_trace_frame);
1014 return;
1015}
1016
static xsh_instrument * instrument
int binx
int biny
cpl_frame * xsh_divide_by_blaze(cpl_frame *pre_frame, cpl_frame *blaze_frame, xsh_instrument *instrument)
Divide a pre image by the blaze image.
Definition: xsh_blaze.c:71
cpl_frame * xsh_blaze_image(cpl_frame *masterflat_frame, cpl_frame *order_frame, xsh_instrument *instrument)
Normalize a master flat frame order by order.
Definition: xsh_blaze.c:143
cpl_error_code xsh_monitor_spectrum1D_flux(cpl_frame *in_frm, xsh_instrument *instrument)
cpl_frame * xsh_divide_flat(cpl_frame *frame, cpl_frame *flat, const char *tag, xsh_instrument *instr)
divide PRE frame with the master FLAT frame
Definition: xsh_divide.c:75
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_ILLEGAL(cond)
Definition: xsh_error.h:107
#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
cpl_frame * xsh_cube(cpl_frameset *merge2d_frameset, xsh_instrument *instrument, const char *rec_prefix)
Create a cube.
Definition: xsh_format.c:472
cpl_frameset * xsh_extract_ifu(cpl_frameset *rec_frame_set, cpl_frameset *loc_frame_set, xsh_instrument *instrument, xsh_extract_param *extract_par, const char *rec_prefix)
Loop on IFU Frames to extract simple 1D (1 per slitlet)
Definition: xsh_extract.c:868
const char * xsh_instrument_arm_tostring(xsh_instrument *i)
Get the string associated with an arm.
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_frameset * xsh_localize_obj_ifu(cpl_frameset *sci_frame, cpl_frame *skymask_frame, xsh_instrument *instrument, xsh_localize_obj_param *loc_obj_par, xsh_slit_limit_param *slit_limit_param)
cpl_frameset * xsh_merge_ord_ifu(cpl_frameset *rec_frameset, xsh_instrument *instrument, int merge_par, 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(...)
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
int xsh_pfits_get_naxis2(const cpl_propertylist *plist)
find out the NAXIS2 value
Definition: xsh_pfits.c:244
cpl_frameset * xsh_rectify_ifu(cpl_frame *sci_frame, cpl_frame *order_table_frame, cpl_frameset *wavesol_frame_set, cpl_frameset *shiftifu_frameset, cpl_frame *model_config_frame, xsh_instrument *instrument, xsh_rectify_param *rectify_par, cpl_frame *spectral_format, cpl_frame *slitmap_frame, cpl_frameset **rec_frameset_ext, cpl_frameset **rec_frameset_tab, const char *rec_prefix)
Definition: xsh_rectify.c:1014
cpl_frame * xsh_combine_offset(cpl_frameset *rawFrames, const char *result_name, xsh_stack_param *stack_par, xsh_instrument *instr, cpl_imagelist **list, cpl_image **crh_ima, const int save_tmp)
cpl_frame * xsh_remove_crh_single(cpl_frame *sci_frame, xsh_instrument *instrument, cpl_mask *sky_map, xsh_remove_crh_single_param *single_par, const char *name)
Remove cosmic rays from a single frame.
#define RECIPE_CONTACT
static cpl_error_code xsh_params_monitor(xsh_background_param *backg, xsh_rectify_param *rectify_par, xsh_localize_obj_param *loc_obj_par)
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.
static char xsh_scired_ifu_offset_description[]
static int xsh_scired_ifu_offset_exec(cpl_plugin *)
Execute the plugin instance given by the interface.
static cpl_error_code xsh_params_bin_scale(cpl_frameset *raws, xsh_background_param *backg)
scale relevant input parameters for binning
static char xsh_scired_ifu_offset_description_short[]
static int xsh_scired_ifu_offset_destroy(cpl_plugin *)
Destroy what has been created by the 'create' function.
static void xsh_scired_ifu_offset(cpl_parameterlist *, cpl_frameset *)
Interpret the command line options and execute the data processing.
#define RECIPE_ID
#define RECIPE_AUTHOR
static int xsh_scired_ifu_offset_create(cpl_plugin *)
Setup the recipe options.
cpl_frameset * xsh_subtract_sky_offset(cpl_frameset *object_raws, cpl_frameset *sky_raws, int nraws, xsh_instrument *instrument)
cpl_frame * xsh_subtract_background(cpl_frame *frame, cpl_frame *ordertable, xsh_background_param *bckg, xsh_instrument *instr, const char *prefix, cpl_frame **grid_frame, cpl_frame **frame_backg, const int save_bkg, const int save_grid, const int save_sub_bkg)
Subtract the inter-order background from PRE frame.
Definition: xsh_subtract.c:947
void xsh_free_parameterlist(cpl_parameterlist **p)
Deallocate a parameter list and set the pointer to NULL.
Definition: xsh_utils.c:2224
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
const char * xsh_get_license(void)
Get the pipeline copyright and license.
Definition: xsh_utils.c:1193
void xsh_init(void)
Reset library state.
Definition: xsh_utils.c:1160
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 xsh_rectify_params_set_defaults(cpl_parameterlist *pars, const char *rec_id, xsh_instrument *inst, xsh_rectify_param *rectify_par)
Definition: xsh_utils.c:6681
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
@ XSH_ARM_NIR
@ XSH_MODE_IFU
const char * method
Definition: xsh_detmon_lg.c:78
cpl_frame * xsh_find_spectral_format(cpl_frameset *frames, xsh_instrument *instr)
Find spectral format frame.
Definition: xsh_dfs.c:4318
int xsh_dfs_split_offset(cpl_frameset *input, const char *object_tag, const char *sky_tag, cpl_frameset **object, cpl_frameset **sky)
split input RAW offset sof in OBJECT_... and SKY_... framesets
Definition: xsh_dfs.c:1357
cpl_frame * xsh_find_disp_tab(cpl_frameset *frames, xsh_instrument *instr)
Find Dispersol tab frame. The frame returned should not be free by the caller.
Definition: xsh_dfs.c:4066
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_frameset * xsh_frameset_ext_table_frames(cpl_frameset *set)
Extract frameset sub set containing only table frames.
Definition: xsh_dfs.c:207
cpl_frame * xsh_find_order_tab_edges(cpl_frameset *frames, xsh_instrument *instr)
Find an order tab EDGES.
Definition: xsh_dfs.c:3595
void xsh_add_product_pre_3d(cpl_frame *frame, cpl_frameset *frameset, const cpl_parameterlist *parameters, const char *recipe_id, xsh_instrument *instr)
Add 3d product frame.
Definition: xsh_dfs.c:2627
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
cpl_frameset * xsh_find_wave_tab_ifu(cpl_frameset *frames, xsh_instrument *instrument)
Find wave tab ARC (for IFU 3 frames)
Definition: xsh_dfs.c:3756
cpl_frameset * xsh_find_offset_tab_ifu(cpl_frameset *frames, xsh_instrument *instr)
Find offset tab (One for each slitlet)
Definition: xsh_dfs.c:3832
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
cpl_frameset * xsh_frameset_ext_image_frames(cpl_frameset *set)
Extract frameset sub set containing only table frames.
Definition: xsh_dfs.c:286
cpl_error_code xsh_ensure_raws_input_offset_recipe_is_proper(cpl_frameset **raws, xsh_instrument *instrument)
Make sure input frames is an even number (eventually removes the last from the input list)
Definition: xsh_dfs.c:352
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_frame * xsh_find_master_flat(cpl_frameset *frames, xsh_instrument *instr)
Find master flat frame.
Definition: xsh_dfs.c:3426
cpl_frame * xsh_find_master_bpmap(cpl_frameset *set)
find the master bad pixel map in a set of files
Definition: xsh_dfs.c:1621
#define XSH_MOD_CFG_OPT_AFC
Definition: xsh_dfs.h:1256
#define XSH_MASTER_BIAS
Definition: xsh_dfs.h:549
#define XSH_MASTER_DARK
Definition: xsh_dfs.h:550
#define XSH_STD_FLUX_IFU_OFFSET
Definition: xsh_dfs.h:499
#define XSH_MOD_CFG_TAB
Definition: xsh_dfs.h:1251
#define XSH_SKY_IFU
Definition: xsh_dfs.h:234
#define XSH_STD_TELL_IFU_OFFSET
Definition: xsh_dfs.h:475
#define XSH_SLIT_BIN_SIZE_PIPE_NIR
Definition: xsh_dfs.h:101
#define XSH_WAVE_BIN_SIZE_PIPE_NIR
Definition: xsh_dfs.h:105
#define XSH_OBJECT_IFU_OFFSET
Definition: xsh_dfs.h:231
void xsh_check_afc(int check_flag, cpl_frame *model_frame, cpl_frame *sci_frame, cpl_frameset *wave_frameset, cpl_frame *order_tab_frame, cpl_frame *disp_tab_frame, xsh_instrument *instrument)
Check AFC frame.
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
double xsh_parameters_get_double(const cpl_parameterlist *list, const char *recipe_id, const char *name)
cpl_error_code xsh_parameters_decode_bp(const char *recipe_id, cpl_parameterlist *plist, const int ival)
xsh_localize_obj_param * xsh_parameters_localize_obj_get(const char *recipe_id, cpl_parameterlist *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_clipping_crh_create(const char *recipe_id, cpl_parameterlist *list, xsh_clipping_param p)
create the crh clipping parameters in a parameters list
xsh_extract_param * xsh_parameters_extract_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_background_create(const char *recipe_id, cpl_parameterlist *list)
create the subtract background parameters in a parameters list
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
xsh_rectify_param * xsh_parameters_rectify_get(const char *recipe_id, cpl_parameterlist *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)
xsh_remove_crh_single_param * xsh_parameters_remove_crh_single_get(const char *recipe_id, cpl_parameterlist *list)
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)
xsh_background_param * xsh_parameters_background_get(const char *recipe_id, cpl_parameterlist *list)
get the background parameters in a parameters list
char * xsh_parameters_get_string(const cpl_parameterlist *list, const char *recipe_id, const char *name)
@ BARY_CORR_NONE
@ LOC_MANUAL_METHOD
@ LOCALIZATION_METHOD
#define XSH_FREE(POINTER)
Definition: xsh_utils.h:92
cpl_frameset * xsh_shift_offsettab(cpl_frameset *shiftifu_frameset, double offset_low, double offset_up)
Do a wavelet decomposition using atrous from IDL.
cpl_frame * xsh_cube_qc_trace_window(cpl_frame *frm_cube, xsh_instrument *instrument, const char *suffix, const char *rec_prefix, const int win_min, const int win_max, const int hsize, const int method, const int compute_qc)
Trace object position in a cube.