X-shooter Pipeline Reference Manual 3.8.15
Data Structures | Macros | Enumerations | Functions
xsh_follow_arclines

Data Structures

struct  CENTROIDS
 

Macros

#define XSH_SPECRES_CLIP_KAPPA   3.
 
#define XSH_SPECRES_CLIP_NITER   2
 
#define XSH_SPECRES_CLIP_FRAC   0.5
 

Enumerations

enum  { LAMBDA_FOUND , LAMBDA_TOO_SMALL , LAMBDA_NOT_FOUND }
 
enum  {
  FIND_TILT_UNKNOW_ORDER = 1 , FIND_TILT_BAD_EDGES , FIND_TILT_BAD_CENTER , FIND_TILT_CLIPPED ,
  FIND_TILT_BAD_FIT
}
 

Functions

static int detect_centroid (xsh_pre *pre, float lambda, int ordnum, double xpix, double ypix, xsh_follow_arclines_param *follow_param, int is_center, XSH_GAUSSIAN_FIT *fit_res)
 
static cpl_polynomial * get_slit_ifu_lo_poly (xsh_order *porder, int ifu_flag)
 
static cpl_polynomial * get_slit_ifu_up_poly (xsh_order *porder, int ifu_flag)
 
static int find_tilt (double yp0, double xc, float lambda, int ordnum, xsh_follow_arclines_param *follow_param, xsh_pre *pre, xsh_order_list *orders, xsh_instrument *instrument, double *slope, double *chisq, double *minx, double *maxx, int *nt, int *ng, double *fwhm_center, double *good_center, int ifu_flag)
 
static float linear_interpol (float xa, float ya, float xb, float yb, float x)
 
static float get_lambda (float *data, float x, float y, int nx, int ny)
 
static void compute_specres (cpl_frame *wavemap_frame, cpl_frame *disptab_frame, xsh_instrument *instr, xsh_linetilt_list *tilt_list, int niter, double kappa, double frac, double *specres_med, double *specres_stdev)
 
static void set_qc_parameters (cpl_propertylist *tilt_header, cpl_propertylist *shift_header, double *ypos, double *width, double *intens, xsh_linetilt_list *tilt_list, xsh_instrument *instrument, int nlinecat, int nb_lines, double specres_med, double specres_stdev, float exptime)
 
static void clean_arclist_data (cpl_frame *wavesol_frame, cpl_frame *arclines_frame, xsh_order_list *orders, cpl_frame *config_model_frame, cpl_frame *pre_frame, cpl_frame *spectralformat_frame, double **lambda, double **n, double **x, double **y, double **xmin, double **xmax, int *size, double slit, double slit_min, double slit_max, xsh_instrument *instrument)
 
static void xsh_follow_arclines (cpl_frame *pre_frame, cpl_frame *arclines_frame, cpl_frame *wavesol_frame, cpl_frame *order_frame, cpl_frame *spectralformat_frame, cpl_frame *config_model_frame, cpl_frame *wavemap_frame, cpl_frame *disptab_frame, xsh_follow_arclines_param *follow_param, double slit, double slit_min, double slit_max, const char *tag_id, int ifu_flag, xsh_instrument *instrument, cpl_frame **tilt_frame, cpl_frame **shift_frame, const int clean_tmp)
 Detect and follow arc lines. Computes center, width and tilt parameters. The position of the center of each line is computed using the wavesol table, with arguments: lambda, order and slit. lambda is taken from the arclines table, order and slit is taken from the theoretical table.
 
void xsh_follow_arclines_slit (cpl_frame *pre_frame, cpl_frame *arclines_frame, cpl_frame *wavesol_frame, cpl_frame *order_frame, cpl_frame *spectralformat_frame, cpl_frame *config_model_frame, cpl_frame *wavemap_frame, cpl_frame *slitmap_frame, cpl_frame *disptab_frame, xsh_follow_arclines_param *follow_param, xsh_instrument *instrument, cpl_frame **tilt_frame, cpl_frame **shift_frame)
 
void xsh_follow_arclines_ifu (cpl_frame *pre_frame, cpl_frame *arclines_frame, cpl_frame *wavesol_frame, cpl_frame *order_frame, cpl_frame *spectralformat_frame, cpl_frame *config_model_frame, cpl_frame *wavemap_frame, cpl_frame *slitmap_frame, cpl_frame *disptab_frame, xsh_follow_arclines_param *follow_param, xsh_instrument *instrument, cpl_frameset *tilt_set, cpl_frame **shift_frame)
 Detect and follow arc lines. Computes center, width and tilt parameters. The position of the center of each line is computed using the wavesol table, with arguments: lambda, order and slit. lambda is taken from the arclines table, order and slit is taken from the theoretical table.
 

Detailed Description

Functions used to detect and follow arc lines, compute center, width and tilt parameters.

Macro Definition Documentation

◆ XSH_SPECRES_CLIP_FRAC

#define XSH_SPECRES_CLIP_FRAC   0.5

Definition at line 76 of file xsh_follow_arclines.c.

◆ XSH_SPECRES_CLIP_KAPPA

#define XSH_SPECRES_CLIP_KAPPA   3.

Definition at line 74 of file xsh_follow_arclines.c.

◆ XSH_SPECRES_CLIP_NITER

#define XSH_SPECRES_CLIP_NITER   2

Definition at line 75 of file xsh_follow_arclines.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
LAMBDA_FOUND 
LAMBDA_TOO_SMALL 
LAMBDA_NOT_FOUND 

Definition at line 84 of file xsh_follow_arclines.c.

◆ anonymous enum

anonymous enum
Enumerator
FIND_TILT_UNKNOW_ORDER 
FIND_TILT_BAD_EDGES 
FIND_TILT_BAD_CENTER 
FIND_TILT_CLIPPED 
FIND_TILT_BAD_FIT 

Definition at line 88 of file xsh_follow_arclines.c.

Function Documentation

◆ clean_arclist_data()

static void clean_arclist_data ( cpl_frame *  wavesol_frame,
cpl_frame *  arclines_frame,
xsh_order_list orders,
cpl_frame *  config_model_frame,
cpl_frame *  pre_frame,
cpl_frame *  spectralformat_frame,
double **  lambda,
double **  n,
double **  x,
double **  y,
double **  xmin,
double **  xmax,
int *  size,
double  slit,
double  slit_min,
double  slit_max,
xsh_instrument instrument 
)
static

◆ compute_specres()

static void compute_specres ( cpl_frame *  wavemap_frame,
cpl_frame *  disptab_frame,
xsh_instrument instr,
xsh_linetilt_list tilt_list,
int  niter,
double  kappa,
double  frac,
double *  specres_med,
double *  specres_stdev 
)
static

Compute the spectral resolution using the wave map.

Parameters
wavemap_framewave map frame
disptab_framedispersion table frame
instrInstrument structure
tilt_listLine tilt list frame
niternumber of iterations for kappa sigma clip of outliers
kappakappa value used in kappa sigma clip of outliers
fracminimum fraction of detector's good pixels
specres_medvector with median values of spectral resolution
specres_stdevvector with stdev values of spectral resolution

Definition at line 558 of file xsh_follow_arclines.c.

References xsh_dispersol::absorder, xsh_linetilt::cenposx, check, xsh_linetilt::deltay, xsh_linetilt::flag, get_lambda(), kappa, xsh_dispersol::lambda_poly, xsh_dispersol_list::list, xsh_linetilt_list::list, niter, nx, ny, xsh_linetilt::order, xsh_linetilt_list::size, xsh_linetilt::specres, xsh_linetilt::tilt, xsh_linetilt::tilt_y, xsh_linetilt::wavelength, xsh_array_clip_median(), XSH_ASSURE_NOT_NULL, xsh_dispersol_list_eval(), xsh_dispersol_list_free(), xsh_dispersol_list_load(), xsh_free_array(), xsh_free_image(), xsh_free_vector(), xsh_msg, and xsh_msg_dbg_high.

Referenced by xsh_follow_arclines().

◆ detect_centroid()

static int detect_centroid ( xsh_pre pre,
float  lambda,
int  ordnum,
double  xpix,
double  y,
xsh_follow_arclines_param follow_param,
int  is_center,
XSH_GAUSSIAN_FIT fit_res 
)
static

Along the X axis, detect the centers of the line, fit the centers to get the tilt.

Parameters
preScientific Frame (xsh_pre format)
lambdaWavelength
ordnumOrder number
xpixX position of the initial center (in [1,nx])
yY position of the initial center (in [1,ny])
follow_paramParameters used to follow the line
is_centerparameter NOT USED!!
fit_resResult of the tilt fit
Returns
0 if OK, 1 otherwise (can not fit)

Definition at line 129 of file xsh_follow_arclines.c.

References XSH_GAUSSIAN_FIT::area, check, xsh_pre::data, first, last, M_PI, xsh_pre::nx, nx, xsh_pre::ny, ny, XSH_GAUSSIAN_FIT::offset, XSH_GAUSSIAN_FIT::peakpos, xsh_follow_arclines_param::range, XSH_GAUSSIAN_FIT::sigma, x, XSH_ASSURE_NOT_ILLEGAL, xsh_debug_level_get(), XSH_DEBUG_LEVEL_HIGH, xsh_free_vector(), xsh_msg_dbg_high, xsh_msg_dbg_low, xsh_msg_dbg_medium, xsh_round_double(), xsh_vector_fit_gaussian(), and y.

Referenced by find_tilt(), and xsh_follow_arclines().

◆ find_tilt()

static int find_tilt ( double  yp0,
double  xc,
float  lambda,
int  ordnum,
xsh_follow_arclines_param follow_param,
xsh_pre pre,
xsh_order_list orders,
xsh_instrument instrument,
double *  slope,
double *  chisq,
double *  minx,
double *  maxx,
int *  nt,
int *  ng,
double *  fwhm_center,
double *  good_center,
int  ifu_flag 
)
static

◆ get_lambda()

static float get_lambda ( float *  data,
float  x,
float  y,
int  nx,
int  ny 
)
static

Definition at line 515 of file xsh_follow_arclines.c.

References linear_interpol(), nx, ny, x, xsh_msg_dbg_high, xsh_round_double(), and y.

Referenced by compute_specres().

◆ get_slit_ifu_lo_poly()

static cpl_polynomial * get_slit_ifu_lo_poly ( xsh_order porder,
int  ifu_flag 
)
static

◆ get_slit_ifu_up_poly()

static cpl_polynomial * get_slit_ifu_up_poly ( xsh_order porder,
int  ifu_flag 
)
static

◆ linear_interpol()

static float linear_interpol ( float  xa,
float  ya,
float  xb,
float  yb,
float  x 
)
static

Definition at line 506 of file xsh_follow_arclines.c.

References x.

Referenced by get_lambda().

◆ set_qc_parameters()

static void set_qc_parameters ( cpl_propertylist *  tilt_header,
cpl_propertylist *  shift_header,
double *  ypos,
double *  width,
double *  intens,
xsh_linetilt_list tilt_list,
xsh_instrument instrument,
int  nlinecat,
int  nb_lines,
double  specres_med,
double  specres_stdev,
float  exptime 
)
static

◆ xsh_follow_arclines()

static void xsh_follow_arclines ( cpl_frame *  pre_frame,
cpl_frame *  arclines_frame,
cpl_frame *  wavesol_frame,
cpl_frame *  order_frame,
cpl_frame *  spectralformat_frame,
cpl_frame *  config_model_frame,
cpl_frame *  wavemap_frame,
cpl_frame *  disptab_frame,
xsh_follow_arclines_param follow_param,
double  slit,
double  slit_min,
double  slit_max,
const char *  tag_id,
int  ifu_flag,
xsh_instrument instrument,
cpl_frame **  tilt_frame,
cpl_frame **  shift_frame,
const int  clean_tmp 
)
static

Detect and follow arc lines. Computes center, width and tilt parameters. The position of the center of each line is computed using the wavesol table, with arguments: lambda, order and slit. lambda is taken from the arclines table, order and slit is taken from the theoretical table.

Parameters
pre_frameinput frame in PRE format
arclines_frameInput image with arcs
wavesol_frameoriginal wavesolution (from 2dmap)
order_frameOrder table frame
[in]spectralformat_frameThe spectral format
[in]config_model_frameThe model configuration frame
[in]wavemap_framewavemap frame
[in]disptab_framedispersion solution frame
[in]follow_paramparameters to control line tilt determination
[in]slitslit extension value
[in]slit_minmin slit value in arcsec
[in]slit_maxmax slit value in arcsec
[in]tag_idproduct category
[in]ifu_flagflag to know if arc frame is observed in IFU mode
[in]instrumentinstrument arm setting
[out]tilt_frameline tilt table frame
[out]shift_frameline shift frame

Definition at line 985 of file xsh_follow_arclines.c.

References xsh_linetilt::area, XSH_GAUSSIAN_FIT::area, xsh_linetilt::cenposx, xsh_linetilt::cenposy, CENTER_SLIT, check, xsh_linetilt::chisq, clean_arclist_data(), compute_specres(), xsh_pre::data, xsh_pre::data_header, xsh_instrument::decode_bp, xsh_linetilt::deltay, detect_centroid(), xsh_pre::errs, xsh_pre::exptime, find_tilt(), xsh_clipping_param::frac, xsh_shift_tab::header, instrument, xsh_linetilt::intensity, xsh_linetilt::name, xsh_linetilt::ngood, xsh_clipping_param::niter, xsh_linetilt::ntot, nx, ny, xsh_linetilt::order, order, XSH_GAUSSIAN_FIT::peakpos, xsh_linetilt::pre_pos_y, QC_WAVECAL_CATLINE, QC_WAVECAL_FOUNDLINE, QC_WAVECAL_MATCHLINE, xsh_pre::qual, xsh_follow_arclines_param::s_n_min, set_qc_parameters(), xsh_linetilt::shift_y, xsh_shift_tab::shift_y, xsh_shift_tab::shift_y_cen, xsh_clipping_param::sigma, XSH_GAUSSIAN_FIT::sigma, xsh_linetilt_list::size, xsh_linetilt::slit, xsh_linetilt::specres, xsh_follow_arclines_param::specres_clipping, xsh_linetilt::tilt, xsh_linetilt::tilt_y, xsh_linetilt::wavelength, width, xsh_linetilt::xmax, xsh_linetilt::xmin, xsh_add_temporary_file(), XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_NULL, XSH_CALLOC, XSH_FREE, XSH_GET_TAG_FROM_ARM, xsh_instrument_arm_tostring(), xsh_linetilt_list_add(), xsh_linetilt_list_free(), xsh_linetilt_list_new(), xsh_linetilt_list_save(), xsh_linetilt_new(), xsh_msg, xsh_msg_dbg_low, xsh_msg_error, xsh_order_list_free(), xsh_order_list_load(), xsh_pfits_set_qc(), xsh_pfits_set_qc_slit_width(), xsh_pre_free(), xsh_pre_load(), xsh_round_double(), xsh_set_image_cpl_bpmap(), xsh_shift_tab_create(), xsh_shift_tab_free(), xsh_shift_tab_save(), XSH_SHIFT_TAB_SLIT, and xsh_unwrap_vector().

Referenced by xsh_follow_arclines_ifu(), and xsh_follow_arclines_slit().

◆ xsh_follow_arclines_ifu()

void xsh_follow_arclines_ifu ( cpl_frame *  pre_frame,
cpl_frame *  arclines_frame,
cpl_frame *  wavesol_frame,
cpl_frame *  order_frame,
cpl_frame *  spectralformat_frame,
cpl_frame *  config_model_frame,
cpl_frame *  wavemap_frame,
cpl_frame *  slitmap_frame,
cpl_frame *  disptab_frame,
xsh_follow_arclines_param follow_param,
xsh_instrument instrument,
cpl_frameset *  tilt_set,
cpl_frame **  shift_frame 
)

Detect and follow arc lines. Computes center, width and tilt parameters. The position of the center of each line is computed using the wavesol table, with arguments: lambda, order and slit. lambda is taken from the arclines table, order and slit is taken from the theoretical table.

Parameters
pre_frameinput frame in PRE format
arclines_frameInput image with arcs
wavesol_frameoriginal wavesolution (from 2dmap)
order_frameOrder table frame
[in]spectralformat_frameThe spectral format
[in]config_model_frameThe model configuration frame
[in]wavemap_framewavemap frame
[in]slitmap_framewavemap frame
[in]disptab_framedispersion solution frame
[in]follow_paramparameters to control line tilt determination
[in]instrumentinstrument arm setting
[out]tilt_setline tilt table frame
[out]shift_frameline shift frame

Definition at line 1341 of file xsh_follow_arclines.c.

References check, instrument, LOWER_IFU_SLITLET, xsh_shift_tab::shift_y_cen, xsh_shift_tab::shift_y_down, xsh_shift_tab::shift_y_up, SlitletName, UPPER_IFU_SLITLET, XSH_ASSURE_NOT_NULL, xsh_follow_arclines(), xsh_free_frameset(), xsh_get_slit_edges(), XSH_GET_TAG_FROM_ARM, xsh_msg, xsh_msg_dbg_medium, xsh_shift_tab_free(), XSH_SHIFT_TAB_IFU, xsh_shift_tab_load(), and xsh_shift_tab_save().

Referenced by xsh_wavecal().

◆ xsh_follow_arclines_slit()

void xsh_follow_arclines_slit ( cpl_frame *  pre_frame,
cpl_frame *  arclines_frame,
cpl_frame *  wavesol_frame,
cpl_frame *  order_frame,
cpl_frame *  spectralformat_frame,
cpl_frame *  config_model_frame,
cpl_frame *  wavemap_frame,
cpl_frame *  slitmap_frame,
cpl_frame *  disptab_frame,
xsh_follow_arclines_param follow_param,
xsh_instrument instrument,
cpl_frame **  tilt_frame,
cpl_frame **  shift_frame 
)

Definition at line 1282 of file xsh_follow_arclines.c.

References CENTER_SLIT, check, instrument, and xsh_follow_arclines().

Referenced by xsh_wavecal().