X-shooter Pipeline Reference Manual 3.8.15
Macros | Functions | Variables
xsh_cfg_recover

Macros

#define RECIPE_ID   "xsh_cfg_recover"
 
#define RECIPE_AUTHOR   "A. Modigliani, P. Bristow"
 
#define RECIPE_CONTACT   "amodigli@eso.org"
 
#define XSH_THE_TAB_SUB_VIS   "XSH_THE_TAB_VIS"
 
#define XSH_THE_TAB_SUB_UVB   "XSH_THE_TAB_UVB"
 
#define XSH_THE_TAB_SUB_NIR   "XSH_THE_TAB_NIR"
 
#define XSH_STARTUP_TABLE_COLNAME_X   "X"
 
#define XSH_ORDPOS_POL_DIM_MAX   4
 

Functions

static int xsh_cfg_recover_create (cpl_plugin *plugin)
 Setup the recipe options.
 
static int xsh_cfg_recover_exec (cpl_plugin *plugin)
 Execute the plugin instance given by the interface.
 
static int xsh_cfg_recover_destroy (cpl_plugin *plugin)
 Destroy what has been created by the 'create' function.
 
static int xsh_cfg_recover_last_step (cpl_parameterlist *parameters, cpl_frameset *frameset, xsh_instrument *instrument, cpl_frameset *raws, cpl_frameset *calib)
 Interpret the command line options and execute the data processing.
 
static cpl_error_code xsh_cfg_recover_driver (cpl_parameterlist *parameters, cpl_frameset *frameset)
 
int cpl_plugin_get_info (cpl_pluginlist *list)
 Build the list of available plugins, for this module.
 

Variables

static char xsh_cfg_recover_description_short []
 
static char xsh_cfg_recover_description []
 

xsh_cfg_recover_prepare_pm_set

Prepare data for pattern matching

Parameters
tab_xy_guesstable containing xy pattern
tab_xy_peaks_seltable containing xy data
parametersrecipe parameters
mat_guematrix catalog (output)
mat_msrmatrix data (output)
Returns
error code status
static cpl_error_code xsh_cfg_recover_prepare_pm_set (cpl_table *tab_pat, cpl_table *tab_dat, cpl_parameterlist *parameters, cpl_matrix **mat_pat, cpl_matrix **mat_dat, int *use_pat, int *use_dat)
 

xsh_cfg_recover_model_THE_create

creates the model THE table corresponding to the best found model configuration

Parameters
config_frameframe of annealed model configuration parameters
xsh_instrumentinstrument instrument ARM setting
wave_listinput frame wavelength list
THE1_frmTHE map for central pinhole
THE9_frmTHE map for 9 pinholes
Returns
model_THE_frm output model THE table corresponding to line list and annealed model configuration or NULL if failure THIS IS ESSENTIALLY A WRAPPER FOR xsh_model_THE_create
static cpl_error_code xsh_cfg_recover_model_THE_create (cpl_frame *config_frame, xsh_instrument *instrument, cpl_frame *wave_list, cpl_frame **THE1, cpl_frame **THE9)
 

xsh_cfg_recover_pattern_match

Select lines using pattern matching technique

Parameters
parametersrecipe input parameters
mat_catmatrix catalog
mat_datmatrix data
use_patternstarting number of searched pattern points
use_datastarting number of searched data points
debug_leveldebug level
Returns
cpl_error_code
static cpl_error_code xsh_cfg_recover_pattern_match (cpl_parameterlist *parameters, cpl_matrix *mat_gue, cpl_matrix *mat_dat, int use_pattern, int use_data, int debug_level)
 

xsh_cfg_recover_guess_tab_corr_by_user

Applies user X-Y offset to guess

Parameters
parametersrecipe input parameters
model-xy_guessinput/outup table frame
Returns
error code status
static cpl_error_code xsh_cfg_recover_guess_tab_corr_by_user (cpl_parameterlist *parameters, cpl_frame **model_xy_gue)
 

xsh_cfg_recover_measure_line_xy_fit

Measure lines x,y positions with a Gaussian fit on the raw_frm

Parameters
raw_frmthe input raw formatcheck frame (pre-overscan removed)
parametersthe recipe input parameters
guessthe guess table frame to be corrected after line measurements
debug_leveldebug level
Returns
error code status ONLY USED BY GFIT METHOD
static cpl_error_code xsh_cfg_recover_measure_line_xy_fit (cpl_frame *raw_frm, cpl_parameterlist *parameters, cpl_frame **model_xy_gue, int debug_level)
 

xsh_cfg_recover_add_peaks_xpos

Add peaks x positions by taking into account of order polynomial

Parameters
order_tab_centrthe input order table frame
tab_xy_peaksthe input table with line IDs
Returns
the input table with added x positions corresponding to y positions
static cpl_error_code xsh_cfg_recover_add_peaks_xpos (cpl_frame *order_tab_centr, xsh_instrument *instr, cpl_table **tab_xy_peaks)
 

xsh_cfg_recover_remove_blends

Remove blended lines from input line catalog

Parameters
tab_xy_guessthe input table with line IDs
tab_xy_peaks_selthe input table with line peaks
thresh_xx radii for peaks match search
thresh_yy radii for peaks match search
Returns
a cleaned table.
static cpl_table * xsh_cfg_recover_remove_blends (cpl_table *tab_xy_guess, cpl_table *tab_xy_peaks_sel, const int thresh_x, const int thresh_y)
 

xsh_cfg_recover_measure_tab_xy_peaks

Determines line peaks in an input image frame

Parameters
ima_extthe input image (with spectra describing extracted orders)
parametersthe recipe input parameters
Returns
table containing line peaks positions
static cpl_table * xsh_cfg_recover_measure_tab_xy_peaks (cpl_image *ima_ext, cpl_parameterlist *parameters)
 

xsh_cfg_recover_select_peaks

Select lines from input line catalog whose Y interdistance is greater than a threshold

Parameters
tab_xy_guessthe input table with line IDs
tab_xy_peaks_selthe input table with line peaks
Returns
a cleaned table.
static cpl_table * xsh_cfg_recover_select_peaks (cpl_table *tab_xy_guess, cpl_table *tab_xy_peaks, const double factor)
 

xsh_cfg_recover_extend_xy_pos_frm

Add columns to properly match with outher functions used later

Parameters
frmthe input table frame
Returns
error code status
static cpl_error_code xsh_cfg_recover_extend_xy_pos_frm (cpl_frame **frm, xsh_instrument *instrument)
 

xsh_cfg_recover_measure_line_xy

Measure lines x,y positions

Parameters
raw_frmthe input raw formatcheck frame (pre-overscan removed)
instrinstrument setting
order_tab_centrinput raw order-flat frame (pre-overscan removed)
parametersthe recipe input parameters
guessguess table frame to be corrected after line measurements
Returns
error code status
static cpl_error_code xsh_cfg_recover_measure_line_xy (cpl_frame *frame, xsh_instrument *inst, cpl_frame *order_tab_centr, cpl_parameterlist *parameters, const char *method, cpl_frame *model_config, cpl_frame **guess, int debug_level)
 

xsh_cfg_recover_gen_xyg

generates a table frame with x-y guess predictions

Parameters
lines_tabthe input reference line table
p_xs_3_configa pouinter to the XSH model configuration structure
instthe XSH instrument setting
lines_xygthe output table with the model x-y guess positions
Returns
0 if everything is ok, -1 in error case This recipe return an allocated table.
static cpl_error_code xsh_cfg_recover_gen_xyg (cpl_table *lines_tab, struct xs_3 *p_xs_3_config, xsh_instrument *inst, int pre_scan, cpl_table **lines_gue)
 

xsh_cfg_recover_gen_xyg_frame

generates a table frame with x-y guess predictions

Parameters
wave_listthe input reference line list
config_framethe XSH model configuration frame
instthe XSH instrument setting
Returns
0 if everything is ok, -1 in error case
static cpl_frame * xsh_cfg_recover_gen_xyg_frame (cpl_frame *wave_list, cpl_frame *config_frame, xsh_instrument *instr, int prescan)
 

xsh_cfg_recover_linear_ext

Determines extracted spectra

Parameters
raw_frmthe input image frame to be extracted
order_tab_centrthe order table frame tracing the frame order
instrthe instrument setting
slitthe extraction slit
parametersthe recipe input parameters
Returns
table containing line peaks positions This function allocates an image
static cpl_image * xsh_cfg_recover_linear_ext (cpl_frame *raw_frm, cpl_frame *order_tab_centr, xsh_instrument *instr, const int slit, const double thresh_min)
 

xsh_cfg_recover_guess_tab_corr_by_ordpos

Correct model guess X positions taking into account of order traces

Parameters
instrthe instrument setting
order_tab_centrthe order table frame tracing the frame order
model_xy_guethe guess table whose X positions are being corrected
debug_leveldebug level
Returns
cpl_error_code
static cpl_error_code xsh_cfg_recover_guess_tab_corr_by_ordpos (xsh_instrument *instr, cpl_frame *order_tab_centr, cpl_frame **model_xy_gue)
 

Detailed Description

This recipe is used to startup the data reduction chain. It requires an input frame where a single pinhole is illuminated by a ThAr lamp, reference line list, a model configuration parameter file, It calculates the geometry of the spectral format from a physical model corresponding to the given model configuration file and the line list, and compares the predicted line positions to the ones on the calibration frame See man-page for details.

Macro Definition Documentation

◆ RECIPE_AUTHOR

#define RECIPE_AUTHOR   "A. Modigliani, P. Bristow"

Definition at line 92 of file xsh_cfg_recover.c.

◆ RECIPE_CONTACT

#define RECIPE_CONTACT   "amodigli@eso.org"

Definition at line 93 of file xsh_cfg_recover.c.

◆ RECIPE_ID

#define RECIPE_ID   "xsh_cfg_recover"

Definition at line 91 of file xsh_cfg_recover.c.

◆ XSH_ORDPOS_POL_DIM_MAX

#define XSH_ORDPOS_POL_DIM_MAX   4

Definition at line 102 of file xsh_cfg_recover.c.

◆ XSH_STARTUP_TABLE_COLNAME_X

#define XSH_STARTUP_TABLE_COLNAME_X   "X"

Definition at line 99 of file xsh_cfg_recover.c.

◆ XSH_THE_TAB_SUB_NIR

#define XSH_THE_TAB_SUB_NIR   "XSH_THE_TAB_NIR"

Definition at line 97 of file xsh_cfg_recover.c.

◆ XSH_THE_TAB_SUB_UVB

#define XSH_THE_TAB_SUB_UVB   "XSH_THE_TAB_UVB"

Definition at line 96 of file xsh_cfg_recover.c.

◆ XSH_THE_TAB_SUB_VIS

#define XSH_THE_TAB_SUB_VIS   "XSH_THE_TAB_VIS"

Definition at line 95 of file xsh_cfg_recover.c.

Function Documentation

◆ cpl_plugin_get_info()

int cpl_plugin_get_info ( cpl_pluginlist *  list)

Build the list of available plugins, for this module.

Parameters
listthe plugin list
Returns
0 if everything is ok, -1 otherwise

Create the recipe instance and make it available to the application using the interface. This function is exported.

Definition at line 294 of file xsh_cfg_recover.c.

References RECIPE_AUTHOR, RECIPE_CONTACT, RECIPE_ID, xsh_cfg_recover_create(), xsh_cfg_recover_description, xsh_cfg_recover_description_short, xsh_cfg_recover_destroy(), xsh_cfg_recover_exec(), and xsh_get_license().

◆ xsh_cfg_recover_add_peaks_xpos()

static cpl_error_code xsh_cfg_recover_add_peaks_xpos ( cpl_frame *  order_tab_centr,
xsh_instrument instr,
cpl_table **  tab_xy_peaks 
)
static

◆ xsh_cfg_recover_create()

static int xsh_cfg_recover_create ( cpl_plugin *  plugin)
static

Setup the recipe options.

p = cpl_parameter_new_enum("xsh.xsh_model_compute.arm", CPL_TYPE_STRING, "Arm setting: ", "xsh.xsh_model_compute", "vis", 3,"uvb","vis","nir");

cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"arm"); cpl_parameterlist_append(recipe->parameters, p);

Parameters
pluginthe plugin
Returns
0 if everything is ok

Create the recipe instance and make it available to the application using the interface.

Definition at line 347 of file xsh_cfg_recover.c.

References assure, check, RECIPE_ID, xsh_init(), xsh_parameters_decode_bp(), and xsh_parameters_generic().

Referenced by cpl_plugin_get_info().

◆ xsh_cfg_recover_destroy()

static int xsh_cfg_recover_destroy ( cpl_plugin *  plugin)
static

Destroy what has been created by the 'create' function.

Parameters
pluginthe plugin
Returns
0 if everything is ok

Definition at line 687 of file xsh_cfg_recover.c.

References assure, and xsh_free_parameterlist().

Referenced by cpl_plugin_get_info().

◆ xsh_cfg_recover_driver()

static cpl_error_code xsh_cfg_recover_driver ( cpl_parameterlist *  parameters,
cpl_frameset *  frameset 
)
static

◆ xsh_cfg_recover_exec()

static int xsh_cfg_recover_exec ( cpl_plugin *  plugin)
static

Execute the plugin instance given by the interface.

Parameters
pluginthe plugin
Returns
0 if everything is ok

Definition at line 651 of file xsh_cfg_recover.c.

References assure, check, xsh_cfg_recover_driver(), and xsh_free_parameterlist().

Referenced by cpl_plugin_get_info().

◆ xsh_cfg_recover_extend_xy_pos_frm()

static cpl_error_code xsh_cfg_recover_extend_xy_pos_frm ( cpl_frame **  frm,
xsh_instrument instrument 
)
static

◆ xsh_cfg_recover_gen_xyg()

static cpl_error_code xsh_cfg_recover_gen_xyg ( cpl_table *  lines_tab,
struct xs_3 p_xs_3_config,
xsh_instrument inst,
int  pre_scan,
cpl_table **  lines_gue 
)
static

◆ xsh_cfg_recover_gen_xyg_frame()

static cpl_frame * xsh_cfg_recover_gen_xyg_frame ( cpl_frame *  wave_list,
cpl_frame *  config_frame,
xsh_instrument instr,
int  prescan 
)
static

◆ xsh_cfg_recover_guess_tab_corr_by_ordpos()

static cpl_error_code xsh_cfg_recover_guess_tab_corr_by_ordpos ( xsh_instrument instr,
cpl_frame *  order_tab_centr,
cpl_frame **  model_xy_gue 
)
static

◆ xsh_cfg_recover_guess_tab_corr_by_user()

static cpl_error_code xsh_cfg_recover_guess_tab_corr_by_user ( cpl_parameterlist *  parameters,
cpl_frame **  model_xy_gue 
)
static

Definition at line 1201 of file xsh_cfg_recover.c.

References check, xs_3::offx, xs_3::offy, and xsh_free_table().

Referenced by xsh_cfg_recover_last_step().

◆ xsh_cfg_recover_last_step()

static int xsh_cfg_recover_last_step ( cpl_parameterlist *  parameters,
cpl_frameset *  frameset,
xsh_instrument instrument,
cpl_frameset *  raws,
cpl_frameset *  calib 
)
static

◆ xsh_cfg_recover_linear_ext()

static cpl_image * xsh_cfg_recover_linear_ext ( cpl_frame *  raw_frm,
cpl_frame *  order_tab_centr,
xsh_instrument instr,
const int  slit,
const double  thresh_min 
)
static

◆ xsh_cfg_recover_measure_line_xy()

static cpl_error_code xsh_cfg_recover_measure_line_xy ( cpl_frame *  frame,
xsh_instrument inst,
cpl_frame *  order_tab_centr,
cpl_parameterlist *  parameters,
const char *  method,
cpl_frame *  model_config,
cpl_frame **  guess,
int  debug_level 
)
static

◆ xsh_cfg_recover_measure_line_xy_fit()

static cpl_error_code xsh_cfg_recover_measure_line_xy_fit ( cpl_frame *  raw_frm,
cpl_parameterlist *  parameters,
cpl_frame **  model_xy_gue,
int  debug_level 
)
static

◆ xsh_cfg_recover_measure_tab_xy_peaks()

static cpl_table * xsh_cfg_recover_measure_tab_xy_peaks ( cpl_image *  ima_ext,
cpl_parameterlist *  parameters 
)
static

◆ xsh_cfg_recover_model_THE_create()

static cpl_error_code xsh_cfg_recover_model_THE_create ( cpl_frame *  config_frame,
xsh_instrument instrument,
cpl_frame *  wave_list,
cpl_frame **  THE1,
cpl_frame **  THE9 
)
static

◆ xsh_cfg_recover_pattern_match()

static cpl_error_code xsh_cfg_recover_pattern_match ( cpl_parameterlist *  parameters,
cpl_matrix *  mat_gue,
cpl_matrix *  mat_dat,
int  use_pattern,
int  use_data,
int  debug_level 
)
static

◆ xsh_cfg_recover_prepare_pm_set()

static cpl_error_code xsh_cfg_recover_prepare_pm_set ( cpl_table *  tab_pat,
cpl_table *  tab_dat,
cpl_parameterlist *  parameters,
cpl_matrix **  mat_pat,
cpl_matrix **  mat_dat,
int *  use_pat,
int *  use_dat 
)
static

◆ xsh_cfg_recover_remove_blends()

static cpl_table * xsh_cfg_recover_remove_blends ( cpl_table *  tab_xy_guess,
cpl_table *  tab_xy_peaks_sel,
const int  thresh_x,
const int  thresh_y 
)
static

Definition at line 2654 of file xsh_cfg_recover.c.

References check, x, xsh_free_table(), and y.

Referenced by xsh_cfg_recover_measure_line_xy().

◆ xsh_cfg_recover_select_peaks()

static cpl_table * xsh_cfg_recover_select_peaks ( cpl_table *  tab_xy_guess,
cpl_table *  tab_xy_peaks,
const double  factor 
)
static

Definition at line 2803 of file xsh_cfg_recover.c.

References check, xsh_free_table(), and xsh_msg.

Referenced by xsh_cfg_recover_measure_line_xy().

Variable Documentation

◆ xsh_cfg_recover_description

char xsh_cfg_recover_description[]
static
Initial value:
=
"This recipe creates a wavelength solution and an order table.\n\
Input Frames :\n\
- [UVB, VIS] A RAW frame (Format = RAW, Tag = FMTCHK_arm)\n\
- [NIR] Two RAW frames (Format = RAW, Tag = FMTCHK_arm_ON,FMTCHK_arm_OFF)\n\
- The old model cfg table (Format = TABLE, Tag = XSH_MOD_CFG_TAB_arm)\n\
- A ref. line list. The model computes corresponding positions \n\
(Format = TABLE, Tag = ARC_LINE_LIST_arm)\n\
- [UVB,VIS,OPTIONAL] A master bias (Format = PRE, Tag = MASTER_BIAS_arm)\n\
- [UVB,VIS,OPTIONAL] A master dark (Format = PRE, Tag = MASTER_DARK_arm)\n\
- [OPTIONAL-Required if method=pm,peaks] \n\
An order table (Format = TABLE, Tag = ORDER_TAB_CENTR_arm)\n\
- [OPTIONAL-Required if first-anneal=TRUE] \n\
A table with measured line positions (Format = TABLE, Tag = XSH_MEASCOORD_arm)\n\
Products : \n\
- if first-anneal=FALSE & last-step=FALSE\n\
nothing\n\
- if first-anneal=TRUE & last-step=FALSE\n\
an optimized model configuration, PRO.CATG=XSH_MOD_CFG_arm\n\
- if last-step=TRUE\n\
an optimized model configuration, PRO.CATG=XSH_MOD_FAN_arm\n\
an optimized model configuration, PRO.CATG=XSH_MOD_CFG_OPT_arm\n\
an quality control table, PRO.CATG=MODEL_GUESS_XY_arm\n\
the model theoretical map corresponding to the optimized model config,\n\
PRO.CATG=THEO_TAB_MULT_arm, THEO_TAB_IFU_arm, and THEO_TAB_SING_arm\n\
\n"

Definition at line 249 of file xsh_cfg_recover.c.

Referenced by cpl_plugin_get_info().

◆ xsh_cfg_recover_description_short

char xsh_cfg_recover_description_short[]
static
Initial value:
=
"Optimizes a model configuration to match data taken after a major format change"

Definition at line 236 of file xsh_cfg_recover.c.

Referenced by cpl_plugin_get_info(), and xsh_cfg_recover_driver().