/home/amodigli/releases/xsh/2.1.1/xsh.30433/xshp/xsh/xsh_dfs.c File Reference

#include <xsh_dfs.h>
#include <xsh_pfits.h>
#include <xsh_data_pre.h>
#include <xsh_data_pre_3d.h>
#include <xsh_error.h>
#include <xsh_msg.h>
#include <cpl.h>
#include <string.h>
#include <time.h>
#include <math.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>

Go to the source code of this file.

Functions

xsh_file_exists

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

Parameters:
filename Name of the file to look up.
Returns:
int 1 if file exists, 0 if not

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)
void xsh_add_product_spectrum (cpl_frame *frame, cpl_frameset *frameset, const cpl_parameterlist *parameters, const char *recipe_id, xsh_instrument *instr)
void xsh_add_product_pre (cpl_frame *frame, cpl_frameset *frameset, const cpl_parameterlist *parameters, const char *recipe_id, xsh_instrument *instr)
 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)



int xsh_parameter_get_default_flag (const cpl_parameter *p)
 Check if an input parameter has been changed by the user.
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_error_code 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

cpl_error_code xsh_add_afc_info ( cpl_frame *  frm_m,
cpl_frame *  frm_o 
)
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:
frame Product Frame
frameset Input Frameset
parameters Parameters list
recipe_id Recipe Identification String
instrument Instrument structure
final_prefix Final file name
type of frame (image/imagelist/table)

Definition at line 1664 of file xsh_dfs.c.

References check, check_msg, xsh_instrument::dictionary, xsh_instrument::pipeline_id, xsh_add_product_file(), XSH_ASSURE_NOT_NULL, 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.

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:
frame Product Frame
frameset Input Frameset
parameters Parameters list
recipe_id Recipe Identification String
instrument Instrument structure
final_prefix Final file name

Definition at line 2195 of file xsh_dfs.c.

References check, check_msg, xsh_instrument::dictionary, xsh_instrument::pipeline_id, xsh_add_product_file(), XSH_ASSURE_NOT_NULL, 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().

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_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:
frame Product Frame
frameset Input Frameset
parameters Parameters list
recipe_id Recipe Identification String
instrument Instrument structure
final_prefix Final file name

Definition at line 2304 of file xsh_dfs.c.

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

Referenced by xsh_build_ifu_cube(), and xsh_util_ifu_build_cube().

void xsh_add_product_pre ( cpl_frame *  frame,
cpl_frameset *  frameset,
const cpl_parameterlist *  parameters,
const char *  recipe_id,
xsh_instrument instr 
)

Add DFS keywords to a product frame.

Parameters:
frame The product frame
frameset The recipe frameset.
parameters The recipe parameter list
recipe_id The recipe name
instr The 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 1986 of file xsh_dfs.c.

References assure, check, xsh_pre::data_header, xsh_instrument::dictionary, xsh_pre::errs_header, xsh_instrument::pipeline_id, xsh_pre::qual_header, xsh_add_product_file(), XSH_ASSURE_NOT_NULL, XSH_FREE, xsh_free_frame(), xsh_free_propertylist(), xsh_pfits_get_arcfile(), 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_stringcat_any(), and xsh_time_stamp_get().

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

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:
frame The product frame
frameset The recipe frameset.
parameters The recipe parameter list
recipe_id The recipe name
instr The instrument settings

Definition at line 2107 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_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().

void xsh_add_product_spectrum ( cpl_frame *  frame,
cpl_frameset *  frameset,
const cpl_parameterlist *  parameters,
const char *  recipe_id,
xsh_instrument instr 
)
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 
)
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:
frame Product Frame
frameset Input Frameset
parameters Parameters list
recipe_id Recipe Identification String
instr Instrument structure

Definition at line 1798 of file xsh_dfs.c.

References check, check_msg, xsh_instrument::dictionary, xsh_instrument::pipeline_id, xsh_add_product_file(), XSH_ASSURE_NOT_NULL, 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().

static cpl_error_code xsh_calib_nir_2dmap_corr_if_JH ( cpl_frameset *  calib,
xsh_instrument instr 
) [static]
cpl_error_code xsh_calib_nir_corr_if_JH ( cpl_frameset *  calib,
xsh_instrument instr,
const char *  recid 
)
static cpl_error_code xsh_calib_nir_mflat_corr_if_JH ( cpl_frameset *  calib,
xsh_instrument instr 
) [static]
static cpl_error_code xsh_calib_nir_orderpos_corr_if_JH ( cpl_frameset *  calib,
xsh_instrument instr 
) [static]
static cpl_error_code xsh_calib_nir_predict_corr_if_JH ( cpl_frameset *  calib,
xsh_instrument instr 
) [static]

Definition at line 4256 of file xsh_dfs.c.

References XSH_ASSURE_NOT_NULL_MSG.

Referenced by xsh_calib_nir_corr_if_JH().

cpl_error_code xsh_calib_nir_respon_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 
) [static]
static cpl_error_code xsh_calib_nir_wavecal_corr_if_JH ( cpl_frameset *  calib,
xsh_instrument instr 
) [static]
cpl_frameset* xsh_correct_calib ( cpl_frameset *  raws,
cpl_frameset *  calib 
)
static cpl_frameset* xsh_correct_frameset_calib_bin ( cpl_frameset *  input,
const int  ref_binx,
const int  ref_biny,
xsh_instrument inst 
) [static]
static cpl_frameset* xsh_correct_frameset_raws_bin ( cpl_frameset *  input,
const int  ref_binx,
const int  ref_biny,
xsh_instrument inst 
) [static]
static char* xsh_create_final_name ( const char *  final_prefix  )  [static]

creates file name based on tag prefix

Parameters:
prefix tag prefix

Definition at line 1372 of file xsh_dfs.c.

References XSH_FREE, XSH_PRODUCT_PREFIX, xsh_sdate_utc(), xsh_stringcat_any(), and xsh_time_stamp_get().

Referenced by xsh_add_product(), xsh_add_product_bpmap(), xsh_add_product_image(), xsh_add_product_imagelist(), xsh_add_product_table(), and xsh_add_product_vector().

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_prefix tag prefix
frame product frame

Definition at line 1350 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(), and xsh_add_product_table().

cpl_error_code xsh_dfs_check_binning ( cpl_frameset *  set,
cpl_frameset *  calib 
)
cpl_error_code xsh_dfs_check_mflat_is_proper ( xsh_instrument inst,
cpl_frameset **  calib 
)
cpl_error_code xsh_dfs_extract_calib_frames ( cpl_frameset *  input,
cpl_frameset *  calib 
)

split input sof in groups: raw and calib

Parameters:
input the input set of files
calib the calib files of the input set of files
Returns:
cpl error code

Definition at line 1077 of file xsh_dfs.c.

cpl_error_code xsh_dfs_extract_pro_frames ( cpl_frameset *  input,
cpl_frameset *  pros 
)

split input sof in groups: raw and calib

Parameters:
input the input set of files
pros the product files of the input set of files
Returns:
cpl error code

Definition at line 1103 of file xsh_dfs.c.

References XSH_ASSURE_NOT_NULL_MSG.

Referenced by xsh_lingain().

cpl_error_code xsh_dfs_extract_raw_frames ( cpl_frameset *  input,
cpl_frameset *  raws 
)

split input sof in groups: raw and calib

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

Definition at line 1052 of file xsh_dfs.c.

Referenced by xsh_model_first_anneal_save().

int xsh_dfs_files_dont_exist ( cpl_frameset *  frameset  ) 

Check if all SOF files exist.

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

Definition at line 196 of file xsh_dfs.c.

Referenced by xsh_begin().

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
tags the filtered tag list
size size of list
Returns:
void

Definition at line 1432 of file xsh_dfs.c.

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

Referenced by xsh_begin().

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:
raws set of file where we want to do the search
flat frameset contains only flat

Definition at line 1598 of file xsh_dfs.c.

References assure.

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:
set the input frameset
Returns:
an instrument structure which contains arm, mode and lamp

Definition at line 980 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().

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

split input sof in groups: raw and calib

Parameters:
input the input set of files
raws the raws file of the input set of files
calib the calib files of the input set of files

Definition at line 1129 of file xsh_dfs.c.

References xsh_msg_error.

Referenced by main(), and xsh_begin().

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] input the input RAW NIR set of files
[out] on the on files of the input set of files
[out] off the off files of the input set of files

Definition at line 1220 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(), xsh_scired_ifu_stare(), and xsh_wavecal().

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] input input frameset
[in] object_tag The OBJECT Tag
[in] sky_tag The SKY Tag
[out] object the object files of the input set of files
[out] sky the sky files of the input set of files
Returns:
Number of OBJECT frames (equal nb of SKY frames)

Definition at line 1280 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().

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

Extracts QTH and D2 frames from input frameset.

Parameters:
input the input set of files
qth frameset with QTH frames
d2 frameset with D2 frames
Returns:
void

Definition at line 1165 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().

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:
tag the tag to check
tag_list the list of tags
size size of list
Returns:
TRUE if the tag is find else false

Definition at line 1407 of file xsh_dfs.c.

Referenced by xsh_dfs_filter().

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:
raws input value
instrument arm setting
Returns:
cpl_error_code

Definition at line 302 of file xsh_dfs.c.

References assure, check, 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().

cpl_error_code 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:
raws input value
Returns:
cpl_error_code

Definition at line 735 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().

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

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

Parameters:
raws input value
offset vector with different offset values
Returns:
frameset with a-b sequence frames

Definition at line 532 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().

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:
raws input value
instrument arm
Returns:
cpl_error_code

Definition at line 646 of file xsh_dfs.c.

References assure, check, 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.

int xsh_file_exists ( const char *  filename  ) 

Definition at line 897 of file xsh_dfs.c.

Referenced by xsh_frameset_extract_pre().

cpl_frame* xsh_find_arc_line_list ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find an arc line list frame.

Parameters:
frames The input frameset where we do the search
instr The instrument
Returns:
Pointer to the search frame or exception if don't find

Definition at line 3331 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().

cpl_frame* xsh_find_arc_line_list_clean ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find an arc lines list clean frame.

Parameters:
frames The input frameset where we do the search
instr The instrument
Returns:
Pointer to the search frame or exception if don't find

Definition at line 3305 of file xsh_dfs.c.

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

cpl_frame* xsh_find_bpmap ( cpl_frameset *  set  ) 

find the bad pixel map in a set of files

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

Definition at line 1511 of file xsh_dfs.c.

Referenced by main(), and xsh_linear().

cpl_frame* xsh_find_calpro_model_config ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find model config frame.

Parameters:
frames The input frameset
instr the instrument arm setting
Returns:
Pointer to raw frame

Definition at line 3609 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().

cpl_frame* xsh_find_calpro_model_meas_coord ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find model config frame.

Parameters:
frames The input frameset
instr the instrument arm setting
Returns:
Pointer to raw frame

Definition at line 3663 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().

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:
frames The input frameset
instr The instrument
Returns:
Pointer to wavemap frame

Definition at line 3489 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_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().

static cpl_frame * xsh_find_frame ( cpl_frameset *  frames,
const char *  tags[] 
) [static]
cpl_frame* xsh_find_frame_with_tag ( cpl_frameset *  frames,
const char *  tag,
xsh_instrument instr 
)
cpl_frame* xsh_find_master_bias ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find master bias frame.

Parameters:
frames The input frameset
instr the 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 2742 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_scired_ifu_stare(), xsh_scired_slit_nod_get_calibs(), and xsh_slit_stare_get_calibs().

cpl_frame* xsh_find_master_bpmap ( cpl_frameset *  set  ) 

find the master bad pixel map in a set of files

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

Definition at line 1534 of file xsh_dfs.c.

References XSH_MASTER_BP_MAP.

Referenced by xsh_cfg_recover_last_step(), and xsh_geom_ifu().

cpl_frame* xsh_find_master_dark ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find master dark frame.

Parameters:
frames The input frameset
instr the 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 2827 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_scired_ifu_stare(), xsh_slit_stare_get_calibs(), and xsh_wavecal().

cpl_frame* xsh_find_master_flat ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find master flat frame.

Parameters:
frames The input frameset
instr the 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 2849 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_scired_ifu_offset(), xsh_scired_ifu_stare(), xsh_scired_slit_nod_get_calibs(), xsh_slit_offset_get_calibs(), and xsh_slit_stare_get_calibs().

cpl_frame* xsh_find_model_config ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a model config.

Parameters:
frames The input frameset where we do the search
instr The instrument
Returns:
Pointer to the search frame or exception if don't find

Definition at line 3151 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().

cpl_frame* xsh_find_model_config_open ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find model config frame.

Parameters:
frames The input frameset
instr the instrument arm setting
Returns:
Pointer to raw frame

Definition at line 3636 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().

cpl_frame* xsh_find_model_config_tab ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a model configuration table frame.

Parameters:
frames The input frameset where we do the search
instr The instrument
Returns:
Pointer to the search frame or exception if don't find

Definition at line 3380 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().

cpl_frame* xsh_find_model_testpar ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find model test parameter list.

Parameters:
frames The input frameset
instr the instrument arm setting
Returns:
Pointer to raw frame

Definition at line 3715 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().

cpl_frame* xsh_find_model_wavelist ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find model wavelength list frame.

Parameters:
frames The input frameset
instr the instrument arm setting
Returns:
Pointer to raw frame

Definition at line 3688 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().

cpl_frame* xsh_find_off ( cpl_frameset *  set  ) 

find the off frame in set of files

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

Definition at line 1555 of file xsh_dfs.c.

cpl_frameset* xsh_find_offset_tab_ifu ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find offset tab (One for each slitlet).

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

Definition at line 3255 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.

cpl_frame* xsh_find_on ( cpl_frameset *  set  ) 

find the on frame in set of files

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

Definition at line 1576 of file xsh_dfs.c.

cpl_frame* xsh_find_order_tab_centr ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find an order tab CENTR.

Parameters:
frames The input frameset where we do the search
instr The instrument
Returns:
Pointer to the search frame or exception if don't find

Definition at line 2993 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 xsh_calib_nir_mflat_corr_if_JH(), and xsh_mflat().

cpl_frame* xsh_find_order_tab_edges ( cpl_frameset *  frames,
xsh_instrument instr 
)
cpl_frame* xsh_find_order_tab_guess ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find an order tab GUESS.

Parameters:
frames The input frameset where we do the search
instr The instrument
Returns:
Pointer to the search frame or exception if don't find

Definition at line 2968 of file xsh_dfs.c.

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

cpl_frame* xsh_find_order_tab_recov ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find an order tab RECOV.

Parameters:
frames The input frameset where we do the search
instr The instrument
Returns:
Pointer to the search frame or exception if don't find

Definition at line 2943 of file xsh_dfs.c.

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

cpl_frame* xsh_find_raw_arc_slit_nir_off ( cpl_frameset *  frames  ) 

Find raw frame for Slit NIR OFF.

Parameters:
frames The input frameset
Returns:
Pointer to raw frame

Definition at line 3587 of file xsh_dfs.c.

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

cpl_frame* xsh_find_raw_arc_slit_nir_on ( cpl_frameset *  frames  ) 

Find raw frame for Slit NIR ON.

Parameters:
frames The input frameset
Returns:
Pointer to raw frame

Definition at line 3567 of file xsh_dfs.c.

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

cpl_frame* xsh_find_raw_arc_slit_uvb_vis ( cpl_frameset *  frames,
XSH_ARM  arm 
)

Find raw frame for Slit UVB/VIS.

Parameters:
frames The input frameset
arm The ARM (UVB or VIS)
Returns:
Pointer to raw frame

Definition at line 3541 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().

cpl_frame* xsh_find_raw_orderdef_nir ( cpl_frameset *  frames  ) 

Find orderdef raw frame for NIR.

Parameters:
frames The input frameset
Returns:
Pointer to order table frame

Definition at line 3466 of file xsh_dfs.c.

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

Referenced by xsh_orderpos().

cpl_frame* xsh_find_raw_orderdef_nir_off ( cpl_frameset *  frames  ) 

Find orderdef raw frame for NIR OFF.

Parameters:
frames The input frameset
Returns:
Pointer to order table frame

Definition at line 3521 of file xsh_dfs.c.

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

Referenced by xsh_orderpos().

cpl_frame* xsh_find_raw_orderdef_vis_uvb ( cpl_frameset *  frames  ) 

Find orderdef raw frame for UVB or VIS.

Parameters:
frames The input frameset
Returns:
Pointer to order table frame

Definition at line 3428 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().

cpl_frame* xsh_find_slitmap ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a slit map.

Parameters:
frames The input frameset where we do the search
instr The instrument
Returns:
Pointer to the search frame or exception if don't find

Definition at line 3096 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_scired_ifu_offset(), xsh_scired_ifu_stare(), xsh_slit_offset_get_calibs(), xsh_slit_stare_get_maps(), and xsh_wavecal().

cpl_frame* xsh_find_spectral_format ( cpl_frameset *  frames,
xsh_instrument instr 
)
cpl_frame* xsh_find_std_flux ( cpl_frameset *  frames  ) 

Find standard star frame.

Parameters:
frames The 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 2685 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().

cpl_frame* xsh_find_std_star_flux ( cpl_frameset *  frames  ) 

Find standard standard star flux frame.

Parameters:
frames The 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 2717 of file xsh_dfs.c.

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

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:
frames The input frameset where we do the search
instr The instrument
Returns:
Pointer to the search frame or exception if don't find

Definition at line 2913 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.

cpl_frame* xsh_find_theo_tab_mult ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a theoretical tab multi pinhole in SOF.

Parameters:
frames The input frameset where we do the search
instr The instrument
Returns:
Pointer to the search frame or exception if don't find

Definition at line 2891 of file xsh_dfs.c.

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

cpl_frame* xsh_find_theo_tab_sing ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a theoretical tab signle pinhole in SOF.

Parameters:
frames The input frameset where we do the search
instr The instrument
Returns:
Pointer to the search frame or exception if don't find

Definition at line 2868 of file xsh_dfs.c.

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

cpl_frame* xsh_find_usr_lines_guess_tab ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a user guess line positions table frame.

Parameters:
frames The input frameset where we do the search
instr The instrument
Returns:
Pointer to the search frame or exception if don't find

Definition at line 3355 of file xsh_dfs.c.

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

cpl_frame* xsh_find_wave_tab ( cpl_frameset *  frames,
xsh_instrument instr 
)

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

Parameters:
frames The input frameset where we do the search
instr The instrument
Returns:
Pointer to the search frame or exception if don't find

Definition at line 3122 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_scired_slit_nod_get_calibs(), xsh_slit_offset_get_calibs(), and xsh_slit_stare_get_calibs().

cpl_frame* xsh_find_wave_tab_2d ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a wave tab 2D.

Parameters:
frames The input frameset where we do the search
instr The instrument
Returns:
Pointer to the search frame or exception if don't find

Definition at line 3073 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().

cpl_frame* xsh_find_wave_tab_guess ( cpl_frameset *  frames,
xsh_instrument instr 
)

Find a wave tab guess.

Parameters:
frames The input frameset where we do the search
instr The instrument
Returns:
Pointer to the search frame or exception if don't find

Definition at line 3048 of file xsh_dfs.c.

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

cpl_frameset* xsh_find_wave_tab_ifu ( cpl_frameset *  frames,
xsh_instrument instrument 
)

Find wave tab ARC (for IFU 3 frames).

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

Definition at line 3179 of file xsh_dfs.c.

References check, 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 main(), and xsh_geom_ifu().

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:
frames The input frameset
instr the instrument
Returns:
Pointer to wavemap frame

Definition at line 3406 of file xsh_dfs.c.

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

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

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:
fname frame filename
tag frame tag
type frame type
group frame group
level frame level
frame output frame
Returns:
0 if no error is detected,-1 else

Definition at line 838 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().

cpl_propertylist* xsh_frame_head_extract_qc ( cpl_frame *  frm  ) 

Definition at line 3824 of file xsh_dfs.c.

Referenced by xsh_mdark().

static cpl_error_code xsh_frame_nir_tab_chop_Kband ( cpl_frame *  frame,
const int  absordmin,
const char *  colname 
) [static]
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_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:
fname frame filename
tag frame tag
type frame type
group frame group
level frame level
Returns:
0 if no error is detected,-1 else

Definition at line 868 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_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().

cpl_error_code xsh_frameset_check_uniform_exptime ( cpl_frameset *  raws,
xsh_instrument inst 
)
cpl_frameset* xsh_frameset_drl_frames ( cpl_frameset *  set  ) 

extract DRL specific frames from frameset

Parameters:
set input frameset
Returns:
frameset containing DRL specific frames

Definition at line 269 of file xsh_dfs.c.

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

Referenced by xsh_merge_ord_ifu().

cpl_frameset* xsh_frameset_ext_image_frames ( cpl_frameset *  set  ) 

Extract frameset sub set containing only table frames.

Parameters:
set input frameset
Returns:
a new allocated frameset filled by frame tables.

Definition at line 236 of file xsh_dfs.c.

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

cpl_frameset* xsh_frameset_ext_table_frames ( cpl_frameset *  set  ) 

Extract frameset sub set containing only table frames.

Parameters:
set input frameset
Returns:
a new allocated frameset filled by frame tables.

Definition at line 158 of file xsh_dfs.c.

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

Referenced by xsh_respon_slit_offset(), and xsh_scired_slit_offset().

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

Extract frames with given tag from frameset.

Parameters:
frames frame set
tag to search for
Returns:
newly allocated, possibly empty, frameset, or NULL on error

Definition at line 921 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().

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

Extract frames that has same cumoffy as offset.

Parameters:
raws input value
offset offset value
Returns:
frameset with matching frames

Definition at line 433 of file xsh_dfs.c.

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

Referenced by xsh_extract_nod_pairs().

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

Extract frames that has different cumoffy than offset.

Parameters:
raws input value
offset offset value
Returns:
frameset with not matching frames

Definition at line 475 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().

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

Extracts pre frames from a frameset.

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

Definition at line 1472 of file xsh_dfs.c.

References check, and xsh_file_exists().

cpl_error_code xsh_frameset_merge ( cpl_frameset *  set1,
cpl_frameset *  set2 
)

Extracts raw frames.

Parameters:
set1 The input frameset that is extended
set2 The input frameset that is merged to set1
Returns:
CPL_ERROR_NONE iff ok

Definition at line 952 of file xsh_dfs.c.

References check, and passure.

Referenced by xsh_ensure_raws_input_offset_recipe_is_proper(), and xsh_lingain().

cpl_error_code xsh_frameset_uniform_bin ( cpl_frameset **  raws,
cpl_frameset **  calib,
xsh_instrument instrument 
)
static double xsh_get_offsety ( cpl_propertylist *  plist  )  [static]
char* xsh_get_tag_from_arm ( const char *  tag,
xsh_instrument instr 
)

Find arm specific tag from base and instrument setting.

Parameters:
tag The frame tag
instr the settings of instrument
Returns:
string composed tag

Definition at line 2797 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(), and xsh_model_first_anneal_save().

cpl_boolean xsh_mode_is_physmod ( cpl_frameset *  set,
xsh_instrument instrument 
)
int xsh_parameter_get_default_flag ( const cpl_parameter *  p  ) 

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

Parameters:
p input parameter
Returns:
if has not changed 0, else 1;

Definition at line 77 of file xsh_dfs.c.

References xsh_msg_error.

Referenced by xsh_params_set_defaults().

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

Definition at line 4581 of file xsh_dfs.c.

Referenced by xsh_telluric_model_eval().

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

Get unique product filename.

Parameters:
context The current context, or NULL
caller_id Name of calling module
pro_catg The 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 1640 of file xsh_dfs.c.

References xsh_stringcat_4(), and xsh_stringcat_6().

cpl_error_code xsh_validate_model_cfg ( cpl_frame *  mod,
cpl_frameset *  set 
)

Validate model cfg.

Parameters:
mod model cfg frame
set input frameset
Returns:
a new allocated frameset filled by frame tables.

Definition at line 120 of file xsh_dfs.c.

References check, xsh_msg_warning, and xsh_pfits_get_mjdobs().

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

Definition at line 4594 of file xsh_dfs.c.


Generated on 13 Mar 2013 for X-shooter Pipeline Reference Manual by  doxygen 1.6.1