X-shooter Pipeline Reference Manual 3.8.15
Data Structures | Functions
xsh_dfs.c File Reference
#include <xsh_baryvel.h>
#include <xsh_dfs.h>
#include <xsh_pfits.h>
#include <xsh_pfits_qc.h>
#include <xsh_data_pre.h>
#include <xsh_data_pre_3d.h>
#include <xsh_error.h>
#include <xsh_msg.h>
#include <cpl.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <time.h>
#include <math.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <xsh_paf_save.h>
#include <xsh_utils_table.h>
#include <xsh_utils_image.h>
#include <xsh_utils.h>
#include <xsh_data_spectrum.h>
#include <irplib_sdp_spectrum.h>

Go to the source code of this file.

Data Structures

struct  _xsh_column_info
 

Functions

static void replace_spaces_with_underscores (char *str)
 
xsh_file_exists

@memo Find if a given file name corresponds to an existing file.

Parameters
filenameName of the file to look up.
Returns
int 1 if file exists, 0 if not @doc

Find out if the given character string corresponds to a file that can be stat()'ed.

static cpl_frame * xsh_find_frame (cpl_frameset *frames, const char *tags[])
 Find a frame.
 
int xsh_file_exists (const char *filename)
 
cpl_frameset * xsh_frameset_extract (const cpl_frameset *frames, const char *tag)
 Extract frames with given tag from frameset.
 
cpl_error_code xsh_frameset_merge (cpl_frameset *set1, cpl_frameset *set2)
 Extracts raw frames.
 
xsh_instrumentxsh_dfs_set_groups (cpl_frameset *set)
 Set the group as RAW or CALIB in a frameset and return the instrument detected.
 
cpl_error_code xsh_dfs_extract_raw_frames (cpl_frameset *input, cpl_frameset *raws)
 split input sof in groups: raw and calib
 
cpl_error_code xsh_dfs_extract_calib_frames (cpl_frameset *input, cpl_frameset *calib)
 split input sof in groups: raw and calib
 
cpl_error_code xsh_dfs_extract_pro_frames (cpl_frameset *input, cpl_frameset *pros)
 split input sof in groups: raw and calib
 
void xsh_dfs_split_in_group (cpl_frameset *input, cpl_frameset *raws, cpl_frameset *calib)
 split input sof in groups: raw and calib
 
void xsh_dfs_split_qth_d2 (cpl_frameset *input, cpl_frameset **qth, cpl_frameset **d2)
 Extracts QTH and D2 frames from input frameset.
 
void xsh_dfs_split_nir (cpl_frameset *input, cpl_frameset **on, cpl_frameset **off)
 split input RAW NIR sof in ON and OFF
 
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
 
static const char * xsh_create_final_tag (const char *pcatg_prefix, xsh_instrument *inst, const cpl_frame *frame)
 creates tag value based on tag prefix or uses frame tag
 
static char * xsh_create_final_name (const char *final_prefix)
 creates file name based on tag prefix
 
static bool xsh_dfs_tag_check (const char *tag, const char *tag_list[], int size)
 check if the tag is in the tag list
 
void xsh_dfs_filter (cpl_frameset *set, const char *tags[], int size)
 filter the frameset with the given tag list
 
cpl_frameset * xsh_frameset_extract_pre (cpl_frameset *frameset, const char *prefix)
 Extracts pre frames from a frameset.
 
cpl_frame * xsh_find_bpmap (cpl_frameset *set)
 find the bad pixel map in a set of files
 
cpl_frame * xsh_find_master_bpmap (cpl_frameset *set)
 find the master bad pixel map in a set of files
 
cpl_frame * xsh_find_off (cpl_frameset *set)
 find the off frame in set of files
 
cpl_frame * xsh_find_on (cpl_frameset *set)
 find the on frame in set of files
 
void xsh_dfs_find_flat (cpl_frameset *raws, cpl_frameset *flat)
 find the flat set of files in the input SOF and detect the mode of instrument. This function assure that all flat files have the same tag
 
char * xsh_unique_filename (const char *context, const char *caller_id, const char *pro_catg)
 Get unique product filename.
 
void xsh_add_product (cpl_frame *frame, cpl_frameset *frameset, const cpl_parameterlist *parameters, const char *recipe_id, xsh_instrument *instrument, const char *final_prefix, const char *type)
 
void xsh_add_product_vector (cpl_frame *frame, cpl_frameset *frameset, const cpl_parameterlist *parameters, const char *recipe_id, xsh_instrument *instrument, const char *final_prefix)
 
static double xsh_calculate_exptime (const cpl_frameset *usedframes, XSH_ARM arm)
 Calculates a value for EXPTIME from the list of used frames.
 
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)
 
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)
 
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.
 
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.
 
void xsh_add_product_bpmap (cpl_frame *frame, cpl_frameset *frameset, const cpl_parameterlist *parameters, const char *recipe_id, xsh_instrument *instrument, const char *final_prefix)
 
void xsh_add_product_imagelist (cpl_frame *frame, cpl_frameset *frameset, const cpl_parameterlist *parameters, const char *recipe_id, xsh_instrument *instrument, const char *final_prefix)
 
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)
 
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)
 
cpl_frame * xsh_find_std_flux (cpl_frameset *frames)
 Find standard star frame.
 
cpl_frame * xsh_find_std_star_flux (cpl_frameset *frames)
 Find standard standard star flux frame.
 
cpl_frame * xsh_find_master_bias (cpl_frameset *frames, xsh_instrument *instr)
 Find master bias frame.
 
cpl_frame * xsh_find_frame_with_tag (cpl_frameset *frames, const char *tag, xsh_instrument *instr)
 Find frame with a given tag.
 
char * xsh_get_tag_from_arm (const char *tag, xsh_instrument *instr)
 Find arm specific tag from base and instrument setting.
 
cpl_frame * xsh_find_master_dark (cpl_frameset *frames, xsh_instrument *instr)
 Find master dark frame.
 
cpl_frame * xsh_find_master_flat (cpl_frameset *frames, xsh_instrument *instr)
 Find master flat frame.
 
cpl_frame * xsh_find_theo_tab_sing (cpl_frameset *frames, xsh_instrument *instr)
 Find a theoretical tab signle pinhole in SOF.
 
cpl_frame * xsh_find_theo_tab_mult (cpl_frameset *frames, xsh_instrument *instr)
 Find a theoretical tab multi pinhole in SOF.
 
cpl_frame * xsh_find_theo_tab_mode (cpl_frameset *frames, xsh_instrument *instr)
 Find a theoretical tab IFU or SINg depending of MODE in SOF.
 
cpl_frame * xsh_find_order_tab_recov (cpl_frameset *frames, xsh_instrument *instr)
 Find an order tab RECOV.
 
cpl_frame * xsh_find_order_tab_guess (cpl_frameset *frames, xsh_instrument *instr)
 Find an order tab GUESS.
 
cpl_frame * xsh_find_order_tab_centr (cpl_frameset *frames, xsh_instrument *instr)
 Find an order tab CENTR.
 
cpl_frame * xsh_find_order_tab_edges (cpl_frameset *frames, xsh_instrument *instr)
 Find an order tab EDGES.
 
cpl_frame * xsh_find_wave_tab_guess (cpl_frameset *frames, xsh_instrument *instr)
 Find a wave tab guess.
 
cpl_frame * xsh_find_wave_tab_2d (cpl_frameset *frames, xsh_instrument *instr)
 Find a wave tab 2D.
 
cpl_frame * xsh_find_slitmap (cpl_frameset *frames, xsh_instrument *instr)
 Find a slit map.
 
cpl_frame * xsh_find_wave_tab (cpl_frameset *frames, xsh_instrument *instr)
 Find a wave tab 2D or a wave tab ARC.
 
cpl_frame * xsh_find_model_config (cpl_frameset *frames, xsh_instrument *instr)
 Find a model config.
 
cpl_frameset * xsh_find_wave_tab_ifu (cpl_frameset *frames, xsh_instrument *instrument)
 Find wave tab ARC (for IFU 3 frames)
 
cpl_frameset * xsh_find_offset_tab_ifu (cpl_frameset *frames, xsh_instrument *instr)
 Find offset tab (One for each slitlet)
 
cpl_frame * xsh_find_arc_line_list_clean (cpl_frameset *frames, xsh_instrument *instr)
 Find an arc lines list clean frame.
 
cpl_frame * xsh_find_arc_line_list (cpl_frameset *frames, xsh_instrument *instr)
 Find an arc line list frame.
 
cpl_frame * xsh_find_usr_lines_guess_tab (cpl_frameset *frames, xsh_instrument *instr)
 Find a user guess line positions table frame.
 
cpl_frame * xsh_find_model_config_tab (cpl_frameset *frames, xsh_instrument *instr)
 Find a model configuration table frame.
 
cpl_frame * xsh_find_wavemap (cpl_frameset *frames, xsh_instrument *instr)
 Find Wave Map frame. The frame returned should not be free by the caller.
 
cpl_frame * xsh_find_raw_orderdef_vis_uvb (cpl_frameset *frames)
 Find orderdef raw frame for UVB or VIS.
 
cpl_frame * xsh_find_raw_orderdef_nir (cpl_frameset *frames)
 Find orderdef raw frame for NIR.
 
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.
 
cpl_frame * xsh_find_raw_orderdef_nir_off (cpl_frameset *frames)
 Find orderdef raw frame for NIR OFF.
 
cpl_frame * xsh_find_raw_arc_slit_uvb_vis (cpl_frameset *frames, XSH_ARM arm)
 Find raw frame for Slit UVB/VIS.
 
cpl_frame * xsh_find_raw_arc_slit_nir_on (cpl_frameset *frames)
 Find raw frame for Slit NIR ON.
 
cpl_frame * xsh_find_raw_arc_slit_nir_off (cpl_frameset *frames)
 Find raw frame for Slit NIR OFF.
 
cpl_frame * xsh_find_calpro_model_config (cpl_frameset *frames, xsh_instrument *instr)
 Find model config frame.
 
cpl_frame * xsh_find_model_config_open (cpl_frameset *frames, xsh_instrument *instr)
 Find model config frame.
 
cpl_frame * xsh_find_calpro_model_meas_coord (cpl_frameset *frames, xsh_instrument *instr)
 Find model config frame.
 
cpl_frame * xsh_find_model_wavelist (cpl_frameset *frames, xsh_instrument *instr)
 Find model wavelength list frame.
 
cpl_frame * xsh_find_model_testpar (cpl_frameset *frames, xsh_instrument *instr)
 Find model test parameter list.
 
cpl_frame * xsh_find_spectral_format (cpl_frameset *frames, xsh_instrument *instr)
 Find spectral format frame.
 
cpl_propertylist * xsh_frame_head_extract_qc (cpl_frame *frm)
 
cpl_boolean xsh_mode_is_physmod (cpl_frameset *set, xsh_instrument *instrument)
 
cpl_error_code xsh_dfs_check_binning (cpl_frameset *set, cpl_frameset *calib)
 
static cpl_frame * xsh_frame_pre_subsample (cpl_frame *frm_i, const int binx, const int biny, const int rescale, xsh_instrument *inst)
 
static cpl_frameset * xsh_correct_frameset_calib_bin (cpl_frameset *input, const int ref_binx, const int ref_biny, xsh_instrument *inst)
 
static cpl_frameset * xsh_correct_frameset_raws_bin (cpl_frameset *input, const int ref_binx, const int ref_biny, xsh_instrument *inst)
 
cpl_error_code xsh_frameset_uniform_bin (cpl_frameset **raws, cpl_frameset **calib, xsh_instrument *instrument)
 
cpl_frameset * xsh_correct_calib (cpl_frameset *raws, cpl_frameset *calib)
 
static cpl_error_code xsh_frame_nir_tab_chop_Kband (cpl_frame *frame, const int absordmin, const char *colname)
 
static cpl_error_code xsh_calib_nir_predict_corr_if_JH (cpl_frameset *calib, xsh_instrument *instr)
 
static cpl_error_code xsh_calib_nir_orderpos_corr_if_JH (cpl_frameset *calib, xsh_instrument *instr)
 
static cpl_error_code xsh_calib_nir_mflat_corr_if_JH (cpl_frameset *calib, xsh_instrument *instr)
 
static cpl_error_code xsh_calib_nir_2dmap_corr_if_JH (cpl_frameset *calib, xsh_instrument *instr)
 
static cpl_error_code xsh_calib_nir_wavecal_corr_if_JH (cpl_frameset *calib, xsh_instrument *instr)
 
static cpl_error_code xsh_calib_nir_scired_corr_if_JH (cpl_frameset *calib, xsh_instrument *instr)
 
cpl_error_code xsh_calib_nir_respon_corr_if_JH (cpl_frameset *calib, xsh_instrument *instr)
 
cpl_error_code xsh_calib_nir_corr_if_JH (cpl_frameset *calib, xsh_instrument *instr, const char *recid)
 
cpl_error_code xsh_dfs_check_mflat_is_proper (xsh_instrument *inst, cpl_frameset **calib)
 
cpl_error_code xsh_frameset_check_uniform_exptime (cpl_frameset *raws, xsh_instrument *inst)
 
cpl_error_code xsh_table_save (cpl_table *t, cpl_propertylist *ph, cpl_propertylist *xh, const char *fname, const int ext)
 
cpl_error_code xsh_vector_save (cpl_vector *v, cpl_propertylist *ph, const char *fname, const int ext)
 
cpl_error_code xsh_add_afc_info (cpl_frame *frm_m, cpl_frame *frm_o)
 
static cpl_boolean xsh_aperture_string_to_double (const char *string, double *aperture)
 Extracts the aperture from a slit string.
 
static const char * xsh_get_column_unit (cpl_propertylist *header, const char *colname)
 Tries to identify the units string to used based in BUNIT.
 
static int xsh_get_nraws (const cpl_frameset *frames)
 Calculates number of raw frames.
 
static double xsh_calculate_mjd_end (const cpl_frame *product_frame, const cpl_frameset *usedframes, XSH_ARM arm)
 Calculates a value for MJD-END from the list of used frames.
 
static double xsh_find_first_mjd_obs (const cpl_frameset *usedframes)
 Finds the earliest value for MJD_OBS in the set of inputs.
 
static void xsh_fill_provenance_keywords (irplib_sdp_spectrum *spectrum, const cpl_frameset *usedframes)
 Fills SDP spectrum object with PROVi keywords.
 
static cpl_error_code xsh_sdp_spectrum_create (irplib_sdp_spectrum *sdp_spectrum, const cpl_frameset *usedframes, const cpl_propertylist *sourcekeys, xsh_instrument *instrument, xsh_spectrum *spectrum, xsh_spectrum *uncal_spectrum)
 Converts data into Science Data Product 1D spectrum format.
 
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.
 
cpl_error_code xsh_dfs_fix_key_start_end (cpl_frameset *set, cpl_propertylist *head)
 
int xsh_parameter_get_default_flag (const cpl_parameter *p)
 Check if an input parameter has been changed by the user.
 
static cpl_error_code xsh_clean_header (cpl_propertylist *header)
 
cpl_error_code xsh_validate_model_cfg (cpl_frame *mod, cpl_frameset *set)
 Validate model cfg.
 
cpl_frameset * xsh_frameset_ext_table_frames (cpl_frameset *set)
 Extract frameset sub set containing only table frames.
 
int xsh_dfs_files_dont_exist (cpl_frameset *frameset)
 Check if all SOF files exist.
 
cpl_frameset * xsh_frameset_ext_image_frames (cpl_frameset *set)
 Extract frameset sub set containing only table frames.
 
cpl_frameset * xsh_frameset_drl_frames (cpl_frameset *set)
 extract DRL specific frames from frameset
 
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)
 
static double xsh_get_offsety (cpl_propertylist *plist)
 Computes offsety.
 
cpl_frameset * xsh_frameset_extract_offsety_matches (cpl_frameset *raws, const double offset)
 Extract frames that has same cumoffy as offset.
 
cpl_frameset * xsh_frameset_extract_offsety_mismatches (cpl_frameset *raws, const double offset)
 Extract frames that has different cumoffy than offset.
 
cpl_frameset * xsh_extract_nod_pairs (cpl_frameset *raws, cpl_vector *offset)
 Make sure input frames is composed by nod a-b sequence.
 
cpl_frameset * xsh_extract_obj_and_sky_pairs (cpl_frameset *raws, xsh_instrument *instrument)
 Make sure input frames is composed by obj-sky pairs.
 
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)
 
int xsh_print_rec_status (const int val)
 Check if an error has happened and returns error kind and location.
 
void xsh_frame_config (const char *fname, const char *tag, cpl_frame_type type, cpl_frame_group group, cpl_frame_level level, cpl_frame **frame)
 Define a frame characteristics.
 
cpl_frame * xsh_frame_product (const char *fname, const char *tag, cpl_frame_type type, cpl_frame_group group, cpl_frame_level level)
 Creates a frame with given characteristics.
 

Function Documentation

◆ replace_spaces_with_underscores()

static void replace_spaces_with_underscores ( char *  str)
static

Definition at line 74 of file xsh_dfs.c.

Referenced by xsh_sdp_spectrum_create().

◆ xsh_add_afc_info()

cpl_error_code xsh_add_afc_info ( cpl_frame *  frm_m,
cpl_frame *  frm_o 
)

◆ xsh_add_product()

void xsh_add_product ( cpl_frame *  frame,
cpl_frameset *  frameset,
const cpl_parameterlist *  parameters,
const char *  recipe_id,
xsh_instrument instrument,
const char *  final_prefix,
const char *  type 
)

Save product

Parameters
frameProduct Frame
framesetInput Frameset
parametersParameters list
recipe_idRecipe Identification String
instrumentInstrument structure
final_prefixFinal file name
typeof frame (image/imagelist/table)

Definition at line 1761 of file xsh_dfs.c.

References check, check_msg, xsh_instrument::dictionary, instrument, xsh_instrument::pipeline_id, xsh_add_product_file(), XSH_ASSURE_NOT_NULL, xsh_clean_header(), xsh_create_final_name(), xsh_frame_product(), XSH_FREE, xsh_free_image(), xsh_free_imagelist(), xsh_free_propertylist(), xsh_free_table(), xsh_msg_dbg_low, and xsh_msg_error.

◆ xsh_add_product_bpmap()

void xsh_add_product_bpmap ( cpl_frame *  frame,
cpl_frameset *  frameset,
const cpl_parameterlist *  parameters,
const char *  recipe_id,
xsh_instrument instrument,
const char *  final_prefix 
)

Save BadPixelMap product

Parameters
frameProduct Frame
framesetInput Frameset
parametersParameters list
recipe_idRecipe Identification String
instrumentInstrument structure
final_prefixFinal file name

Definition at line 2716 of file xsh_dfs.c.

References check, check_msg, xsh_instrument::dictionary, instrument, xsh_instrument::pipeline_id, xsh_add_product_file(), XSH_ASSURE_NOT_NULL, xsh_clean_header(), xsh_create_final_name(), xsh_create_final_tag(), xsh_frame_product(), xsh_free(), XSH_FREE, xsh_free_image(), xsh_free_propertylist(), and xsh_msg_dbg_low.

Referenced by xsh_linear(), and xsh_util_bpmap_nl_raw2pre().

◆ xsh_add_product_image()

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 
)

◆ xsh_add_product_imagelist()

void xsh_add_product_imagelist ( cpl_frame *  frame,
cpl_frameset *  frameset,
const cpl_parameterlist *  parameters,
const char *  recipe_id,
xsh_instrument instrument,
const char *  final_prefix 
)

Save Image product

Parameters
frameProduct Frame
framesetInput Frameset
parametersParameters list
recipe_idRecipe Identification String
instrumentInstrument structure
final_prefixFinal file name

Definition at line 2825 of file xsh_dfs.c.

References check, check_msg, xsh_instrument::dictionary, instrument, xsh_instrument::pipeline_id, xsh_add_product_file(), xsh_add_temporary_file(), XSH_ASSURE_NOT_NULL, xsh_clean_header(), xsh_create_final_name(), xsh_create_final_tag(), xsh_dfs_fix_key_start_end(), xsh_frame_product(), xsh_free(), XSH_FREE, xsh_free_imagelist(), xsh_free_propertylist(), xsh_msg, and xsh_pfits_set_pcatg().

Referenced by xsh_build_ifu_cube(), and xsh_util_ifu_build_cube().

◆ xsh_add_product_orders_spectrum()

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 
)

◆ xsh_add_product_pre()

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.

Parameters
frameThe product frame
framesetThe recipe frameset.
parametersThe recipe parameter list
recipe_idThe recipe name
instrThe instrument settings

Mandatory DFS keywords are added by calling cpl_dfs_setup_product_header()

The function performs the following steps

  • Load primary header, infer product type,
  • Load product,
  • Modify primary header by adding DFS keywords,
  • Save product using the new header,
  • Insert the new frame into the frameset.
Note
A new frame is created and inserted into the frameset. The provided product_frame must still be deallocated.

Definition at line 2465 of file xsh_dfs.c.

References assure, check, xsh_pre::data_header, xsh_instrument::dictionary, xsh_pre::errs_header, exptime, xsh_instrument::pipeline_id, xsh_pre::qual_header, xsh_add_product_file(), XSH_ANC_SPECTRUM, XSH_ASSURE_NOT_NULL, xsh_baryvel_correct_header(), xsh_calculate_exptime(), xsh_clean_header(), xsh_dfs_fix_key_start_end(), XSH_FREE, xsh_free_frame(), xsh_free_propertylist(), xsh_instrument_get_arm(), xsh_parameters_bary_corr_get(), xsh_pfits_set_extname(), xsh_plist_set_extra_keys(), xsh_pre_free(), xsh_pre_load(), xsh_pre_save(), XSH_PRODUCT_PREFIX, xsh_sdate_utc(), XSH_SDP_KEYWORD_PRODCATG, xsh_stringcat_any(), and xsh_time_stamp_get().

Referenced by xsh_absorp(), xsh_mflat(), xsh_respon_slit_nod(), xsh_scired_ifu_offset(), xsh_scired_ifu_stare(), xsh_scired_slit_nod(), and xsh_scired_slit_stare().

◆ xsh_add_product_pre_3d()

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.

Parameters
frameThe product frame
framesetThe recipe frameset.
parametersThe recipe parameter list
recipe_idThe recipe name
instrThe instrument settings

Definition at line 2627 of file xsh_dfs.c.

References assure, check, xsh_pre_3d::data_header, xsh_instrument::dictionary, xsh_instrument::pipeline_id, xsh_add_product_file(), XSH_ASSURE_NOT_NULL, xsh_clean_header(), XSH_FREE, xsh_free_frame(), xsh_pre_3d_free(), xsh_pre_3d_load(), xsh_pre_3d_save(), XSH_PRODUCT_PREFIX, xsh_sdate_utc(), xsh_stringcat_any(), and xsh_time_stamp_get().

Referenced by xsh_geom_ifu(), xsh_scired_ifu_offset(), and xsh_scired_ifu_stare().

◆ xsh_add_product_spectrum()

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 
)

◆ xsh_add_product_table()

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 
)

◆ xsh_add_product_vector()

void xsh_add_product_vector ( cpl_frame *  frame,
cpl_frameset *  frameset,
const cpl_parameterlist *  parameters,
const char *  recipe_id,
xsh_instrument instrument,
const char *  final_prefix 
)

Save vector product

Parameters
frameProduct Frame
framesetInput Frameset
parametersParameters list
recipe_idRecipe Identification String
instrInstrument structure

Definition at line 1895 of file xsh_dfs.c.

References check, check_msg, xsh_instrument::dictionary, instrument, xsh_instrument::pipeline_id, xsh_add_product_file(), XSH_ASSURE_NOT_NULL, xsh_clean_header(), xsh_create_final_name(), xsh_frame_product(), XSH_FREE, xsh_free_frame(), xsh_free_propertylist(), xsh_free_vector(), xsh_msg_dbg_low, and XSH_PRE_QUAL_BPP.

Referenced by xsh_absorp().

◆ xsh_add_sdp_product_spectrum()

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.

This function converts a 1D spectrum written to a fits files in the X-Shooter native format to the Science Data Product (SDP) format. The spectrum data is loaded from the flux_cal_frame and uncal_frame, converted to the SDP format and written to a new file with the same name as the original product, but with the "SDP_" prefix added. Either the flux calibrated frame or the uncalibrated frame must be provided or both. The caller should check the value of cpl_error_get_code() to see if an error occurred during the conversion.

Parameters
flux_cal_frameThe flux calibrated 1D spectrum frame that we convert to SDP format. Can be NULL if none is available, but only if the uncal_frame is not NULL.
uncal_frameThe uncalibrated 1D spectrum that we also use in the conversion. Can be NULL if none is available, but only if the flux_cal_frame is not NULL.
framesetThe list of all frames to which we add the newly generated frame.
usedframesA frame set containing a list of all frames used to product the spectrum in the flux_cal_frame.
parametersThe parameters passed to the recipe by esorex.
recipe_idThe ID string of the recipe.
instrumentThe X-Shooter instrument structure containing configuration information about the instrument.

Definition at line 6326 of file xsh_dfs.c.

References assure, check, xsh_instrument::dictionary, instrument, xsh_instrument::pipeline_id, xsh_add_product_file(), XSH_ARM_NIR, xsh_arm_tostring(), XSH_ARM_UVB, XSH_ARM_VIS, XSH_ASSURE_NOT_NULL, xsh_calculate_mjd_end(), XSH_DPR_TYPE, xsh_error_msg, xsh_fill_provenance_keywords(), XSH_INSTRUME, XSH_INSTRUME_VALUE, xsh_instrument_get_arm(), XSH_MJDEND, xsh_parameters_get_int(), XSH_QC_FLUX_SN, xsh_sdp_spectrum_create(), xsh_spectrum_free(), and xsh_spectrum_load().

Referenced by main(), xsh_scired_slit_nod(), xsh_scired_slit_offset(), and xsh_scired_slit_stare().

◆ xsh_aperture_string_to_double()

static cpl_boolean xsh_aperture_string_to_double ( const char *  string,
double *  aperture 
)
static

Extracts the aperture from a slit string.

Parameters
[in]stringThe string containing slit information in the format: "\<number\>x\<number\>[\<string\>]".
[out]aperturethe extracted aperture value will be written to the location pointed to by this parameter.
Returns
CPL_TRUE if the value was extracted correctly and CPL_FALSE otherwise.

Definition at line 5249 of file xsh_dfs.c.

References x.

Referenced by xsh_sdp_spectrum_create().

◆ xsh_calculate_exptime()

static double xsh_calculate_exptime ( const cpl_frameset *  usedframes,
XSH_ARM  arm 
)
static

Calculates a value for EXPTIME from the list of used frames.

The EXPTIME value is simply the sum of EXPTIME values from individual frames.

Parameters
usedframesThe list of used frames to check.
armThe instrument arm being used.
Returns
A value to use for EXPTIME or NAN it could not be computed. If an error occurred in addition then an error code will be set that can be checked with cpl_error_get_code.

Definition at line 1979 of file xsh_dfs.c.

References check, exptime, XSH_ARM_NIR, XSH_DET_DIT, XSH_DET_NDIT, XSH_DET_NDITSKIP, XSH_DPR_TYPE, XSH_EXPTIME, and xsh_msg_warning.

Referenced by xsh_add_product_image(), xsh_add_product_orders_spectrum(), xsh_add_product_pre(), xsh_add_product_spectrum(), and xsh_sdp_spectrum_create().

◆ xsh_calculate_mjd_end()

static double xsh_calculate_mjd_end ( const cpl_frame *  product_frame,
const cpl_frameset *  usedframes,
XSH_ARM  arm 
)
static

Calculates a value for MJD-END from the list of used frames.

The MJD_END value is the taken as the highest MJD-OBS value found in the product frame of list of used frames, plus the exposure time for the last frame.

Parameters
product_frameThe product frame to check.
usedframesThe list of used frames to check.
armThe instrument arm being used.
Returns
A value to use for MJD-END or NAN if an error occurred. If an error did occur then an error code will be set that can be checked with cpl_error_get_code.

Definition at line 5356 of file xsh_dfs.c.

References check, XSH_ARM_NIR, XSH_DET_DIT, XSH_DET_NDIT, XSH_DET_NDITSKIP, XSH_EXPTIME, XSH_MJDEND, XSH_MJDOBS, and xsh_msg_warning.

Referenced by xsh_add_sdp_product_spectrum().

◆ xsh_calib_nir_2dmap_corr_if_JH()

static cpl_error_code xsh_calib_nir_2dmap_corr_if_JH ( cpl_frameset *  calib,
xsh_instrument instr 
)
static

◆ xsh_calib_nir_corr_if_JH()

cpl_error_code xsh_calib_nir_corr_if_JH ( cpl_frameset *  calib,
xsh_instrument instr,
const char *  recid 
)

◆ xsh_calib_nir_mflat_corr_if_JH()

static cpl_error_code xsh_calib_nir_mflat_corr_if_JH ( cpl_frameset *  calib,
xsh_instrument instr 
)
static

◆ xsh_calib_nir_orderpos_corr_if_JH()

static cpl_error_code xsh_calib_nir_orderpos_corr_if_JH ( cpl_frameset *  calib,
xsh_instrument instr 
)
static

◆ xsh_calib_nir_predict_corr_if_JH()

static cpl_error_code xsh_calib_nir_predict_corr_if_JH ( cpl_frameset *  calib,
xsh_instrument instr 
)
static

Definition at line 4845 of file xsh_dfs.c.

References XSH_ASSURE_NOT_NULL_MSG.

Referenced by xsh_calib_nir_corr_if_JH().

◆ xsh_calib_nir_respon_corr_if_JH()

cpl_error_code xsh_calib_nir_respon_corr_if_JH ( cpl_frameset *  calib,
xsh_instrument instr 
)

◆ xsh_calib_nir_scired_corr_if_JH()

static cpl_error_code xsh_calib_nir_scired_corr_if_JH ( cpl_frameset *  calib,
xsh_instrument instr 
)
static

◆ xsh_calib_nir_wavecal_corr_if_JH()

static cpl_error_code xsh_calib_nir_wavecal_corr_if_JH ( cpl_frameset *  calib,
xsh_instrument instr 
)
static

◆ xsh_clean_header()

static cpl_error_code xsh_clean_header ( cpl_propertylist *  header)
static

◆ xsh_correct_calib()

cpl_frameset * xsh_correct_calib ( cpl_frameset *  raws,
cpl_frameset *  calib 
)

◆ xsh_correct_frameset_calib_bin()

static cpl_frameset * xsh_correct_frameset_calib_bin ( cpl_frameset *  input,
const int  ref_binx,
const int  ref_biny,
xsh_instrument inst 
)
static

◆ xsh_correct_frameset_raws_bin()

static cpl_frameset * xsh_correct_frameset_raws_bin ( cpl_frameset *  input,
const int  ref_binx,
const int  ref_biny,
xsh_instrument inst 
)
static

◆ xsh_create_final_name()

static char * xsh_create_final_name ( const char *  final_prefix)
static

◆ xsh_create_final_tag()

static const char * xsh_create_final_tag ( const char *  pcatg_prefix,
xsh_instrument inst,
const cpl_frame *  frame 
)
static

creates tag value based on tag prefix or uses frame tag

Parameters
pcatg_prefixtag prefix
frameproduct frame

Definition at line 1428 of file xsh_dfs.c.

References xsh_instrument_arm_tostring(), and xsh_stringcat_any().

Referenced by xsh_add_product_bpmap(), xsh_add_product_image(), xsh_add_product_imagelist(), xsh_add_product_orders_spectrum(), and xsh_add_product_table().

◆ xsh_dfs_check_binning()

cpl_error_code xsh_dfs_check_binning ( cpl_frameset *  set,
cpl_frameset *  calib 
)

◆ xsh_dfs_check_mflat_is_proper()

cpl_error_code xsh_dfs_check_mflat_is_proper ( xsh_instrument inst,
cpl_frameset **  calib 
)

◆ xsh_dfs_extract_calib_frames()

cpl_error_code xsh_dfs_extract_calib_frames ( cpl_frameset *  input,
cpl_frameset *  calib 
)

split input sof in groups: raw and calib

Parameters
inputthe input set of files
calibthe calib files of the input set of files
Returns
cpl error code

Definition at line 1144 of file xsh_dfs.c.

◆ xsh_dfs_extract_pro_frames()

cpl_error_code xsh_dfs_extract_pro_frames ( cpl_frameset *  input,
cpl_frameset *  pros 
)

split input sof in groups: raw and calib

Parameters
inputthe input set of files
prosthe product files of the input set of files
Returns
cpl error code

Definition at line 1173 of file xsh_dfs.c.

References XSH_ASSURE_NOT_NULL_MSG.

Referenced by xsh_lingain().

◆ xsh_dfs_extract_raw_frames()

cpl_error_code xsh_dfs_extract_raw_frames ( cpl_frameset *  input,
cpl_frameset *  raws 
)

split input sof in groups: raw and calib

Parameters
inputthe input set of files
rawsthe raws file of the input set of files
Returns
cpl error code

Definition at line 1117 of file xsh_dfs.c.

Referenced by xsh_dfs_fix_key_start_end(), and xsh_model_first_anneal_save().

◆ xsh_dfs_files_dont_exist()

int xsh_dfs_files_dont_exist ( cpl_frameset *  frameset)

Check if all SOF files exist.

Parameters
framesetThe input set-of-frames
Returns
1 if not all files exist, 0 if they all exist.

Definition at line 245 of file xsh_dfs.c.

Referenced by xsh_begin().

◆ xsh_dfs_filter()

void xsh_dfs_filter ( cpl_frameset *  set,
const char *  tags[],
int  size 
)

filter the frameset with the given tag list

Parameters
set[IN/OUT] The input set of frames
tagsthe filtered tag list
sizesize of list
Returns
void

Definition at line 1511 of file xsh_dfs.c.

References check, size, XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_NULL, and xsh_dfs_tag_check().

Referenced by xsh_begin().

◆ xsh_dfs_find_flat()

void xsh_dfs_find_flat ( cpl_frameset *  raws,
cpl_frameset *  flat 
)

find the flat set of files in the input SOF and detect the mode of instrument. This function assure that all flat files have the same tag

Parameters
rawsset of file where we want to do the search
flatframeset contains only flat

Definition at line 1693 of file xsh_dfs.c.

References assure.

◆ xsh_dfs_fix_key_start_end()

cpl_error_code xsh_dfs_fix_key_start_end ( cpl_frameset *  set,
cpl_propertylist *  head 
)

◆ xsh_dfs_set_groups()

xsh_instrument * xsh_dfs_set_groups ( cpl_frameset *  set)

Set the group as RAW or CALIB in a frameset and return the instrument detected.

Parameters
setthe input frameset
Returns
an instrument structure which contains arm, mode and lamp

Definition at line 1046 of file xsh_dfs.c.

References assure, check, check_msg, xsh_instrument::config, instrument, XSH_INSTRCONFIG::order_max, XSH_INSTRCONFIG::order_min, XSH_INSTRCONFIG::orders, XSH_ARM_UNDEFINED, xsh_instrument_arm_tostring(), xsh_instrument_free(), xsh_instrument_get_arm(), xsh_instrument_get_config(), xsh_instrument_mode_tostring(), xsh_instrument_new(), xsh_instrument_parse_tag(), XSH_IS_CALIB, XSH_IS_RAW, xsh_msg, and xsh_msg_error.

Referenced by main(), xsh_begin(), xsh_util_bpmap_coadd(), and xsh_util_ima_arith().

◆ xsh_dfs_split_in_group()

void xsh_dfs_split_in_group ( cpl_frameset *  input,
cpl_frameset *  raws,
cpl_frameset *  calib 
)

split input sof in groups: raw and calib

Parameters
inputthe input set of files
rawsthe raws file of the input set of files
calibthe calib files of the input set of files

Definition at line 1202 of file xsh_dfs.c.

References xsh_msg_error.

Referenced by main(), and xsh_begin().

◆ xsh_dfs_split_nir()

void xsh_dfs_split_nir ( cpl_frameset *  input,
cpl_frameset **  on,
cpl_frameset **  off 
)

split input RAW NIR sof in ON and OFF

Parameters
[in]inputthe input RAW NIR set of files
[out]onthe on files of the input set of files
[out]offthe off files of the input set of files

Definition at line 1297 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_NULL, xsh_free_frame(), xsh_free_frameset(), xsh_msg_error, and XSH_NEW_FRAMESET.

Referenced by xsh_2dmap(), xsh_geom_ifu(), xsh_mflat(), xsh_predict(), and xsh_wavecal().

◆ xsh_dfs_split_offset()

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

Parameters
[in]inputinput frameset
[in]object_tagThe OBJECT Tag
[in]sky_tagThe SKY Tag
[out]objectthe object files of the input set of files
[out]skythe sky files of the input set of files
Returns
Number of OBJECT frames (equal nb of SKY frames)

Definition at line 1357 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_NULL, xsh_free_frame(), xsh_msg_dbg_medium, xsh_msg_error, and xsh_print_rec_status().

Referenced by xsh_respon_slit_offset(), xsh_scired_ifu_offset(), and xsh_scired_slit_offset().

◆ xsh_dfs_split_qth_d2()

void xsh_dfs_split_qth_d2 ( cpl_frameset *  input,
cpl_frameset **  qth,
cpl_frameset **  d2 
)

Extracts QTH and D2 frames from input frameset.

Parameters
inputthe input set of files
qthframeset with QTH frames
d2frameset with D2 frames
Returns
void

Definition at line 1241 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_NULL, xsh_free_frame(), xsh_free_frameset(), xsh_msg_error, and XSH_NEW_FRAMESET.

Referenced by xsh_mflat().

◆ xsh_dfs_tag_check()

static bool xsh_dfs_tag_check ( const char *  tag,
const char *  tag_list[],
int  size 
)
static

check if the tag is in the tag list

Parameters
tagthe tag to check
tag_listthe list of tags
sizesize of list
Returns
TRUE if the tag is find else false

Definition at line 1486 of file xsh_dfs.c.

References size.

Referenced by xsh_dfs_filter().

◆ xsh_ensure_raws_input_offset_recipe_is_proper()

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)

Parameters
rawsinput value
instrumentarm setting
Returns
cpl_error_code

Definition at line 352 of file xsh_dfs.c.

References assure, check, instrument, xsh_frameset_extract(), xsh_frameset_merge(), xsh_free_frameset(), XSH_GET_TAG_FROM_ARM, xsh_instrument_get_mode(), XSH_MODE_IFU, xsh_msg, XSH_OBJECT_IFU_OFFSET, XSH_OBJECT_SLIT_OFFSET, XSH_SKY_IFU, XSH_SKY_SLIT, XSH_STD_FLUX_IFU_OFFSET, and XSH_STD_FLUX_SLIT_OFFSET.

Referenced by xsh_respon_slit_offset(), xsh_scired_ifu_offset(), and xsh_scired_slit_offset().

◆ xsh_ensure_raws_number_is_even()

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)

Parameters
rawsinput value
Returns
cpl_error_code

Definition at line 792 of file xsh_dfs.c.

References check, xsh_free_propertylist(), xsh_get_offsety(), and xsh_msg_warning.

Referenced by xsh_respon_slit_nod(), and xsh_scired_slit_nod().

◆ xsh_extract_nod_pairs()

cpl_frameset * xsh_extract_nod_pairs ( cpl_frameset *  raws,
cpl_vector *  offset 
)

Make sure input frames is composed by nod a-b sequence.

Parameters
rawsinput value
offsetvector with different offset values
Returns
frameset with a-b sequence frames

Definition at line 584 of file xsh_dfs.c.

References assure, check, XSH_ASSURE_NOT_NULL_MSG, xsh_frameset_extract_offsety_matches(), xsh_frameset_extract_offsety_mismatches(), xsh_free_frameset(), xsh_free_propertylist(), xsh_msg, and xsh_pfits_get_mjdobs().

◆ xsh_extract_obj_and_sky_pairs()

cpl_frameset * xsh_extract_obj_and_sky_pairs ( cpl_frameset *  raws,
xsh_instrument instrument 
)

Make sure input frames is composed by obj-sky pairs.

Parameters
rawsinput value
instrumentarm
Returns
cpl_error_code

Definition at line 699 of file xsh_dfs.c.

References assure, check, instrument, xsh_frameset_extract(), xsh_free_frameset(), xsh_free_propertylist(), XSH_GET_TAG_FROM_ARM, xsh_instrument_get_mode(), XSH_MODE_IFU, xsh_msg, XSH_OBJECT_IFU_OFFSET, XSH_OBJECT_SLIT_OFFSET, xsh_pfits_get_mjdobs(), XSH_SKY_IFU, and XSH_SKY_SLIT.

◆ xsh_file_exists()

int xsh_file_exists ( const char *  filename)

Definition at line 959 of file xsh_dfs.c.

Referenced by xsh_frameset_extract_pre().

◆ xsh_fill_provenance_keywords()

static void xsh_fill_provenance_keywords ( irplib_sdp_spectrum *  spectrum,
const cpl_frameset *  usedframes 
)
static

Fills SDP spectrum object with PROVi keywords.

Fills the spectrum with PROVi keywords corresponding to the raw science data files used for a final SDP product. The PROVi keyword is filled with the content of ARCFILE if this keyword is found in the raw file primary header. Otherwise ORIGFILE is used if ARCFILE is missing. If none of these keywords is found then just the disk file name is used.

Parameters
[out]spectrumThe SDP spectrum object to fill with the new keywords.
[in]usedframesThe list of used frames to add as PROV keywords.

If an error occurs then an appropriate error code is set. The caller can check for this with a call to cpl_error_get_code().

Definition at line 5490 of file xsh_dfs.c.

References check, XSH_ARCFILE, XSH_DPR_TYPE, xsh_msg_warning, and XSH_ORIGFILE.

Referenced by xsh_add_sdp_product_spectrum().

◆ xsh_find_arc_line_list()

cpl_frame * xsh_find_arc_line_list ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find an arc line list frame.

Parameters
framesThe input frameset where we do the search
instrThe instrument
Returns
Pointer to the search frame or exception if don't find

Definition at line 3908 of file xsh_dfs.c.

References check, XSH_ARC_LINE_LIST, XSH_ASSURE_NOT_NULL, xsh_find_frame(), and XSH_GET_TAG_FROM_ARM.

Referenced by main(), and xsh_predict().

◆ xsh_find_arc_line_list_clean()

cpl_frame * xsh_find_arc_line_list_clean ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find an arc lines list clean frame.

Parameters
framesThe input frameset where we do the search
instrThe instrument
Returns
Pointer to the search frame or exception if don't find

Definition at line 3882 of file xsh_dfs.c.

References check, XSH_ARC_LINE_LIST, XSH_ASSURE_NOT_NULL, xsh_find_frame(), and XSH_GET_TAG_FROM_ARM.

◆ xsh_find_bpmap()

cpl_frame * xsh_find_bpmap ( cpl_frameset *  set)

find the bad pixel map in a set of files

Parameters
setthe set of files
Returns
the bad pixel map or NULL if not found

Definition at line 1595 of file xsh_dfs.c.

Referenced by xsh_linear().

◆ xsh_find_calpro_model_config()

cpl_frame * xsh_find_calpro_model_config ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find model config frame.

Parameters
framesThe input frameset
instrthe instrument arm setting
Returns
Pointer to raw frame

Definition at line 4186 of file xsh_dfs.c.

References check, xsh_find_frame(), xsh_instrument_arm_tostring(), XSH_MOD_CFG, xsh_msg_debug, and xsh_stringcat_any().

Referenced by xsh_model_anneal().

◆ xsh_find_calpro_model_meas_coord()

cpl_frame * xsh_find_calpro_model_meas_coord ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find model config frame.

Parameters
framesThe input frameset
instrthe instrument arm setting
Returns
Pointer to raw frame

Definition at line 4240 of file xsh_dfs.c.

References check, xsh_find_frame(), xsh_instrument_arm_tostring(), XSH_MEASCOORD, and xsh_stringcat_any().

Referenced by xsh_model_anneal().

◆ xsh_find_disp_tab()

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.

Parameters
framesThe input frameset
instrThe instrument
Returns
Pointer to wavemap frame

Definition at line 4066 of file xsh_dfs.c.

References check, XSH_DISP_TAB, XSH_DISP_TAB_AFC, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, and xsh_msg.

Referenced by xsh_absorp(), xsh_calib_nir_scired_corr_if_JH(), xsh_calib_nir_wavecal_corr_if_JH(), xsh_get_response_calibs(), xsh_respon_slit_offset(), xsh_respon_slit_stare(), xsh_scired_ifu_offset(), xsh_scired_ifu_stare(), xsh_scired_slit_nod_get_calibs(), xsh_scired_slit_offset(), xsh_scired_slit_stare(), and xsh_wavecal().

◆ xsh_find_first_mjd_obs()

static double xsh_find_first_mjd_obs ( const cpl_frameset *  usedframes)
static

Finds the earliest value for MJD_OBS in the set of inputs.

The earliest value found for MJD_OBS in the list of input frames is returned.

Parameters
usedframesThe list of used frames to check.
Returns
the earliest MJD_OBS or NAN if an error occurred. If an error did occur then an error code will be set that can be checked with cpl_error_get_code.

Definition at line 5434 of file xsh_dfs.c.

References check, and XSH_MJDOBS.

Referenced by xsh_sdp_spectrum_create().

◆ xsh_find_frame()

static cpl_frame * xsh_find_frame ( cpl_frameset *  frames,
const char *  tags[] 
)
static

◆ xsh_find_frame_with_tag()

cpl_frame * xsh_find_frame_with_tag ( cpl_frameset *  frames,
const char *  tag,
xsh_instrument instr 
)

◆ xsh_find_master_bias()

cpl_frame * xsh_find_master_bias ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find master bias frame.

Parameters
framesThe input frameset
instrthe settings of instrument
Returns
Pointer to first standard star frame, or NULL on error.

The function sets an error if no standard star frame is present.

Definition at line 3319 of file xsh_dfs.c.

References check, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, and XSH_MASTER_BIAS.

Referenced by main(), xsh_geom_ifu(), xsh_get_normal_calibs(), xsh_ifu_stare_get_calibs(), and xsh_slit_stare_get_calibs().

◆ xsh_find_master_bpmap()

cpl_frame * xsh_find_master_bpmap ( cpl_frameset *  set)

find the master bad pixel map in a set of files

Parameters
setthe set of files
Returns
the bad pixel map or NULL if not found

Definition at line 1621 of file xsh_dfs.c.

References XSH_MASTER_BP_MAP.

Referenced by xsh_cfg_recover_last_step(), xsh_geom_ifu(), xsh_scired_ifu_offset(), and xsh_scired_ifu_stare().

◆ xsh_find_master_dark()

cpl_frame * xsh_find_master_dark ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find master dark frame.

Parameters
framesThe input frameset
instrthe settings of instrument
Returns
Pointer to first standard star frame, or NULL on error.

The function sets an error if no standard star frame is present.

Definition at line 3404 of file xsh_dfs.c.

References xsh_find_frame(), XSH_GET_TAG_FROM_ARM, and XSH_MASTER_DARK.

Referenced by main(), xsh_geom_ifu(), xsh_ifu_stare_get_calibs(), xsh_slit_stare_get_calibs(), xsh_slit_stare_get_calibs2(), and xsh_wavecal().

◆ xsh_find_master_flat()

cpl_frame * xsh_find_master_flat ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find master flat frame.

Parameters
framesThe input frameset
instrthe settings of instrument
Returns
Pointer to first standard star frame, or NULL on error.

The function sets an error if no master flat frame is present.

Definition at line 3426 of file xsh_dfs.c.

References xsh_find_frame(), XSH_GET_TAG_FROM_MODE, and XSH_MASTER_FLAT.

Referenced by main(), xsh_geom_ifu(), xsh_get_normal_calibs(), xsh_ifu_stare_get_calibs(), xsh_scired_ifu_offset(), xsh_scired_ifu_stare(), and xsh_slit_stare_get_calibs().

◆ xsh_find_model_config()

cpl_frame * xsh_find_model_config ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a model config.

Parameters
framesThe input frameset where we do the search
instrThe instrument
Returns
Pointer to the search frame or exception if don't find

Definition at line 3728 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_NULL, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, XSH_MOD_CFG_OPT_2D, XSH_MOD_CFG_OPT_AFC, and XSH_MOD_CFG_TAB.

Referenced by xsh_util_ifu_build_cube().

◆ xsh_find_model_config_open()

cpl_frame * xsh_find_model_config_open ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find model config frame.

Parameters
framesThe input frameset
instrthe instrument arm setting
Returns
Pointer to raw frame

Definition at line 4213 of file xsh_dfs.c.

References check, xsh_find_frame(), xsh_instrument_arm_tostring(), XSH_MOD_CFG_OPEN, xsh_msg_debug, and xsh_stringcat_any().

◆ xsh_find_model_config_tab()

cpl_frame * xsh_find_model_config_tab ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a model configuration table frame.

Parameters
framesThe input frameset where we do the search
instrThe instrument
Returns
Pointer to the search frame or exception if don't find

Definition at line 3957 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_NULL, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, and XSH_MOD_CFG_TAB.

Referenced by main().

◆ xsh_find_model_testpar()

cpl_frame * xsh_find_model_testpar ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find model test parameter list.

Parameters
framesThe input frameset
instrthe instrument arm setting
Returns
Pointer to raw frame

Definition at line 4292 of file xsh_dfs.c.

References check, xsh_find_frame(), xsh_instrument_arm_tostring(), XSH_MODEL_TEST_PAR, and xsh_stringcat_any().

Referenced by xsh_model().

◆ xsh_find_model_wavelist()

cpl_frame * xsh_find_model_wavelist ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find model wavelength list frame.

Parameters
framesThe input frameset
instrthe instrument arm setting
Returns
Pointer to raw frame

Definition at line 4265 of file xsh_dfs.c.

References check, xsh_find_frame(), xsh_instrument_arm_tostring(), XSH_MODEL_WAVE_LIST, and xsh_stringcat_any().

Referenced by xsh_model().

◆ xsh_find_off()

cpl_frame * xsh_find_off ( cpl_frameset *  set)

find the off frame in set of files

Parameters
setthe set of files
Returns
the off frame or NULL if not found

Definition at line 1645 of file xsh_dfs.c.

◆ xsh_find_offset_tab_ifu()

cpl_frameset * xsh_find_offset_tab_ifu ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find offset tab (One for each slitlet)

Parameters
framesThe input frameset where we do the search
instrumentThe instrument
Returns
Pointer to the frame set containing the 3 offset tab frames or exception if not found

Definition at line 3832 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_NULL, xsh_find_frame(), xsh_free_frameset(), XSH_GET_TAG_FROM_ARM, xsh_msg_warning, XSH_OFFSET_CEN_IFU, XSH_OFFSET_DOWN_IFU, and XSH_OFFSET_UP_IFU.

Referenced by main(), xsh_scired_ifu_offset(), and xsh_scired_ifu_stare().

◆ xsh_find_on()

cpl_frame * xsh_find_on ( cpl_frameset *  set)

find the on frame in set of files

Parameters
setthe set of files
Returns
the on frame or NULL if not found

Definition at line 1669 of file xsh_dfs.c.

◆ xsh_find_order_tab_centr()

cpl_frame * xsh_find_order_tab_centr ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find an order tab CENTR.

Parameters
framesThe input frameset where we do the search
instrThe instrument
Returns
Pointer to the search frame or exception if don't find

Definition at line 3570 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_NULL, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, and XSH_ORDER_TAB_CENTR.

Referenced by main(), xsh_calib_nir_mflat_corr_if_JH(), and xsh_mflat().

◆ xsh_find_order_tab_edges()

cpl_frame * xsh_find_order_tab_edges ( cpl_frameset *  frames,
xsh_instrument instr 
)

◆ xsh_find_order_tab_guess()

cpl_frame * xsh_find_order_tab_guess ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find an order tab GUESS.

Parameters
framesThe input frameset where we do the search
instrThe instrument
Returns
Pointer to the search frame or exception if don't find

Definition at line 3545 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_NULL, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, and XSH_ORDER_TAB_GUESS.

◆ xsh_find_order_tab_recov()

cpl_frame * xsh_find_order_tab_recov ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find an order tab RECOV.

Parameters
framesThe input frameset where we do the search
instrThe instrument
Returns
Pointer to the search frame or exception if don't find

Definition at line 3520 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_NULL, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, and XSH_ORDER_TAB_RECOV.

◆ xsh_find_raw_arc_slit_nir_off()

cpl_frame * xsh_find_raw_arc_slit_nir_off ( cpl_frameset *  frames)

Find raw frame for Slit NIR OFF.

Parameters
framesThe input frameset
Returns
Pointer to raw frame

Definition at line 4164 of file xsh_dfs.c.

References check, XSH_ARC_SLIT_OFF, xsh_find_frame(), and xsh_stringcat_any().

◆ xsh_find_raw_arc_slit_nir_on()

cpl_frame * xsh_find_raw_arc_slit_nir_on ( cpl_frameset *  frames)

Find raw frame for Slit NIR ON.

Parameters
framesThe input frameset
Returns
Pointer to raw frame

Definition at line 4144 of file xsh_dfs.c.

References check, XSH_ARC_SLIT_NIR, xsh_find_frame(), and xsh_stringcat_any().

◆ xsh_find_raw_arc_slit_uvb_vis()

cpl_frame * xsh_find_raw_arc_slit_uvb_vis ( cpl_frameset *  frames,
XSH_ARM  arm 
)

Find raw frame for Slit UVB/VIS.

Parameters
framesThe input frameset
armThe ARM (UVB or VIS)
Returns
Pointer to raw frame

Definition at line 4118 of file xsh_dfs.c.

References check, XSH_ARC_SLIT_UVB, XSH_ARC_SLIT_VIS, XSH_ARM_UVB, XSH_ARM_VIS, xsh_find_frame(), and xsh_stringcat_any().

◆ xsh_find_raw_orderdef_nir()

cpl_frame * xsh_find_raw_orderdef_nir ( cpl_frameset *  frames)

Find orderdef raw frame for NIR.

Parameters
framesThe input frameset
Returns
Pointer to order table frame

Definition at line 4043 of file xsh_dfs.c.

References check, xsh_find_frame(), XSH_ORDERDEF_NIR, and xsh_stringcat_any().

Referenced by xsh_orderpos().

◆ xsh_find_raw_orderdef_nir_off()

cpl_frame * xsh_find_raw_orderdef_nir_off ( cpl_frameset *  frames)

Find orderdef raw frame for NIR OFF.

Parameters
framesThe input frameset
Returns
Pointer to order table frame

Definition at line 4098 of file xsh_dfs.c.

References check, xsh_find_frame(), XSH_ORDERDEF_OFF, and xsh_stringcat_any().

Referenced by xsh_orderpos().

◆ xsh_find_raw_orderdef_vis_uvb()

cpl_frame * xsh_find_raw_orderdef_vis_uvb ( cpl_frameset *  frames)

Find orderdef raw frame for UVB or VIS.

Parameters
framesThe input frameset
Returns
Pointer to order table frame

Definition at line 4005 of file xsh_dfs.c.

References check, xsh_find_frame(), xsh_msg, XSH_ORDERDEF_D2_UVB, XSH_ORDERDEF_QTH_UVB, XSH_ORDERDEF_VIS, and xsh_stringcat_any().

Referenced by xsh_orderpos().

◆ xsh_find_slitmap()

cpl_frame * xsh_find_slitmap ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a slit map.

Parameters
framesThe input frameset where we do the search
instrThe instrument
Returns
Pointer to the search frame or exception if don't find

Definition at line 3673 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_NULL, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, XSH_IFU_MAP, and XSH_SLIT_MAP.

Referenced by main(), xsh_check_get_map(), xsh_geom_ifu(), xsh_respon_slit_offset(), xsh_scired_ifu_stare(), xsh_slit_offset_get_calibs(), xsh_slit_stare_get_maps(), and xsh_wavecal().

◆ xsh_find_spectral_format()

cpl_frame * xsh_find_spectral_format ( cpl_frameset *  frames,
xsh_instrument instr 
)

◆ xsh_find_std_flux()

cpl_frame * xsh_find_std_flux ( cpl_frameset *  frames)

Find standard star frame.

Parameters
framesThe input frameset
Returns
Pointer to first standard star frame, or NULL on error.

The function sets an error if no standard star frame is present.

Definition at line 3262 of file xsh_dfs.c.

References XSH_ARM_NIR, XSH_ARM_UVB, XSH_ARM_VIS, xsh_find_frame(), XSH_STD_FLUX_OFFSET, XSH_STD_FLUX_SLIT, XSH_STD_TELL_OFFSET, and XSH_STD_TELL_SLIT.

Referenced by xsh_respon_slit_stare().

◆ xsh_find_std_star_flux()

cpl_frame * xsh_find_std_star_flux ( cpl_frameset *  frames)

Find standard standard star flux frame.

Parameters
framesThe input frameset
Returns
Pointer to first standard star frame, or NULL on error.

The function sets an error if no standard star frame is present.

Definition at line 3294 of file xsh_dfs.c.

References XSH_ARM_NIR, XSH_ARM_UVB, XSH_ARM_VIS, xsh_find_frame(), and XSH_STD_STAR_FLUX.

◆ xsh_find_theo_tab_mode()

cpl_frame * xsh_find_theo_tab_mode ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a theoretical tab IFU or SINg depending of MODE in SOF.

Parameters
framesThe input frameset where we do the search
instrThe instrument
Returns
Pointer to the search frame or exception if don't find

Definition at line 3490 of file xsh_dfs.c.

References check, xsh_instrument::mode, XSH_ASSURE_NOT_NULL, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, XSH_MODE_IFU, XSH_THEO_TAB_IFU, and XSH_THEO_TAB_SING.

◆ xsh_find_theo_tab_mult()

cpl_frame * xsh_find_theo_tab_mult ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a theoretical tab multi pinhole in SOF.

Parameters
framesThe input frameset where we do the search
instrThe instrument
Returns
Pointer to the search frame or exception if don't find

Definition at line 3468 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_NULL, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, and XSH_THEO_TAB_MULT.

◆ xsh_find_theo_tab_sing()

cpl_frame * xsh_find_theo_tab_sing ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a theoretical tab signle pinhole in SOF.

Parameters
framesThe input frameset where we do the search
instrThe instrument
Returns
Pointer to the search frame or exception if don't find

Definition at line 3445 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_NULL, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, and XSH_THEO_TAB_SING.

◆ xsh_find_usr_lines_guess_tab()

cpl_frame * xsh_find_usr_lines_guess_tab ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a user guess line positions table frame.

Parameters
framesThe input frameset where we do the search
instrThe instrument
Returns
Pointer to the search frame or exception if don't find

Definition at line 3932 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_NULL, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, and XSH_GUESS_LINES_POS.

◆ xsh_find_wave_tab()

cpl_frame * xsh_find_wave_tab ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a wave tab 2D or a wave tab ARC.

Parameters
framesThe input frameset where we do the search
instrThe instrument
Returns
Pointer to the search frame or exception if don't find

Definition at line 3699 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_NULL, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, XSH_GET_TAG_FROM_MODE, XSH_WAVE_TAB_2D, XSH_WAVE_TAB_AFC, and XSH_WAVE_TAB_ARC.

Referenced by xsh_calib_nir_scired_corr_if_JH(), xsh_flexcomp(), xsh_get_dispersion_calibs(), xsh_scired_ifu_stare(), xsh_scired_slit_nod_get_calibs(), and xsh_slit_stare_get_calibs().

◆ xsh_find_wave_tab_2d()

cpl_frame * xsh_find_wave_tab_2d ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a wave tab 2D.

Parameters
framesThe input frameset where we do the search
instrThe instrument
Returns
Pointer to the search frame or exception if don't find

Definition at line 3650 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_NULL, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, and XSH_WAVE_TAB_2D.

Referenced by main(), and xsh_wavecal().

◆ xsh_find_wave_tab_guess()

cpl_frame * xsh_find_wave_tab_guess ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a wave tab guess.

Parameters
framesThe input frameset where we do the search
instrThe instrument
Returns
Pointer to the search frame or exception if don't find

Definition at line 3625 of file xsh_dfs.c.

References check, XSH_ASSURE_NOT_NULL, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, and XSH_WAVE_TAB_GUESS.

◆ xsh_find_wave_tab_ifu()

cpl_frameset * xsh_find_wave_tab_ifu ( cpl_frameset *  frames,
xsh_instrument instrument 
)

Find wave tab ARC (for IFU 3 frames)

Parameters
framesThe input frameset where we do the search
instrumentThe instrument
Returns
Pointer to the frame set containing the 3 wave tab arc frames or exception if not founf

Definition at line 3756 of file xsh_dfs.c.

References check, instrument, XSH_ASSURE_NOT_NULL, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, xsh_msg, xsh_msg_warning, XSH_WAVE_TAB_2D, XSH_WAVE_TAB_AFC, XSH_WAVE_TAB_ARC_CEN_IFU, XSH_WAVE_TAB_ARC_DOWN_IFU, and XSH_WAVE_TAB_ARC_UP_IFU.

Referenced by xsh_geom_ifu(), and xsh_scired_ifu_offset().

◆ xsh_find_wavemap()

cpl_frame * xsh_find_wavemap ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find Wave Map frame. The frame returned should not be free by the caller.

Parameters
framesThe input frameset
instrthe instrument
Returns
Pointer to wavemap frame

Definition at line 3983 of file xsh_dfs.c.

References check, xsh_find_frame(), XSH_GET_TAG_FROM_ARM, and XSH_WAVE_MAP.

Referenced by xsh_check_get_map(), xsh_geom_ifu(), xsh_get_dispersion_calibs(), xsh_respon_slit_offset(), xsh_scired_ifu_stare(), xsh_scired_slit_nod_get_calibs(), xsh_slit_offset_get_calibs(), xsh_slit_stare_get_maps(), and xsh_wavecal().

◆ xsh_frame_config()

void xsh_frame_config ( const char *  fname,
const char *  tag,
cpl_frame_type  type,
cpl_frame_group  group,
cpl_frame_level  level,
cpl_frame **  frame 
)

Define a frame characteristics.

Parameters
fnameframe filename
tagframe tag
typeframe type
groupframe group
levelframe level
frameoutput frame
Returns
0 if no error is detected,-1 else

Definition at line 900 of file xsh_dfs.c.

References check.

Referenced by xsh_cfg_recover_model_THE_create(), xsh_frame_product(), xsh_util_physmod_model_THE_create(), and xsh_wavelist_subtract_sky().

◆ xsh_frame_head_extract_qc()

cpl_propertylist * xsh_frame_head_extract_qc ( cpl_frame *  frm)

Definition at line 4401 of file xsh_dfs.c.

Referenced by xsh_mdark().

◆ xsh_frame_nir_tab_chop_Kband()

static cpl_error_code xsh_frame_nir_tab_chop_Kband ( cpl_frame *  frame,
const int  absordmin,
const char *  colname 
)
static

◆ xsh_frame_pre_subsample()

static cpl_frame * xsh_frame_pre_subsample ( cpl_frame *  frm_i,
const int  binx,
const int  biny,
const int  rescale,
xsh_instrument inst 
)
static

◆ xsh_frame_product()

cpl_frame * xsh_frame_product ( const char *  fname,
const char *  tag,
cpl_frame_type  type,
cpl_frame_group  group,
cpl_frame_level  level 
)

Creates a frame with given characteristics.

Parameters
fnameframe filename
tagframe tag
typeframe type
groupframe group
levelframe level
Returns
0 if no error is detected,-1 else

Definition at line 930 of file xsh_dfs.c.

References check, xsh_frame_config(), and xsh_free_frame().

Referenced by main(), xsh_add_product(), xsh_add_product_bpmap(), xsh_add_product_image(), xsh_add_product_imagelist(), xsh_add_product_table(), xsh_add_product_vector(), xsh_arclist_save(), xsh_build_ifu_cube(), xsh_build_ifu_map(), xsh_catalog_extract_spectrum_frame(), xsh_cfg_recover_gen_xyg_frame(), xsh_compute_linearity(), xsh_compute_noise_map(), xsh_compute_response(), xsh_compute_response2(), xsh_compute_response_ord(), xsh_compute_shift_ifu_slitlet(), xsh_crea_correct_coeff(), xsh_create_master_dark_bpmap(), xsh_cube_qc_trace_window(), xsh_dispersol_list_save(), xsh_dispersol_list_to_slitmap(), xsh_dispersol_list_to_wavemap(), xsh_efficiency_compute(), xsh_flat_merge_qth_d2(), xsh_flat_merge_qth_d2_smooth(), xsh_frame_image_ext_qc_trace_window(), xsh_frame_image_qc_trace_window(), xsh_frameset_average(), xsh_frameset_average_pre(), xsh_get_crh_frame(), xsh_image_get_hot_cold_pixs(), xsh_image_local_cold_pixs(), xsh_image_local_hot_pixs(), xsh_linetilt_list_save(), xsh_localization_save(), xsh_localize_ifu_slitlet(), xsh_model_first_anneal(), xsh_model_first_anneal_save(), xsh_model_maps_create(), xsh_model_pipe_anneal(), xsh_model_spectralformat_create(), xsh_model_THE_create(), xsh_normalize_spectrum(), xsh_normalize_spectrum_ord(), xsh_order_list_save(), xsh_rec_list1D_save_as_tab(), xsh_rec_list_save(), xsh_rec_list_save2(), xsh_rec_list_save_table(), xsh_resid_order_save(), xsh_resid_tab_save(), xsh_shift_offsettab(), xsh_shift_tab_save(), xsh_slice_offset_save(), xsh_spectrum1D_save(), xsh_spectrum_interpolate(), xsh_spectrum_interpolate_linear(), xsh_spectrum_resample(), xsh_star_flux_list_save(), xsh_star_flux_list_save_order(), xsh_subtract_background(), xsh_the_map_save(), xsh_util_afc(), xsh_util_bpmap_coadd(), xsh_util_crh_single(), xsh_util_frameset_collapse_mean(), xsh_util_ifu_build_cube(), xsh_util_model_SPF_create(), xsh_util_multiply_by_response(), xsh_util_multiply_by_response_ord(), xsh_utils_efficiency(), xsh_wavemap_list_save(), xsh_wavemap_list_save2(), and xsh_wavesol_save().

◆ xsh_frameset_check_uniform_exptime()

cpl_error_code xsh_frameset_check_uniform_exptime ( cpl_frameset *  raws,
xsh_instrument inst 
)

◆ xsh_frameset_drl_frames()

cpl_frameset * xsh_frameset_drl_frames ( cpl_frameset *  set)

extract DRL specific frames from frameset

Parameters
setinput frameset
Returns
frameset containing DRL specific frames

Definition at line 319 of file xsh_dfs.c.

References check, xsh_free_propertylist(), and xsh_pfits_get_naxis().

Referenced by xsh_merge_ord_ifu().

◆ xsh_frameset_ext_image_frames()

cpl_frameset * xsh_frameset_ext_image_frames ( cpl_frameset *  set)

Extract frameset sub set containing only table frames.

Parameters
setinput frameset
Returns
a new allocated frameset filled by frame tables.

Definition at line 286 of file xsh_dfs.c.

References check, xsh_free_propertylist(), and xsh_pfits_get_naxis().

Referenced by xsh_scired_ifu_offset().

◆ xsh_frameset_ext_table_frames()

cpl_frameset * xsh_frameset_ext_table_frames ( cpl_frameset *  set)

Extract frameset sub set containing only table frames.

Parameters
setinput frameset
Returns
a new allocated frameset filled by frame tables.

Definition at line 207 of file xsh_dfs.c.

References check, xsh_free_propertylist(), and xsh_pfits_get_naxis().

Referenced by xsh_respon_slit_offset(), xsh_scired_ifu_offset(), and xsh_scired_slit_offset().

◆ xsh_frameset_extract()

cpl_frameset * xsh_frameset_extract ( const cpl_frameset *  frames,
const char *  tag 
)

Extract frames with given tag from frameset.

Parameters
framesframe set
tagto search for
Returns
newly allocated, possibly empty, frameset, or NULL on error

Definition at line 983 of file xsh_dfs.c.

References assure.

Referenced by xsh_cfg_recover_last_step(), xsh_ensure_raws_input_offset_recipe_is_proper(), xsh_extract_obj_and_sky_pairs(), xsh_gain(), xsh_util_ima_arith(), and xsh_util_ima_shift().

◆ xsh_frameset_extract_offsety_matches()

cpl_frameset * xsh_frameset_extract_offsety_matches ( cpl_frameset *  raws,
const double  offset 
)

Extract frames that has same cumoffy as offset.

Parameters
rawsinput value
offsetoffset value
Returns
frameset with matching frames

Definition at line 485 of file xsh_dfs.c.

References XSH_ASSURE_NOT_NULL_MSG, xsh_free_propertylist(), and xsh_get_offsety().

Referenced by xsh_extract_nod_pairs().

◆ xsh_frameset_extract_offsety_mismatches()

cpl_frameset * xsh_frameset_extract_offsety_mismatches ( cpl_frameset *  raws,
const double  offset 
)

Extract frames that has different cumoffy than offset.

Parameters
rawsinput value
offsetoffset value
Returns
frameset with not matching frames

Definition at line 527 of file xsh_dfs.c.

References M_PI, XSH_ASSURE_NOT_NULL_MSG, xsh_free_propertylist(), xsh_msg, XSH_NOD_CUMULATIVE_OFFSETY, xsh_pfits_get_cumoffsety(), xsh_pfits_get_dec_cumoffset(), xsh_pfits_get_posang(), and xsh_pfits_get_ra_cumoffset().

Referenced by xsh_extract_nod_pairs().

◆ xsh_frameset_extract_pre()

cpl_frameset * xsh_frameset_extract_pre ( cpl_frameset *  frameset,
const char *  prefix 
)

Extracts pre frames from a frameset.

Parameters
framesetthe set of files
prefixthe pre frame prefix
Returns
the frameset with pre frames

Definition at line 1556 of file xsh_dfs.c.

References check, and xsh_file_exists().

◆ xsh_frameset_merge()

cpl_error_code xsh_frameset_merge ( cpl_frameset *  set1,
cpl_frameset *  set2 
)

Extracts raw frames.

Parameters
set1The input frameset that is extended
set2The input frameset that is merged to set1
Returns
CPL_ERROR_NONE iff ok

Definition at line 1014 of file xsh_dfs.c.

References passure.

Referenced by xsh_ensure_raws_input_offset_recipe_is_proper(), and xsh_lingain().

◆ xsh_frameset_uniform_bin()

cpl_error_code xsh_frameset_uniform_bin ( cpl_frameset **  raws,
cpl_frameset **  calib,
xsh_instrument instrument 
)

◆ xsh_get_column_unit()

static const char * xsh_get_column_unit ( cpl_propertylist *  header,
const char *  colname 
)
static

Tries to identify the units string to used based in BUNIT.

Parameters
headerThe header containing the BUNIT keyword to read from.
colnameName of the column to used in error messages.
Returns
A string containing the nominal units to use or NULL on error.

Definition at line 5295 of file xsh_dfs.c.

References XSH_BUNIT, XSH_SDP_ADU_UNIT, and XSH_SDP_FLUX_UNIT.

Referenced by xsh_sdp_spectrum_create().

◆ xsh_get_nraws()

static int xsh_get_nraws ( const cpl_frameset *  frames)
static

Calculates number of raw frames.

Parameters
framesThe list of used frames to check.

Definition at line 5320 of file xsh_dfs.c.

Referenced by xsh_sdp_spectrum_create().

◆ xsh_get_offsety()

static double xsh_get_offsety ( cpl_propertylist *  plist)
static

◆ xsh_get_tag_from_arm()

char * xsh_get_tag_from_arm ( const char *  tag,
xsh_instrument instr 
)

Find arm specific tag from base and instrument setting.

Parameters
tagThe frame tag
instrthe settings of instrument
Returns
string composed tag

Definition at line 3374 of file xsh_dfs.c.

References xsh_instrument_arm_tostring(), and xsh_msg_dbg_high.

Referenced by xsh_cfg_recover_last_step(), xsh_cfg_recover_measure_line_xy(), xsh_find_frame_with_tag(), xsh_mbias_fpn(), and xsh_model_first_anneal_save().

◆ xsh_mode_is_physmod()

cpl_boolean xsh_mode_is_physmod ( cpl_frameset *  set,
xsh_instrument instrument 
)

◆ xsh_parameter_get_default_flag()

int xsh_parameter_get_default_flag ( const cpl_parameter *  p)

Check if an input parameter has been changed by the user.

Parameters
pinput parameter
Returns
if has not changed 0, else 1;

Definition at line 115 of file xsh_dfs.c.

References xsh_msg_error.

Referenced by xsh_params_set_defaults().

◆ xsh_print_rec_status()

int xsh_print_rec_status ( const int  val)

◆ xsh_sdp_spectrum_create()

static cpl_error_code xsh_sdp_spectrum_create ( irplib_sdp_spectrum *  sdp_spectrum,
const cpl_frameset *  usedframes,
const cpl_propertylist *  sourcekeys,
xsh_instrument instrument,
xsh_spectrum spectrum,
xsh_spectrum uncal_spectrum 
)
static

Converts data into Science Data Product 1D spectrum format.

Parameters
[out]sdp_spectrumThe SDP output spectrum object the will be filled.
[in]usedframesList of frames used to generate the output spectrum.
[in]sourcekeysThe list of FITS keywords from the source product file being converted to SDP format.
[in]instrumentThe X-Shooter instrument configuration structure.
[in]spectrumThe loaded flux calibrated spectrum in X-Shooter format.
[in]uncal_spectrumThe loaded uncalibrated spectrum in X-Shooter format.
Note
If the table and props objects are not empty, then the spectrum data and keywords will be appended to the existing values in those objects instead.

Definition at line 5583 of file xsh_dfs.c.

References xsh_spectrum::errs_header, exptime, xsh_spectrum::flux_header, _xsh_column_info::format, instrument, _xsh_column_info::name, replace_spaces_with_underscores(), _xsh_column_info::tucd, _xsh_column_info::tutyp, _xsh_column_info::type, _xsh_column_info::unit, xsh_aperture_string_to_double(), XSH_ARM_NIR, xsh_arm_tostring(), XSH_ARM_UVB, XSH_ARM_VIS, xsh_calculate_exptime(), XSH_CDELT1, xsh_compute_ron_nir(), XSH_CONAD, XSH_CRDER1, XSH_CRPIX1, XSH_CRVAL1, XSH_CSYER1, XSH_DEC, XSH_DET_DIT, XSH_DET_NDIT, XSH_DET_NDITSKIP, XSH_EXPTIME, xsh_find_first_mjd_obs(), xsh_get_column_unit(), xsh_get_nraws(), xsh_instrument_get_arm(), XSH_MJDEND, XSH_MJDOBS, xsh_msg_warning, XSH_NAXIS1, XSH_OBS_ID, XSH_OBS_PROG_ID, XSH_OBS_TARG_NAME, xsh_pfits_get_date_obs(), xsh_pfits_get_dit(), xsh_pfits_get_obs_id(), XSH_PRO_REC1_PIPE_ID, XSH_PRO_TECH, XSH_QC_FLUX_SN, XSH_RA, XSH_RON, XSH_SCIENCE_SPECTRUM, XSH_SDP_COLUMN_ERR, XSH_SDP_COLUMN_ERR_FORMAT, XSH_SDP_COLUMN_ERR_REDUCED, XSH_SDP_COLUMN_ERR_REDUCED_FORMAT, XSH_SDP_COLUMN_ERR_REDUCED_TYPE, XSH_SDP_COLUMN_ERR_REDUCED_UCD, XSH_SDP_COLUMN_ERR_TYPE, XSH_SDP_COLUMN_ERR_UCD, XSH_SDP_COLUMN_FLUX, XSH_SDP_COLUMN_FLUX_FORMAT, XSH_SDP_COLUMN_FLUX_REDUCED, XSH_SDP_COLUMN_FLUX_REDUCED_FORMAT, XSH_SDP_COLUMN_FLUX_REDUCED_TYPE, XSH_SDP_COLUMN_FLUX_REDUCED_UCD, XSH_SDP_COLUMN_FLUX_TYPE, XSH_SDP_COLUMN_FLUX_UCD, XSH_SDP_COLUMN_QUAL, XSH_SDP_COLUMN_QUAL_FORMAT, XSH_SDP_COLUMN_QUAL_TYPE, XSH_SDP_COLUMN_QUAL_UCD, XSH_SDP_COLUMN_QUAL_UNIT, XSH_SDP_COLUMN_SNR, XSH_SDP_COLUMN_SNR_FORMAT, XSH_SDP_COLUMN_SNR_TYPE, XSH_SDP_COLUMN_SNR_UCD, XSH_SDP_COLUMN_SNR_UNIT, XSH_SDP_COLUMN_WAVE, XSH_SDP_COLUMN_WAVE_FORMAT, XSH_SDP_COLUMN_WAVE_TYPE, XSH_SDP_COLUMN_WAVE_UCD, XSH_SDP_COLUMN_WAVE_UNIT, XSH_SDP_KEYWORD_APERTURE, XSH_SDP_KEYWORD_DETRON, XSH_SDP_KEYWORD_DISPELEM, XSH_SDP_KEYWORD_EFFRON, XSH_SDP_KEYWORD_EXTNAME_VALUE, XSH_SDP_KEYWORD_FLUXCAL, XSH_SDP_KEYWORD_FLUXERR_VALUE, XSH_SDP_KEYWORD_GAIN, XSH_SDP_KEYWORD_INHERIT_VALUE, XSH_SDP_KEYWORD_LAMNLIN, XSH_SDP_KEYWORD_LAMRMS, XSH_SDP_KEYWORD_OBJECT, XSH_SDP_KEYWORD_ORIGIN, XSH_SDP_KEYWORD_ORIGIN_VALUE, XSH_SDP_KEYWORD_PRODLVL, XSH_SDP_KEYWORD_PRODLVL_VALUE, XSH_SDP_KEYWORD_REFERENC_VALUE, XSH_SDP_KEYWORD_SPEC_ERR, XSH_SDP_KEYWORD_SPEC_RES, XSH_SDP_KEYWORD_SPEC_SYE, XSH_SDP_KEYWORD_SPECSYS, XSH_SDP_KEYWORD_SPECSYS_VALUE, XSH_SDP_KEYWORD_TELAPSE, XSH_SDP_KEYWORD_TITLE, XSH_SDP_KEYWORD_TMID, XSH_SDP_KEYWORD_TOT_FLUX, XSH_SDP_KEYWORD_VOCLASS_VALUE, XSH_SDP_KEYWORD_VOPUB_VALUE, XSH_SLIT_NIR, XSH_SLIT_UVB, XSH_SLIT_VIS, xsh_spectrum_get_errs(), xsh_spectrum_get_flux(), xsh_spectrum_get_lambda_max(), xsh_spectrum_get_lambda_min(), xsh_spectrum_get_lambda_step(), xsh_spectrum_get_qual(), and xsh_spectrum_get_size().

Referenced by xsh_add_sdp_product_spectrum().

◆ xsh_table_save()

cpl_error_code xsh_table_save ( cpl_table *  t,
cpl_propertylist *  ph,
cpl_propertylist *  xh,
const char *  fname,
const int  ext 
)

Definition at line 5171 of file xsh_dfs.c.

Referenced by xsh_telluric_model_eval().

◆ xsh_unique_filename()

char * xsh_unique_filename ( const char *  context,
const char *  caller_id,
const char *  pro_catg 
)

Get unique product filename.

Parameters
contextThe current context, or NULL
caller_idName of calling module
pro_catgThe PROduct CATeGory
Returns
Newly allocated unique filename.

This function can be used to avoid overwriting existing files. It computes the filename depending on the current context (position in the call-tree).

If this turns out not to be a problem, one could simply use pro_catg.fits as the filename.

Definition at line 1737 of file xsh_dfs.c.

References xsh_stringcat_4(), and xsh_stringcat_6().

◆ xsh_validate_model_cfg()

cpl_error_code xsh_validate_model_cfg ( cpl_frame *  mod,
cpl_frameset *  set 
)

Validate model cfg.

Parameters
modmodel cfg frame
setinput frameset
Returns
a new allocated frameset filled by frame tables.

Definition at line 169 of file xsh_dfs.c.

References check, xsh_msg_warning, and xsh_pfits_get_mjdobs().

◆ xsh_vector_save()

cpl_error_code xsh_vector_save ( cpl_vector *  v,
cpl_propertylist *  ph,
const char *  fname,
const int  ext 
)

Definition at line 5185 of file xsh_dfs.c.