X-shooter Pipeline Reference Manual 3.8.15
Macros | Functions | Variables
xsh_cfg_recover.c File Reference
#include <xsh_error.h>
#include <xsh_utils.h>
#include <xsh_msg.h>
#include <xsh_dfs.h>
#include <xsh_drl.h>
#include <xsh_pfits.h>
#include <cpl.h>
#include <math.h>
#include <xsh_data_resid_tab.h>
#include <xsh_utils_table.h>
#include <xsh_model_kernel.h>
#include <xsh_model_utils.h>
#include <xsh_model_io.h>
#include <xsh_spectrum.h>
#include <xsh_fit.h>
#include <stdlib.h>

Go to the source code of this file.

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

Variables

static char xsh_cfg_recover_description_short []
 
static char xsh_cfg_recover_description []