UVES Pipeline Reference Manual  5.4.6
Macros | Functions
Recipe: UVES Physical Model

Macros

#define FILESIZE   200
 

Functions

int uves_physmod_calmap (const uves_propertylist *raw_header, enum uves_chip chip, const char *recipe_id, const cpl_parameterlist *parameters, cpl_table *npline_tbl, cpl_table **ord_tbl, cpl_table **lin_tbl, cpl_table **w_tbl, cpl_table **s_tbl, int *abs_ord_min, int *abs_ord_max, polynomial **poly2d)
 This procedure makes the order definitions and wavelength calibration from the wavelength projection map, and saves the data in tables and global keywords in echelle context. It generates order and line tables. More...
 
int uves_physmod_center_gauss (const cpl_image *raw_image, cpl_table **m_tbl)
 Fit the image line X and Y distributions with a Gaussian in a box. More...
 
int uves_physmod_chop_otab (const uves_propertylist *raw_header, enum uves_chip chip, cpl_table **ord_tbl, const char *col_name, int *ord_min, int *ord_max)
 Chop off orders which are not fully in the detector chip. More...
 
static int flames_get_trans (const int plt_no, enum uves_chip chip, const double wlen, double *TX, double *TY)
 
static int flames_get_physmod_offset (const int plate_no, const int wavec, enum uves_chip chip, double *trans_x, double *trans_y, double *ech_ang_off, double *cd_ang_off, double *ccd_ang_off)
 Get the physical model shifts in FIBER mode. More...
 
static int uves_get_physmod_offset (const int wavec, enum uves_chip chip, const int binx, const int biny, double *trans_x, double *trans_y, double *ech_ang_off, double *cd_ang_off, double *ccd_ang_off)
 Get the physical model offsets in ECHELLE mode. More...
 
int uves_physmod_create_table (const uves_propertylist *raw_header, enum uves_chip chip, bool flames, const char *recipe_id, const cpl_parameterlist *parameters, cpl_table *line_refer, const double physmod_shift_x, const double physmod_shift_y, cpl_table **mod_tbl, cpl_table **fsr_tbl)
 Generates two tables with results of the UVES physical model. More...
 
int uves_physmod_msrawxy (const cpl_image *raw_image, const uves_propertylist *raw_header, const char *recipe_id, const cpl_parameterlist *parameters, cpl_table *mod_tbl, cpl_table **l_tbl, cpl_table **m_tbl, cpl_table **p_tbl, cpl_table **rline_tbl, cpl_table **mline_tbl, cpl_table **npline_tbl)
 This procedure measures the raw XY positions and widths of Th-Ar lines on an ThAr arc echelle exposure. It computes the differences with the predicted positions. More...
 
int uves_physmod_necregr (cpl_table **ord_tbl, cpl_table **reg_tbl)
 This procedure does a linear fit of independent orders. More...
 
int uves_physmod_plotmod (const cpl_table *tbl, const uves_propertylist *head, const char *rec_id, const cpl_parameterlist *params, enum uves_chip chip)
 This procedure plots results from the uves_physmod recipe. More...
 
int uves_physmod_qc1pmtbl (cpl_table **rline_tbl, cpl_table **lin_tbl)
 To be written. More...
 
int uves_physmod_regress_echelle (const uves_propertylist *raw_header, enum uves_chip chip, const char *recipe_id, const cpl_parameterlist *parameters, cpl_table **o_tbl, int num_outliers, double tol, double kappa, cpl_table **s_tbl, cpl_table **w_tbl)
 Fit mesured position of orders by a bivariate polynomial. More...
 
static int uves_physmod_align_tables (cpl_table **m_tbl, cpl_table **r_tbl)
 This procedure compares two input tables and eventually alignes them. More...
 
static int flames_align_table_column (cpl_table **m_tbl, cpl_table **r_tbl, const char *col)
 This procedure compares two input tables and eventually alignes them. More...
 
int uves_physmod_stability_check (cpl_table *m_tbl, cpl_table *r_tbl, double *med_dx, double *med_dy, double *avg_dx, double *avg_dy)
 This procedure run a stability check. More...
 

Detailed Description

This recipe computes a guess order and line table by using a physical model for UVES See man-page for details.

Function Documentation

int uves_physmod_calmap ( const uves_propertylist raw_header,
enum uves_chip  chip,
const char *  recipe_id,
const cpl_parameterlist *  parameters,
cpl_table *  npline_tbl,
cpl_table **  ord_tbl,
cpl_table **  lin_tbl,
cpl_table **  w_tbl,
cpl_table **  s_tbl,
int *  abs_ord_min,
int *  abs_ord_max,
polynomial **  poly2d 
)

This procedure makes the order definitions and wavelength calibration from the wavelength projection map, and saves the data in tables and global keywords in echelle context. It generates order and line tables.

Parameters
raw_headerheader of raw frame
chipUVES chip ID
recipe_idname of calling recipe
parametersinput recipe parameters
npline_tblinput table
ord_tbloutput order table
lin_tbloutput line table
w_tbloutput table with results from regression
s_tbloutput table with results from regression (same as w one?)
abs_ord_minmin absolute order
abs_ord_maxmax absolute order
poly2doutput polynomial with coefficients from regression: Order=poly2d(X,YNEW) fit is stored in column RORD

: this has been ported from UVES MIDAS pipeline

Definition at line 68 of file uves_physmod_calmap.c.

References check, uves_msg, uves_msg_debug, uves_physmod_regress_echelle(), uves_polynomial_delete(), uves_polynomial_get_coeff_1d(), uves_polynomial_regression_1d(), uves_polynomial_regression_2d(), and uves_propertylist_new().

int uves_physmod_center_gauss ( const cpl_image *  raw_image,
cpl_table **  m_tbl 
)

Fit the image line X and Y distributions with a Gaussian in a box.

Parameters
raw_imageInput raw image
m_tblmodel table: Input/Output table with added colums ICENT,XCEN,YCEN,XFWHM,YFWHM,XSIG,YSIG,XERR,YERR,STATUS with results of a Gaussian marginal fit to the image intensity distributions obtained by collapsing along X and Y the image points within a box centered at each line
Returns
0 if everything is ok, -1 otherwise

This function is used to precisely locate each image line within a given box by a Gaussian 1d fit of each intensity distribution which can be obtained by collapsing the signal within a box centered at each line (routine derived from MIDAS one)

Definition at line 138 of file uves_physmod_center_gauss.c.

References check, check_nomsg, uves_msg, uves_msg_debug, uves_msg_warning, and uves_physmod_stacen().

Referenced by uves_physmod_msrawxy().

int uves_physmod_chop_otab ( const uves_propertylist raw_header,
enum uves_chip  chip,
cpl_table **  ord_tbl,
const char *  col_name,
int *  ord_min,
int *  ord_max 
)

Chop off orders which are not fully in the detector chip.

Parameters
raw_headerAn array containing the input image headers. The ordering must be the same as the ordering of images in the input image list
chipCCD chip
col_nameName of column of which min/max is computed
ord_tblThe output guess order table.
ord_minThe output guess order table minimum value
ord_maxThe output guess order table maximum value
Returns
0 if everything is ok, -1 otherwise

Definition at line 136 of file uves_physmod_chop_otab.c.

References check, check_nomsg, uves_msg_debug, uves_pfits_get_nx(), and uves_pfits_get_ny().

static int flames_get_physmod_offset ( const int  plate_no,
const int  wavec,
enum uves_chip  chip,
double *  trans_x,
double *  trans_y,
double *  ech_ang_off,
double *  cd_ang_off,
double *  ccd_ang_off 
)
static

Get the physical model shifts in FIBER mode.

Parameters
plate_noplate number
waveccentral wavelength
trans_xout physical model X shift
trans_yout physical model Y shift
ech_ang_offout ech angle
cd_ang_offout cd angle
ccd_ang_offout ccd angle
Returns
0 if everything is ok

Definition at line 1835 of file uves_physmod_create_table.c.

References uves_msg, and uves_msg_warning.

Referenced by uves_physmod_create_table().

static int uves_get_physmod_offset ( const int  wavec,
enum uves_chip  chip,
const int  binx,
const int  biny,
double *  trans_x,
double *  trans_y,
double *  ech_ang_off,
double *  cd_ang_off,
double *  ccd_ang_off 
)
static

Get the physical model offsets in ECHELLE mode.

Parameters
waveccentral wavelength
trans_xout physical model X shift
trans_yout physical model Y shift
ech_ang_offout ech angle
cd_ang_offout cd angle
ccd_ang_offout ccd angle
Returns
0 if everything is ok

Definition at line 912 of file uves_physmod_create_table.c.

References uves_msg, and uves_msg_warning.

Referenced by uves_physmod_create_table().

int uves_physmod_create_table ( const uves_propertylist raw_header,
enum uves_chip  chip,
bool  flames,
const char *  recipe_id,
const cpl_parameterlist *  parameters,
cpl_table *  line_refer,
const double  physmod_shift_x,
const double  physmod_shift_y,
cpl_table **  mod_tbl,
cpl_table **  fsr_tbl 
)

Generates two tables with results of the UVES physical model.

Parameters
raw_headerAn array containing the input image headers. The ordering must be the same as the ordering of images in the input image list
chipCCD chip
recipe_idname of calling recipe
parametersThe recipe parameter list
line_referThe reference arc lamp line list
physmod_shift_xCorrection to physical model
physmod_shift_yCorrection to physical model
mod_tblThe output table with results from the UVES physical model
fsr_tblOutput table with predicted Free Spectral Range
Returns
0 if everything is ok, -1 otherwise

This function is used to run the UVES physical model and predict the spectral format (order trace, line positions, blaze, etc..)

Definition at line 124 of file uves_physmod_create_table.c.

References check, check_nomsg, flames_get_physmod_offset(), uves_ccd_is_new(), uves_chip_tostring_upper(), uves_flames_pfits_get_plateid(), uves_get_physmod_offset(), uves_msg, uves_msg_debug, uves_pfits_get_binx(), uves_pfits_get_biny(), uves_pfits_get_chipid(), uves_pfits_get_dpr_tech(), uves_pfits_get_gratid(), uves_pfits_get_gratwlen(), uves_pfits_get_pressure(), uves_pfits_get_slitlength(), uves_pfits_get_slitwidth(), and uves_pfits_get_tempcam().

Referenced by uves_utl_physmod().

int uves_physmod_msrawxy ( const cpl_image *  raw_image,
const uves_propertylist raw_header,
const char *  recipe_id,
const cpl_parameterlist *  parameters,
cpl_table *  mod_tbl,
cpl_table **  l_tbl,
cpl_table **  m_tbl,
cpl_table **  p_tbl,
cpl_table **  rline_tbl,
cpl_table **  mline_tbl,
cpl_table **  npline_tbl 
)

This procedure measures the raw XY positions and widths of Th-Ar lines on an ThAr arc echelle exposure. It computes the differences with the predicted positions.

Parameters
raw_imageThe input raw frame (splitted)
raw_headerAn array containing the input image headers. The ordering must be the same as the ordering of images in the input image list
recipe_idname of calling recipe
parametersThe recipe parameter list
mod_tblInput model table from uves_physmod_create_table()
l_tblTemporary table
m_tblTemporary table
p_tblTemporary table
rline_tblTemporary table with predicted line positions
mline_tblTemporary table with corrected predicted line positions
npline_tblTemporary table
Returns
0 if everything is ok, -1 otherwise

This function creates tables rline_tbl containing predicted positions (XMOD,YMOD) and the differences, fits with a polynomial of degree 2,2 on X,Ythis difference depending on the positions (X,Y), computes the projection map with a polynomial fit of degree 2,2 on X,Y and save them in the table npline_tbl.

Definition at line 86 of file uves_physmod_msrawxy.c.

References check, check_nomsg, uves_msg_debug, uves_pfits_get_binx(), uves_pfits_get_biny(), uves_physmod_center_gauss(), uves_polynomial_delete(), uves_polynomial_evaluate_2d(), uves_polynomial_get_coeff_2d(), and uves_polynomial_regression_2d().

int uves_physmod_necregr ( cpl_table **  ord_tbl,
cpl_table **  reg_tbl 
)

This procedure does a linear fit of independent orders.

Parameters
ord_tblThe input order table
reg_tblThe output regression table.
Returns
0 if everything is ok, -1 otherwise

This procedure does a linear fit of independent orders and writes the rms in a table

Definition at line 105 of file uves_physmod_necregr.c.

References uves_msg_debug.

Referenced by uves_physmod_regress_echelle().

int uves_physmod_plotmod ( const cpl_table *  tbl,
const uves_propertylist head,
const char *  rec_id,
const cpl_parameterlist *  params,
enum uves_chip  chip 
)

This procedure plots results from the uves_physmod recipe.

Parameters
tblThe input line table.
tblThe input raw data header.
paramsThe input recipe parameters.
Returns
0 if everything is ok, -1 otherwise

This procedure plots results from the uves_physmod recipe

Definition at line 119 of file uves_physmod_plotmod.c.

References check, uves_chip_tostring_lower(), uves_pfits_get_gratwlen(), uves_pfits_get_origfile(), uves_pfits_get_slitlength(), uves_pfits_get_slitwidth(), uves_pfits_get_tempcam(), and uves_pfits_get_tpl_start().

int uves_physmod_qc1pmtbl ( cpl_table **  rline_tbl,
cpl_table **  lin_tbl 
)

To be written.

Parameters
rline_tblThe input line table.
lin_tblThe input line table.
Returns
0 if everything is ok, -1 otherwise

Definition at line 121 of file uves_physmod_qc1pmtbl.c.

References check, check_nomsg, and uves_msg_debug.

int uves_physmod_regress_echelle ( const uves_propertylist raw_header,
enum uves_chip  chip,
const char *  recipe_id,
const cpl_parameterlist *  parameters,
cpl_table **  o_tbl,
int  num_outliers,
double  tol,
double  kappa,
cpl_table **  s_tbl,
cpl_table **  w_tbl 
)

Fit mesured position of orders by a bivariate polynomial.

Parameters
raw_headerAn array containing the input image headers. The ordering must be the same as the ordering of images in the input image list
chipCCD chip
recipe_idname of calling recipe
parametersThe recipe parameter list
o_tblThe input order table
num_outliersThe input no of outliers
tolThe input tolerance
kappaThe input value of kappa in kappa-sigma clipping
s_tblThe output table.
w_tblThe output table.
Returns
0 if everything is ok, -1 otherwise Fit mesured position of orders by a bivariate polynomial

Definition at line 98 of file uves_physmod_regress_echelle.c.

References check, uves_msg, uves_msg_debug, uves_msg_error, uves_msg_warning, uves_pfits_get_cdelt1(), uves_pfits_get_cdelt2(), uves_pfits_get_crval1(), uves_pfits_get_crval2(), uves_pfits_get_naxis1(), uves_pfits_get_naxis2(), uves_pfits_get_nx(), uves_pfits_get_ny(), uves_physmod_necregr(), uves_polynomial_delete(), uves_polynomial_get_coeff_2d(), uves_polynomial_regression_2d(), and uves_propertylist_new().

Referenced by uves_physmod_calmap().

static int uves_physmod_align_tables ( cpl_table **  m_tbl,
cpl_table **  r_tbl 
)
static

This procedure compares two input tables and eventually alignes them.

Parameters
m_tblmodel table on actual frame.
r_tblmodel table on reference frame
Returns
0 if everything is ok, -1 otherwise

Definition at line 388 of file uves_physmod_stability_check.c.

References check_nomsg, flames_align_table_column(), uves_msg_warning, and uves_propertylist_new().

Referenced by uves_physmod_stability_check().

static int flames_align_table_column ( cpl_table **  m_tbl,
cpl_table **  r_tbl,
const char *  col 
)
static

This procedure compares two input tables and eventually alignes them.

Parameters
m_tblmodel table on actual frame.
r_tblmodel table on reference frame
colreference column
Returns
0 if everything is ok, -1 otherwise

Definition at line 336 of file uves_physmod_stability_check.c.

References check_nomsg.

Referenced by uves_physmod_align_tables().

int uves_physmod_stability_check ( cpl_table *  m_tbl,
cpl_table *  r_tbl,
double *  med_dx,
double *  med_dy,
double *  avg_dx,
double *  avg_dy 
)

This procedure run a stability check.

Parameters
m_tblmodel table on actual frame.
r_tblmodel table on reference frame
med_dxmedian shift on X axis
med_dymedian shift on Y axis
avg_dxmean shift on X axis
avg_dymean shift on Y axis
Returns
0 if everything is ok, -1 otherwise

This procedure compares values of XMES and YMES columns from check and reference frames and computes the median of their difference.

Definition at line 152 of file uves_physmod_stability_check.c.

References check, check_nomsg, uves_msg, uves_msg_warning, and uves_physmod_align_tables().