48#define XSH_CONCAT(A,B) A ## B
49#define XSH_STRING(A) # A
51#define PICKUP_NOISE_HOT_PIXEL_MAP
60#define REGDEBUG_OPTEXTRACT 0
65xsh_prepare( cpl_frameset* frames, cpl_frame* bpmap, cpl_frame* mbias,
67 const int pre_overscan_corr,
const bool flag_neg_and_thresh_pix);
78 cpl_image** ,
const int save_tmp) ;
80#if defined(PICKUP_NOISE_HOT_PIXEL_MAP)
85 cpl_frame ** noisemap ) ;
97 cpl_parameterlist* parameters,
98 cpl_frame* crh_frm,cpl_frame* bp_map_frm);
103 cpl_parameterlist* drs_param,
104 cpl_propertylist* qc_log,
111 cpl_parameterlist* drs_params);
118 cpl_frame * order_tab_cen,
139 const int pre_overscan_corr,
const int save_tmp);
148 const char* filename,
151#define XSH_DIVIDE_FLAT_THRESH 1e-10
155#define XSH_MULTIPLY_FLAT_THRESH 1e+30
162 cpl_frame* ordertable,
166 cpl_frame** grid_frame,
167 cpl_frame** frame_backg,
const int save_bkg,
const int save_grid,
const int save_sub_bkg);
170 cpl_frame* order_table,
176 cpl_frame* order_table,
177 cpl_frame * spectral_format,
181 cpl_frame** resid_frame) ;
185 cpl_frame * spectral_frame,
190#define WAVELENGTH_PRECISION 0.00001
191#define SLIT_PRECISION 0.00001
192#define SLIT_PRECISION_IFU 0.21
194void xsh_create_map( cpl_frame *dispsol_frame, cpl_frame *ordertab_frame,
196 cpl_frame **slitmap_frame,
const char* rec_prefix);
200 cpl_frame * resid_frame,
201 cpl_frame * order_frame,
206 cpl_frame *wave_tab_2d_frame, cpl_frame *order_tab_frame,
209 cpl_frame **dispersol_frame, cpl_frame **slitmap_frame);
213 const char* wave_map_tag,
const char* slit_map_tag,
214 cpl_frame **wavemap_frame, cpl_frame **slitmap_frame,
const int save_tmp);
218 cpl_frame * spectralformat_frame,
219 cpl_frame * resid_frame,
220 cpl_frame * arclines,
225#define XSH_DETECT_ARCLINES_TYPE_POLY 0
226#define XSH_DETECT_ARCLINES_TYPE_MODEL 1
227#define XSH_DETECT_ARCLINES_MODE_NORMAL 0
228#define XSH_DETECT_ARCLINES_MODE_CORRECTED 1
229#define XSH_DETECT_ARCLINES_MODE_RECOVER 2
238 cpl_frame *theo_tab_frame,
239 cpl_frame *arc_lines_tab_frame,
240 cpl_frame* wave_tab_guess_frame,
241 cpl_frame *order_tab_recov_frame,
242 cpl_frame *config_model_frame,
243 cpl_frame *spectralformat_frame,
244 cpl_frame **resid_tab_orders_frame,
245 cpl_frame **arc_lines_clean_tab_frame,
246 cpl_frame **wave_tab_frame,
247 cpl_frame **resid_tab_frame,
254 const int resid_tab_name_sw);
258 cpl_frame *theo_tab_frame,
259 cpl_frame *arc_lines_tab_frame,
260 cpl_frame* wave_tab_guess_frame,
261 cpl_frame *order_tab_recov_frame,
262 cpl_frame *config_model_frame,
263 cpl_frame *spectralformat_frame,
264 cpl_frame **resid_tab_orders_frame,
265 cpl_frame **arc_lines_clean_tab_frame,
266 cpl_frame **wave_tab_frame,
267 cpl_frame **resid_tab_frame,
274 const int resid_tab_name_sw);
280 cpl_frame *order_table,
281 cpl_frame *spectralformat_frame,
282 cpl_frame *model_config_frame,
283 cpl_frame *wavemap_frame,
284 cpl_frame *slitmap_frame,
285 cpl_frame *disptab_frame,
288 cpl_frame ** tilt_list,
289 cpl_frame ** shift_frame);
296 cpl_frame *order_table,
297 cpl_frame *spectralformat_frame,
298 cpl_frame *model_config_frame,
299 cpl_frame *wavemap_frame,
300 cpl_frame *slitmap_frame,
301 cpl_frame *disptab_frame,
304 cpl_frameset *tilt_set,
305 cpl_frame **shift_frame);
315 cpl_frame *disp_tab_frame,
const char * res_name,
const char* tag,
316 cpl_frame** res_frame_ext,cpl_frame** res_frame_tab,
317 int min_index,
int max_index,
double slit_min,
int nslit,
double slit_shift,
318 cpl_frame *slitshift_tab);
322 cpl_frameset *shift_frameset,
325 cpl_frame * slitmap_frame,cpl_frameset ** rec_frameset_ext, cpl_frameset ** rec_frameset_tab,
326 int min_index,
int max_index,
const char* rec_prefix);
329xsh_rectify (cpl_frame * sci_frame, cpl_frame * order_table_frame,
330 cpl_frame * wavesol_frame,
331 cpl_frame * model_config_frame,
334 cpl_frame *spectral_format,
335 cpl_frame *disp_tab_frame,
337 cpl_frame** res_frame_ext,cpl_frame ** res_frame_tab,
344 cpl_frame** res_frame_ext,
345 double **ref_ra,
double **ref_dec,
int flag);
349 cpl_frame * orderlist_frame,
350 cpl_frame *wavesol_frame,
351 cpl_frame * model_frame,
354 cpl_frame *spectralformat_frame,
355 cpl_frame * loc_frame,
356 cpl_frame * loc0_frame,
358 cpl_frame *disp_tab_frame,
359 const char * res_name,
360 cpl_frame** res_frame_ext,
361 cpl_frame** res_frame_tab);
365 cpl_frame * order_table_frame,
366 cpl_frameset *wavesol_frame_set,
367 cpl_frameset *shiftifu_frameset,
368 cpl_frame * model_config_frame,
371 cpl_frame * spectral_format,
372 cpl_frame * slitmap_frame,
373 cpl_frameset** rec_frameset_ext,
374 cpl_frameset** rec_frameset_tab,
375 const char* rec_prefix) ;
377#define XSH_RECTIFY_TYPE_POLY 0
378#define XSH_RECTIFY_TYPE_MODEL 1
381 cpl_frame * loc_frame,
382 cpl_frame * loc0_frame,
383 const char * file_name,
387 cpl_frame** res_frame_ext ) ;
390 cpl_frame * slitmap_frame,
391 double * down,
double * cen,
401 double sldown,
double slup,
double sup,
double slit_bin,
402 double *slitmin_tab,
int *nslit_tab,
double *slitcen_tab);
406 cpl_frame * order_table_frame,
407 cpl_frame * slitmap_frame,
408 cpl_frame * wavemap_frame,
409 cpl_frame * locTable_frame,
410 cpl_frame* ref_sky_list,
411 cpl_frame* sky_orders_chunks,
412 cpl_frame* usr_defined_break_points_frame,
416 cpl_frame ** sky_spectrum,
417 cpl_frame ** sky_spectrum_eso,
418 const char* rec_prefix,
419 const int clean_tmp) ;
434 cpl_frame *skymask_frame,
438 const char * fname );
442 cpl_frame *skymask_frame,
448 cpl_frame* loc_frame,
451 cpl_frame** res_frame_ext,
452 const char* rec_prefix);
455 cpl_frame* loc_frame,
459 cpl_frame** res_frame_ext,
460 const char* rec_prefix);
464 cpl_frameset * loc_frame_set,
467 const char* rec_prefix) ;
472 const char * res_tag);
482 int merge_par,
int slitlet,
483 const char* rec_prefix);
487 int merge,
const char* rec_prefix) ;
492 int merge_par,
const char* rec_prefix) ;
495#define XSH_OBJPOS_NB_COL 2
496#define XSH_OBJPOS_COLNAME_WAVELENGTH "Wavelength"
497#define XSH_OBJPOS_UNIT_WAVELENGTH "nm"
498#define XSH_OBJPOS_COLNAME_SLIT "Slit"
499#define XSH_OBJPOS_UNIT_SLIT "arcsec"
500#define XSH_LAMBDA_DIMM 0.0000005
505 cpl_frame *skymask_frame,
int smooth_hsize,
506 int nscales,
int HF_skip,
const char* resname,
double cut_sigma_low,
507 double cut_sigma_up,
double cut_snr_low,
double cut_snr_up,
508 double slit_min,
double slit_max,
int deg,
int box_hsize,
xsh_instrument *instr);
511 cpl_frame *skymask_frame,
513 const char* resname);
515#define XSH_SHIFTIFU_NB_COL 2
516#define XSH_SHIFTIFU_COLNAME_WAVELENGTH "Wavelength"
517#define XSH_SHIFTIFU_UNIT_WAVELENGTH "nm"
518#define XSH_SHIFTIFU_COLNAME_SHIFTSLIT "Slit_shift"
519#define XSH_SHIFTIFU_UNIT_SHIFTSLIT "arcsec"
522 cpl_frame *shiftifu_frame,
double lambdaref_hsize,
const char* resname);
525 cpl_frameset *objpos_frameset,
526 cpl_frameset *shiftifu_frameset,
xsh_instrument* instr,
const char* prefix);
534 cpl_frame *qth_order_tab_frame,
536 cpl_frame *d2_order_tab_frame,
537 cpl_frame *qth_bkg_frame,
538 cpl_frame *d2_bkg_frame,
539 cpl_frame **qth_d2_flat_frame,
540 cpl_frame **qth_d2_bkg_frame,
541 cpl_frame **qth_d2_order_tab_frame,
545 cpl_frame *qth_order_tab_frame,
546 cpl_frame *d2_frame,cpl_frame *d2_order_tab_frame,
547 cpl_frame *qth_bkg_frame, cpl_frame *d2_bkg_frame,
548 cpl_frame **qth_d2_flat_frame,
549 cpl_frame **qth_d2_bkg_frame,
550 cpl_frame **qth_d2_order_tab_frame,
558 const float* errs,
int* qual,
559 const double* lambda,
562 const int slit_min,
const int slit_max,
563 const int nlambda,
const int nslit,
564 const int mask_hsize,
565 double* fluxval,
double* errval,
int* qualval,
float*,
float*,
float*);
567#define XSH_MATH_SQRT_2 1.4142135623730951
568void xsh_opt_extract( cpl_frame *sci_frame, cpl_frame *order_table_frame,
569 cpl_frame *wavesol_frame, cpl_frame *model_frame, cpl_frame *wavemap_frame,
570 cpl_frame *slitmap_frame, cpl_frame *loc_frame,
571 cpl_frame *spectralformat_frame, cpl_frame *masterflat_frame,
573 const char* rec_prefix,
574 cpl_frame **orderext1d_frame,
575 cpl_frame **orderoxt1d_frame,
576 cpl_frame **orderoxt1d_eso_frame,
577 cpl_frame** qc_subextract_frame,
578 cpl_frame** qc_s2ddiv1d_frame,
579 cpl_frame** qc_model_frame,
580 cpl_frame** qc_weight_frame);
583#define REGDEBUG_GAUSSIAN 0
584#define REGDEBUG_BLAZE 0
585#define REGDEBUG_EXTRACT 0
586#define REGDEBUG_EXTRACT_XY 0
587#define REGDEBUG_SUBEXTRACT_XY 0
588#define REGDEBUG_EXTRACT_STD 0
592 cpl_frame *orderlist_frame,
593 cpl_frame *wavesol_frame,
594 cpl_frame *model_frame,
595 cpl_frame *wavemap_frame,
596 cpl_frame *slitmap_frame,
597 cpl_frame *loc_frame,
598 cpl_frame *spectralformat_frame,
599 cpl_frame *masterflat_frame,
602 int min_index,
int max_index,
603 const char* rec_refix,
604 cpl_frame** orderext1d_frame,
605 cpl_frame** orderoxt1d_frame,
606 cpl_frame** orderoxt1d_eso_frame,
607 cpl_frame** qc_subextract_frame,
608 cpl_frame** qc_s2ddiv1d_frame,
609 cpl_frame** qc_model_frame,
610 cpl_frame** qc_weight_frame);
617 cpl_frame** res_frame_ext,
const int scale_nod ) ;
623 const char* result_name,
const int method_code);
626 cpl_frame *order_tab, cpl_frame *slitmap_frame,
631 const char * result_name,
634cpl_frame*
xsh_cube( cpl_frameset *merge2d_frameset,
642 cpl_frameset * sky_raws,
648 const char *result_name,
651 cpl_imagelist ** list,
652 cpl_image** crh_ima,
const int save_tmp) ;
656 cpl_frame * std_star_flux_frame,
657 cpl_frame * atmos_ext_frame,
658 cpl_frame * high_abs_tab_frame,
665 cpl_frame * std_star_flux_frame,
666 cpl_frame * atmos_ext_frame,
667 cpl_frame * high_abs_tab_frame,
668 cpl_frame* resp_fit_points,
669 cpl_frame * tell_mod_cat_frame,
671 double exptime,
const int tell_corr ) ;
675 cpl_frame * std_star_flux_frame,
676 cpl_frame * atmos_ext_frame,
677 cpl_frame * high_abs_tab_frame,
682 cpl_frame *orderlist_frame, cpl_frame *wavesol_frame,
683 cpl_frame *model_config,
694 cpl_frame *wave_tab_frame,
695 cpl_frame *model_config_frame,
696 cpl_frame *order_tab_frame,
697 cpl_frame *attresidtab_frame,
699 cpl_frame **afc_order_tab_frame,
700 cpl_frame **afc_model_config_frame);
703 cpl_frame *model_config_frame,
int order,
704 cpl_frame *spectralformat_frame,cpl_frame *arclines_frame,
712 cpl_frame * respon_frame,
713 cpl_frame * atmos_ext_frame,
719 cpl_frame *order_tab_frame,
720 cpl_frame* mod_cfg_frame,
721 cpl_frame* wave_map_frame,
722 cpl_frame* slit_map_frame,
724 cpl_frame* spectral_format_frame,
726 const int clean_tmp);
728#define LSTART_COLUMN_NAME "LAMBDASTART"
729#define LEND_COLUMN_NAME "LAMBDAEND"
730#define GUESS_TELL_MASK_RESOLUTION_UVB 9100
731#define GUESS_TELL_MASK_RESOLUTION_VIS 17400
732#define GUESS_TELL_MASK_RESOLUTION_NIR 11300
736void xsh_mark_tell( cpl_frame *s1d_frame, cpl_frame *tellmask_frame);
cpl_frame * xsh_create_master_flat2(cpl_frameset *set, cpl_frame *order_tab_cen, xsh_stack_param *stack_par, xsh_instrument *inst)
Combine master frames.
cpl_frame * xsh_compute_qc_on_master_bias(cpl_frameset *raws, cpl_frame *frame, xsh_instrument *instr, cpl_parameterlist *drs_params)
Computes QC on a master bias frame.
cpl_frame * xsh_create_master_flat_with_mask(cpl_frame *frame, cpl_frame *edges, xsh_instrument *instr)
cpl_frame * xsh_create_master_flat(cpl_frame *frame, xsh_instrument *instr)
cpl_frame * xsh_create_master_bias2(cpl_frameset *rawFrames, xsh_stack_param *stack_par, xsh_instrument *instr, const char *result_name, const int method_code)
Creates master bias.
cpl_frame * xsh_create_master_dark(cpl_frame *bpMap, xsh_instrument *instr, cpl_parameterlist *parameters, cpl_frame *crh_frm, cpl_frame *bp_map_frm)
cpl_frame * xsh_create_master_dark_bpmap(cpl_frame *frame, xsh_instrument *instr)
cpl_frame * xsh_create_master_dark2(cpl_frameset *raws, xsh_stack_param *stack_param, cpl_parameterlist *drs_param, cpl_propertylist *qc_log, xsh_instrument *instr)
cpl_frame * xsh_detect_order_edge(cpl_frame *frame, cpl_frame *order_table, xsh_detect_order_param *det_param, xsh_instrument *instr)
Detect order edges and compute polynomial description of ordermin and order max.
static xsh_instrument * instrument
static xsh_clipping_param crh_clipping
cpl_frame * xsh_calibrate_flux(cpl_frame *spectrum_frame, cpl_frame *respon_frame, cpl_frame *atmos_ext_frame, const char *fname, xsh_instrument *instrument)
cpl_frame * xsh_combine_nod(cpl_frameset *frames, xsh_combine_nod_param *param, const char *fname, xsh_instrument *instrument, cpl_frame **res_frame_ext, const int scale_nod)
cpl_frame * xsh_compute_linearity(cpl_frameset *, xsh_instrument *, xsh_clipping_param *, const int decode_bp)
int xsh_linear_group_by_exptime(cpl_frameset *, xsh_instrument *, double, cpl_frameset **)
cpl_frame * xsh_compute_noise_map(cpl_imagelist *, cpl_frame *bpmap, xsh_clipping_param *, xsh_instrument *instr, cpl_frame **noisemap)
cpl_frameset * xsh_compute_shift_ifu(double lambda_ref, double lambdaref_hsize, cpl_frameset *objpos_frameset, cpl_frameset *shiftifu_frameset, xsh_instrument *instr, const char *prefix)
Compute the shift in slit between reference wavelength and others for all the slitlets.
cpl_frame * xsh_compute_shift_ifu_slitlet(double lambda_ref, cpl_frame *objpos_frame, cpl_frame *shiftifu_frame, double lambdaref_hsize, const char *resname)
Compute the shift in slit between reference wavelength and others.
cpl_frame * xsh_compute_slice_dist(cpl_frameset *loc_frame_set, cpl_frame *order_tab, cpl_frame *slitmap_frame, cpl_frameset *merge_frameset, double lambda, xsh_instrument *instrument)
cpl_frame * xsh_compute_absorp(cpl_frame *s1d_frame, cpl_frame *telllist_frame, int filter_hsize, double threshold, xsh_instrument *instr)
Compute the shift in slit between reference wavelength and others for all the slitlets.
void xsh_mark_tell(cpl_frame *s1d_frame, cpl_frame *tellmask_frame)
Mark telluric in spectrum.
void xsh_data_check_spectralformat(cpl_frame *spectralformat_frame, cpl_frame *orderlist_frame, cpl_frame *wavesol_frame, cpl_frame *model_config, xsh_instrument *instr)
Check the borders of wavelength foreach orders in spectral format.
void xsh_detect_arclines_dan(cpl_frame *frame, cpl_frame *theo_tab_frame, cpl_frame *arc_lines_tab_frame, cpl_frame *wave_tab_guess_frame, cpl_frame *order_tab_recov_frame, cpl_frame *config_model_frame, cpl_frame *spectralformat_frame, cpl_frame **resid_tab_orders_frame, cpl_frame **arc_lines_clean_tab_frame, cpl_frame **wave_tab_frame, cpl_frame **resid_tab_frame, xsh_sol_wavelength type, xsh_detect_arclines_param *da, xsh_clipping_param *dac, xsh_instrument *instr, const char *rec_id, const int clean_tmp, const int resid_tab_name_sw)
detect the position on the detector of emission lines listed in a catalogue, from expected position v...
void xsh_detect_arclines(cpl_frame *frame, cpl_frame *theo_tab_frame, cpl_frame *arc_lines_tab_frame, cpl_frame *wave_tab_guess_frame, cpl_frame *order_tab_recov_frame, cpl_frame *config_model_frame, cpl_frame *spectralformat_frame, cpl_frame **resid_tab_orders_frame, cpl_frame **arc_lines_clean_tab_frame, cpl_frame **wave_tab_frame, cpl_frame **resid_tab_frame, xsh_sol_wavelength type, xsh_detect_arclines_param *da, xsh_clipping_param *dac, xsh_instrument *instr, const char *rec_id, const int clean_tmp, const int resid_tab_name_sw)
detect the position on the detector of emission lines listed in a catalogue, from expected position v...
cpl_frame * xsh_detect_continuum(cpl_frame *frame, cpl_frame *order_table, cpl_frame *spectral_format, xsh_detect_continuum_param *param, xsh_clipping_param *dcn_clipping, xsh_instrument *instr, cpl_frame **resid_frame)
Detect order and compute polynomial description of ordermin and order max. Uses a guess order table i...
cpl_frame * xsh_order_table_from_fmtchk(xsh_pre *pre, cpl_frame *spectral_frame, xsh_detect_continuum_param *detect_param, xsh_instrument *instrument)
cpl_frame * xsh_divide_flat(cpl_frame *frame, cpl_frame *flat, const char *filename, xsh_instrument *instr)
divide PRE frame with the master FLAT frame
cpl_frame * xsh_preframe_extract(cpl_frame *frame, int xmin, int ymin, int xmax, int ymax, const char *name, xsh_instrument *instr)
This function create a sub frame from PRE frame. the sub frame is described by a box.
cpl_frame * xsh_bpmap_2pre(cpl_frame *bpmap, const char *prefix, xsh_instrument *inst)
This function transform a BP map from raw to pre format.
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 ...
cpl_frame * xsh_flat_merge_qth_d2_tabs(cpl_frame *qth_edges_tab, cpl_frame *d2_edges_tab, xsh_instrument *instrument)
Merge two order edges tables according the spectral format.
void xsh_flat_merge_qth_d2(cpl_frame *qth_frame, cpl_frame *qth_order_tab_frame, cpl_frame *d2_frame, cpl_frame *d2_order_tab_frame, cpl_frame *qth_bkg_frame, cpl_frame *d2_bkg_frame, cpl_frame **qth_d2_flat_frame, cpl_frame **qth_d2_bkg_frame, cpl_frame **qth_d2_order_tab_frame, xsh_instrument *instrument)
Merge two master flat fields and order tables according the spectral format.
void xsh_flat_merge_qth_d2_smooth(cpl_frame *qth_frame, cpl_frame *qth_order_tab_frame, cpl_frame *d2_frame, cpl_frame *d2_order_tab_frame, cpl_frame *qth_bkg_frame, cpl_frame *d2_bkg_frame, cpl_frame **qth_d2_flat_frame, cpl_frame **qth_d2_bkg_frame, cpl_frame **qth_d2_order_tab_frame, xsh_instrument *instrument)
Merge two master flat fields and order tables according the spectral format.
cpl_frame * xsh_afcthetab_create(cpl_frame *wave_tab_frame, cpl_frame *model_config_frame, int order, cpl_frame *spectralformat_frame, cpl_frame *arclines_frame, int xmin, int ymin, xsh_instrument *instr, const int clean_tmp)
Create a The tab for AFC.
cpl_frame * xsh_flexcor(cpl_frame *afc_frame, cpl_frame *wave_tab_frame, cpl_frame *model_config_frame, cpl_frame *order_tab_frame, cpl_frame *attresidtab_frame, int afc_xmin, int afc_ymin, xsh_instrument *instr, cpl_frame **afc_order_tab_frame, cpl_frame **afc_model_config_frame)
This function applies the computed shift betwwen AFC CAL and AFC ATT frame.
void xsh_follow_arclines_slit(cpl_frame *inframe, cpl_frame *arclines, cpl_frame *wavesol, cpl_frame *order_table, cpl_frame *spectralformat_frame, cpl_frame *model_config_frame, cpl_frame *wavemap_frame, cpl_frame *slitmap_frame, cpl_frame *disptab_frame, xsh_follow_arclines_param *param, xsh_instrument *instrument, cpl_frame **tilt_list, cpl_frame **shift_frame)
void xsh_follow_arclines_ifu(cpl_frame *inframe, cpl_frame *arclines, cpl_frame *wavesol, cpl_frame *order_table, cpl_frame *spectralformat_frame, cpl_frame *model_config_frame, cpl_frame *wavemap_frame, cpl_frame *slitmap_frame, cpl_frame *disptab_frame, xsh_follow_arclines_param *follow_param, xsh_instrument *instrument, cpl_frameset *tilt_set, cpl_frame **shift_frame)
Detect and follow arc lines. Computes center, width and tilt parameters. The position of the center o...
cpl_frameset * xsh_ifu_wavetab_create(cpl_frame *wave_tab_frame, cpl_frame *shift_tab_frame, xsh_instrument *instr)
Create an IFU wave tab frame set.
double xsh_convert_seeing(cpl_frame *frame)
Convert seeing keywork in mu sigma.
cpl_frameset * xsh_localize_ifu(cpl_frameset *merge2d_frameset, cpl_frame *skymask_frame, xsh_localize_ifu_param *locifu_par, xsh_instrument *instrument, const char *resname)
Localize center of object on a merge 2D IFU slitlet.
cpl_frame * xsh_localize_ifu_slitlet(cpl_frame *merge2d_slitlet, cpl_frame *skymask_frame, int smooth_hsize, int nscales, int HF_skip, const char *resname, double cut_sigma_low, double cut_sigma_up, double cut_snr_low, double cut_snr_up, double slit_min, double slit_max, int deg, int box_hsize, xsh_instrument *instr)
Localize center of object on a merge 2D IFU slitlet.
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_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.
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.
cpl_frame * xsh_merge_ord_slitlet(cpl_frame *rec_frame, xsh_instrument *instrument, int merge_par, int slitlet, const char *rec_prefix)
Merge orders of the rectified frame using merge parameters.
cpl_frame * xsh_multiply_flat(cpl_frame *frame, cpl_frame *flat, const char *filename, xsh_instrument *instr)
multiply PRE frame with the master FLAT frame
cpl_frame * xsh_rectify_and_shift(cpl_frame *sci_frame, cpl_frame *orderlist_frame, cpl_frame *wavesol_frame, cpl_frame *model_frame, xsh_instrument *instrument, xsh_rectify_param *rectify_par, cpl_frame *spectralformat_frame, cpl_frame *loc_frame, cpl_frame *loc0_frame, double *throw_shift, cpl_frame *disp_tab_frame, const char *res_name, cpl_frame **res_frame_ext, cpl_frame **res_frame_tab)
cpl_frameset * xsh_rectify_orders_ifu(cpl_frame *sci_frame, xsh_order_list *orderlist, cpl_frameset *wavesol_frameset, cpl_frameset *shift_frameset, cpl_frame *model_frame, xsh_instrument *instrument, xsh_rectify_param *rectify_par, cpl_frame *spectralformat_frame, cpl_frame *slitmap_frame, cpl_frameset **rec_frameset_ext, cpl_frameset **rec_frameset_tab, int min_index, int max_index, const char *rec_prefix)
cpl_frame * shift_with_kw(cpl_frame *rec_frame, xsh_instrument *instrument, xsh_rectify_param *rectify_par, const char *fname, cpl_frame **res_frame_ext, double **ref_ra, double **ref_dec, int flag)
This function creates a structure containing for each order the shift to be applied.
cpl_frame * xsh_rectify_orders(cpl_frame *sci_frame, xsh_order_list *orderlist_frame, cpl_frame *wavesol_frame, cpl_frame *model_frame, xsh_instrument *instrument, xsh_rectify_param *rectify_par, cpl_frame *spectralformat_frame, cpl_frame *disp_tab_frame, const char *res_name, const char *tag, cpl_frame **res_frame_ext, cpl_frame **res_frame_tab, int min_index, int max_index, double slit_min, int nslit, double slit_shift, cpl_frame *slitshift_tab)
Create a grid in wavelength with the step in lambda and slit. Steps are defined in the parameters....
void xsh_compute_slitlet_limits(cpl_frameset *shift_set, double sdown, double sldown, double slup, double sup, double slit_bin, double *slitmin_tab, int *nslit_tab, double *slitcen_tab)
void xsh_get_slit_edges(cpl_frame *slitmap_frame, double *sdown, double *sup, double *sldown, double *slup, xsh_instrument *instrument)
Trace slit edges in a master flat.
void xsh_rec_slit_size(xsh_rectify_param *rectify_par, double *slit_min, int *nslit, XSH_MODE mode)
rectify frame
cpl_frame * xsh_rectify(cpl_frame *sci_frame, cpl_frame *order_table_frame, cpl_frame *wavesol_frame, cpl_frame *model_config_frame, xsh_instrument *instrument, xsh_rectify_param *rectify_par, cpl_frame *spectral_format, cpl_frame *disp_tab_frame, const char *fname, cpl_frame **res_frame_ext, cpl_frame **res_frame_tab, const char *prefix)
Create a grid in wavelength with the step in lambda and slit. Steps are defined in the parameters....
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)
cpl_frame * xsh_shift_rectified(cpl_frame *rec_frame, cpl_frame *loc_frame, cpl_frame *loc0_frame, const char *file_name, xsh_combine_nod_param *combine_nod_param, xsh_rectify_param *rectif_par, xsh_instrument *instrument, cpl_frame **res_frame_ext)
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_multiple(cpl_frameset *rawFrames, const char *name, xsh_stack_param *stack_param, xsh_clipping_param *crh_clipping, xsh_instrument *inst, cpl_imagelist **, cpl_image **, const int save_tmp)
cpl_frame * xsh_abs_remove_crh_single(cpl_frame *sci_frame, xsh_instrument *instrument, xsh_remove_crh_single_param *single_par, const char *res_tag)
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.
cpl_frameset * xsh_subtract_sky_nod(cpl_frameset *raws, xsh_instrument *instrument, int mode_fast)
cpl_frameset * xsh_subtract_sky_offset(cpl_frameset *object_raws, cpl_frameset *sky_raws, int nraws, xsh_instrument *instrument)
cpl_frame * xsh_add_sky_model(cpl_frame *sub_sky_frame, cpl_frame *sky_frame, xsh_instrument *instrument, const char *rec_prefix)
cpl_frame * xsh_subtract_sky_single(cpl_frame *sci_frame, cpl_frame *order_table_frame, cpl_frame *slitmap_frame, cpl_frame *wavemap_frame, cpl_frame *locTable_frame, cpl_frame *ref_sky_list, cpl_frame *sky_orders_chunks, cpl_frame *usr_defined_break_points_frame, xsh_instrument *instrument, int nbkpts, xsh_subtract_sky_single_param *sky_par, cpl_frame **sky_spectrum, cpl_frame **sky_spectrum_eso, const char *rec_prefix, const int clean_tmp)
Subtract the sky background for single frame. If sky_spectrum is NOT NULL it is saved as a product,...
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.
cpl_frameset * xsh_subtract_nir_on_off(cpl_frameset *on, cpl_frameset *off, xsh_instrument *instr)
(NIR only) subtract the OFF set of files from the On set of files
cpl_frame * xsh_subtract_bias(cpl_frame *frame, cpl_frame *bias, xsh_instrument *instr, const char *type, const int pre_overscan_corr, const int save_tmp)
Subtract the master bias frame from PRE frame.
cpl_frame * xsh_subtract_dark(cpl_frame *frame, cpl_frame *dark, const char *filename, xsh_instrument *instr)
subtract the master dark frame from PRE frame
cpl_frame * xsh_create_poly_wavemap(cpl_frame *pre_frame, cpl_frame *wave_tab_2d_frame, cpl_frame *order_tab_frame, cpl_frame *spectral_format_frame, xsh_dispersol_param *dispsol_par, xsh_instrument *instrument, const char *filename, cpl_frame **dispersol_frame, cpl_frame **slitmap_frame)
cpl_error_code xsh_wavetab_qc(cpl_frame *frm_tab, const int is_poly)
Monitor min/max/med/avg distance between detected lines on each ordee.
cpl_frame * xsh_compute_response_ord(cpl_frame *rect_frame, cpl_frame *std_star_flux_frame, cpl_frame *atmos_ext_frame, cpl_frame *high_abs_tab_frame, xsh_instrument *instrument, double exptime)
cpl_frame * xsh_compute_response(cpl_frame *rect_frame, cpl_frame *std_star_flux_frame, cpl_frame *atmos_ext_frame, cpl_frame *high_abs_tab_frame, xsh_instrument *instrument, double exptime)
void xsh_create_model_map(cpl_frame *model_frame, xsh_instrument *instrument, const char *wave_map_tag, const char *slit_map_tag, cpl_frame **wavemap_frame, cpl_frame **slitmap_frame, const int save_tmp)
void xsh_compute_slitlet_center(xsh_order_list *order_list, cpl_frame *slitmap_frame, double *down, double *cen, double *up, XSH_ARM arm)
cpl_frame * xsh_create_order_table(cpl_frame *in_frame, cpl_frame *spectralformat_frame, cpl_frame *resid_frame, cpl_frame *arclines, xsh_detect_arclines_param *da, xsh_clipping_param *dac, xsh_instrument *instrument)
cpl_frame * xsh_create_dispersol_physmod(cpl_frame *pre_frame, cpl_frame *order_tab_frame, cpl_frame *mod_cfg_frame, cpl_frame *wave_map_frame, cpl_frame *slit_map_frame, xsh_dispersol_param *dispsol_param, cpl_frame *spectral_format_frame, xsh_instrument *instrument, const int clean_tmp)
cpl_frame * xsh_compute_response2(cpl_frame *rect_frame, cpl_frame *std_star_flux_frame, cpl_frame *atmos_ext_frame, cpl_frame *high_abs_tab_frame, cpl_frame *resp_fit_points, cpl_frame *tell_mod_cat_frame, xsh_instrument *instrument, double exptime, const int tell_corr)
cpl_frame * xsh_create_wavemap(cpl_frame *in_frame, cpl_frame *resid_frame, cpl_frame *order_frame, xsh_dispersol_param *dispersol_param, xsh_instrument *instrument)
cpl_error_code xsh_wavemap_qc(cpl_frame *frm_map, const cpl_frame *frm_tab)
Monitor Flux level along the orders traces given by an input table.
void xsh_create_map(cpl_frame *dispsol_frame, cpl_frame *ordertab_frame, cpl_frame *pre_frame, xsh_instrument *instrument, cpl_frame **wavemap_frame, cpl_frame **slitmap_frame, const char *rec_prefix)