/home/amodigli/releases/xsh/1.2.10/pso/xsh.26608/xshp/recipes/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.

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

Variables

static char xsh_cfg_recover_description_short []
static char xsh_cfg_recover_description []

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