xsh_cfg_recover
[Xshooter Recipes]

Defines

#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_guess table containing xy pattern
tab_xy_peaks_sel table containing xy data
parameters recipe parameters
mat_gue matrix catalog (output)
mat_msr matrix 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_frame frame of annealed model configuration parameters
xsh_instrument instrument instrument ARM setting
wave_list input frame wavelength list
THE1_frm THE map for central pinhole
THE9_frm THE 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:
parameters recipe input parameters
mat_cat matrix catalog
mat_dat matrix data
use_pattern starting number of searched pattern points
use_data starting number of searched data points
debug_level debug 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:
parameters recipe input parameters
model-xy_guess input/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_frm the input raw formatcheck frame (pre-overscan removed)
parameters the recipe input parameters
guess the guess table frame to be corrected after line measurements
debug_level debug 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_centr the input order table frame
tab_xy_peaks the 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_guess the input table with line IDs
tab_xy_peaks_sel the input table with line peaks
thresh_x x radii for peaks match search
thresh_y y 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_ext the input image (with spectra describing extracted orders)
parameters the 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_guess the input table with line IDs
tab_xy_peaks_sel the 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:
frm the 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_frm the input raw formatcheck frame (pre-overscan removed)
instr instrument setting
order_tab_centr input raw order-flat frame (pre-overscan removed)
parameters the recipe input parameters
guess guess 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_tab the input reference line table
p_xs_3_config a pouinter to the XSH model configuration structure
inst the XSH instrument setting
lines_xyg the 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_list the input reference line list
config_frame the XSH model configuration frame
inst the 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_frm the input image frame to be extracted
order_tab_centr the order table frame tracing the frame order
instr the instrument setting
slit the extraction slit
parameters the 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:
instr the instrument setting
order_tab_centr the order table frame tracing the frame order
model_xy_gue the guess table whose X positions are being corrected
debug_level debug 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.


Define Documentation

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

Definition at line 92 of file xsh_cfg_recover.c.

#define RECIPE_CONTACT   "amodigli@eso.org"

Definition at line 93 of file xsh_cfg_recover.c.

#define RECIPE_ID   "xsh_cfg_recover"

Definition at line 91 of file xsh_cfg_recover.c.

#define XSH_ORDPOS_POL_DIM_MAX   4
#define XSH_STARTUP_TABLE_COLNAME_X   "X"

Definition at line 99 of file xsh_cfg_recover.c.

#define XSH_THE_TAB_SUB_NIR   "XSH_THE_TAB_NIR"

Definition at line 97 of file xsh_cfg_recover.c.

#define XSH_THE_TAB_SUB_UVB   "XSH_THE_TAB_UVB"

Definition at line 96 of file xsh_cfg_recover.c.

#define XSH_THE_TAB_SUB_VIS   "XSH_THE_TAB_VIS"

Definition at line 95 of file xsh_cfg_recover.c.


Function Documentation

int cpl_plugin_get_info ( cpl_pluginlist *  list  ) 

Build the list of available plugins, for this module.

Parameters:
list the 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().

static cpl_error_code xsh_cfg_recover_add_peaks_xpos ( cpl_frame *  order_tab_centr,
xsh_instrument instr,
cpl_table **  tab_xy_peaks 
) [static]
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:
plugin the 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(), and xsh_parameters_generic().

Referenced by cpl_plugin_get_info().

static int xsh_cfg_recover_destroy ( cpl_plugin *  plugin  )  [static]

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

Parameters:
plugin the 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().

static cpl_error_code xsh_cfg_recover_driver ( cpl_parameterlist *  parameters,
cpl_frameset *  frameset 
) [static]
static int xsh_cfg_recover_exec ( cpl_plugin *  plugin  )  [static]

Execute the plugin instance given by the interface.

Parameters:
plugin the 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().

static cpl_error_code xsh_cfg_recover_extend_xy_pos_frm ( cpl_frame **  frm,
xsh_instrument instrument 
) [static]
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]
static cpl_frame * xsh_cfg_recover_gen_xyg_frame ( cpl_frame *  wave_list,
cpl_frame *  config_frame,
xsh_instrument instr,
int  prescan 
) [static]
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]
static cpl_error_code xsh_cfg_recover_guess_tab_corr_by_user ( cpl_parameterlist *  parameters,
cpl_frame **  model_xy_gue 
) [static]

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

static int xsh_cfg_recover_last_step ( cpl_parameterlist *  parameters,
cpl_frameset *  frameset,
xsh_instrument instrument,
cpl_frameset *  raws,
cpl_frameset *  calib 
) [static]
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]
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]
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]
static cpl_table * xsh_cfg_recover_measure_tab_xy_peaks ( cpl_image *  ima_ext,
cpl_parameterlist *  parameters 
) [static]
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]
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]
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]
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 2610 of file xsh_cfg_recover.c.

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

Referenced by xsh_cfg_recover_measure_line_xy().

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 2759 of file xsh_cfg_recover.c.

References check, xsh_free_table(), and xsh_msg.

Referenced by xsh_cfg_recover_measure_line_xy().


Variable Documentation

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().

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().


Generated on 9 Mar 2011 for X-shooter Pipeline Reference Manual by  doxygen 1.6.1