X-shooter Pipeline Reference Manual 3.8.15
Data Structures | Macros | Functions | Variables
Continuum Detection (xsh_detect_continuum)

Data Structures

struct  gauss_res
 
struct  CENTROIDS_STRUCT
 
struct  CENTER_ORDER
 
struct  START_ORDER
 

Macros

#define BAD_POSITION_FLAG   999999
 
#define THRESH_POSITION_FLAG   9999999
 

Functions

static cpl_error_code xsh_fit_gaussian (xsh_detect_continuum_param *detect_param, int x, int y, int nx, float *data, float *p_errs, struct gauss_res *result, xsh_instrument *instrument, int order, double threshold)
 
static cpl_frame * create_resid_tab (xsh_instrument *instrument, ORDERPOS_QC_PARAM *qcparam)
 
static void cumulate_qc_parameter (int order, xsh_order_list *list, CENTROIDS_STRUCT *pcent, int npts)
 
static cpl_frame * calculate_qc_parameters (ORDERPOS_QC_PARAM *qcparam, xsh_instrument *instrument)
 
static int comp_pos (const void *un, const void *deux)
 
static void set_qc_parameters (xsh_order_list *list, ORDERPOS_QC_PARAM *pqc, xsh_instrument *instrument)
 
cpl_frame * xsh_detect_continuum (cpl_frame *frame, cpl_frame *order_table, cpl_frame *spectral_frame, xsh_detect_continuum_param *detect_param, xsh_clipping_param *dcn_clipping, xsh_instrument *instr, cpl_frame **resid_frame)
 Detect order and compute polynomial description of ordermin and order max. Uses a guess order table if available. If not, tries to compute one (see function xsh_order_table_from_fmtchk).
 
static void compute_dist_pixel (int *xdisp, int *pdist, int dist_order, int first, int last)
 
static int compute_abs_order (START_ORDER *start_x, int nb, cpl_frame *spectral_frame, xsh_detect_continuum_param *detect_param, xsh_instrument *instrument)
 
static void invert_startx (START_ORDER *pstart, int nb)
 
static int comp_center (const void *one, const void *two)
 
static int find_maximum (int *found, double *pos_x, int ix0, int max, double thresh)
 
static int search_max (xsh_pre *pre, int iy, int ix0, int ix1)
 
static void save_centers (CENTER_ORDER *pcent, int fpos, int npos, const char *arm)
 
static void save_pos_x (double *posx, int size, const char *arm)
 
static void fit_order_list (xsh_order_list *list, int npos, CENTER_ORDER *pcent, int degree)
 
cpl_frame * xsh_order_table_from_fmtchk (xsh_pre *pre, cpl_frame *spectral_frame, xsh_detect_continuum_param *detect_param, xsh_instrument *instrument)
 

Variables

static int Nb_noflux
 
static int Nb_nofit
 
static double * Deltas = NULL
 
static double * PosY = NULL
 
static double * PosX = NULL
 
static double * XorderPos = NULL
 
static int * Orders = NULL
 
static int DeltaSize = 0
 
static int DeltaPoints = 0
 
int CENTER_ORDER::order
 
int CENTER_ORDER::pos_x
 
int CENTER_ORDER::pos_y
 
double CENTER_ORDER::flux
 
int START_ORDER::absorder
 
int START_ORDER::start_x
 

Detailed Description

Functions used to detect orders and compute polynomial description of min and max edges (in recipe xsh_orderpos)

Macro Definition Documentation

◆ BAD_POSITION_FLAG

#define BAD_POSITION_FLAG   999999

Definition at line 110 of file xsh_detect_continuum.c.

◆ THRESH_POSITION_FLAG

#define THRESH_POSITION_FLAG   9999999

Definition at line 111 of file xsh_detect_continuum.c.

Function Documentation

◆ calculate_qc_parameters()

static cpl_frame * calculate_qc_parameters ( ORDERPOS_QC_PARAM qcparam,
xsh_instrument instrument 
)
static

◆ comp_center()

static int comp_center ( const void *  one,
const void *  two 
)
static

Definition at line 244 of file xsh_order_table_from_fmtchk.c.

References first, and CENTER_ORDER::order.

Referenced by xsh_order_table_from_fmtchk().

◆ comp_pos()

static int comp_pos ( const void *  un,
const void *  deux 
)
static

Definition at line 423 of file xsh_detect_continuum.c.

References CENTROIDS_STRUCT::position.

Referenced by xsh_detect_continuum().

◆ compute_abs_order()

static int compute_abs_order ( START_ORDER start_x,
int  nb,
cpl_frame *  spectral_frame,
xsh_detect_continuum_param detect_param,
xsh_instrument instrument 
)
static

< Array of abs orders from spectral table

< Array of inetr order distances from ...

< Nb of orders in the spectral table

< The 'reddest' order (highest lambdas)

Definition at line 101 of file xsh_order_table_from_fmtchk.c.

References check, compute_dist_pixel(), xsh_instrument::config, xsh_spectralformat_list::dist_order, xsh_detect_continuum_param::dist_order, instrument, XSH_INSTRCONFIG::orders, xsh_spectralformat_list::size, XSH_ASSURE_NOT_ILLEGAL_MSG, XSH_CALLOC, XSH_FREE, xsh_instrument_get_arm(), xsh_msg, xsh_spectralformat_list_free(), and xsh_spectralformat_list_load().

Referenced by xsh_order_table_from_fmtchk().

◆ compute_dist_pixel()

static void compute_dist_pixel ( int *  xdisp,
int *  pdist,
int  dist_order,
int  first,
int  last 
)
static

Definition at line 86 of file xsh_order_table_from_fmtchk.c.

References first, last, pdist, and xsh_msg.

Referenced by compute_abs_order().

◆ create_resid_tab()

static cpl_frame * create_resid_tab ( xsh_instrument instrument,
ORDERPOS_QC_PARAM qcparam 
)
static

◆ cumulate_qc_parameter()

static void cumulate_qc_parameter ( int  order,
xsh_order_list list,
CENTROIDS_STRUCT pcent,
int  npts 
)
static

◆ find_maximum()

static int find_maximum ( int *  found,
double *  pos_x,
int  ix0,
int  max,
double  thresh 
)
static

Search a maximum in the pos_x array. The returned value is the INDEX in the array ==> [0,n-1].

Parameters
found????
pos_xArray of flux [0,n-1]
ix0First position to search from [0,n-1]
maxSize of the array
threshminimum threshold
Returns
-1 if no maximum found, the index in the array [0,max-1]

Definition at line 266 of file xsh_order_table_from_fmtchk.c.

References max, xsh_msg, and xsh_msg_dbg_high.

Referenced by xsh_order_table_from_fmtchk().

◆ fit_order_list()

static void fit_order_list ( xsh_order_list list,
int  npos,
CENTER_ORDER pcent,
int  degree 
)
static

◆ invert_startx()

static void invert_startx ( START_ORDER pstart,
int  nb 
)
static

Definition at line 228 of file xsh_order_table_from_fmtchk.c.

References XSH_CALLOC.

Referenced by xsh_order_table_from_fmtchk().

◆ save_centers()

static void save_centers ( CENTER_ORDER pcent,
int  fpos,
int  npos,
const char *  arm 
)
static

◆ save_pos_x()

static void save_pos_x ( double *  posx,
int  size,
const char *  arm 
)
static

Definition at line 386 of file xsh_order_table_from_fmtchk.c.

References size.

Referenced by xsh_order_table_from_fmtchk().

◆ search_max()

static int search_max ( xsh_pre pre,
int  iy,
int  ix0,
int  ix1 
)
static

Search the maximum in the intervall [ix0,ix1] at iy. Pixels are in the [1,n] space.

Parameters
prePRE format image
iyY position [1,ny]
ix0X min position [1,nz]
ix1X max position [1,nx]
Returns
The position of the maximum [1,n]

Definition at line 317 of file xsh_order_table_from_fmtchk.c.

References xsh_pre::data, and max.

Referenced by xsh_order_table_from_fmtchk().

◆ set_qc_parameters()

static void set_qc_parameters ( xsh_order_list list,
ORDERPOS_QC_PARAM pqc,
xsh_instrument instrument 
)
static

◆ xsh_detect_continuum()

cpl_frame * xsh_detect_continuum ( cpl_frame *  frame,
cpl_frame *  order_table,
cpl_frame *  spectral_frame,
xsh_detect_continuum_param detect_param,
xsh_clipping_param dcn_clipping,
xsh_instrument instr,
cpl_frame **  resid_frame 
)

Detect order and compute polynomial description of ordermin and order max. Uses a guess order table if available. If not, tries to compute one (see function xsh_order_table_from_fmtchk).

Parameters
[in]frameThe frame which contains data
[in]order_tableThe table data with theorical description of polynomial coefficient of centroid order or NULL
[in]spectral_frameThe spectral format table frame or NULL
[in]detect_paramThe detect continuum parameters
[in]dcn_clippingPointer to sigma clipping parameters
[in]instrThe instrument settings
[out]resid_frametable frame with measured residuals
Returns
Frame containing order table

< PRE structure loaded from input frame

< Array of pixel values input image

< Array of pixel errors input image

< Nb of detected orders

Definition at line 507 of file xsh_detect_continuum.c.

References xsh_order::absorder, assure, BAD_POSITION_FLAG, calculate_qc_parameters(), xsh_order::cenpoly, gauss_res::centroid, check, check_msg, comp_pos(), cumulate_qc_parameter(), xsh_pre::data, degree, DeltaPoints, xsh_order::endy, xsh_pre::errs, xsh_detect_continuum_param::fit_threshold, xsh_detect_continuum_param::fit_window, xsh_clipping_param::frac, xsh_order_list::header, xsh_order_list::list, ORDERPOS_QC_PARAM::max_pred, ORDERPOS_QC_PARAM::min_pred, mm, Nb_nofit, Nb_noflux, ORDERPOS_QC_PARAM::ndet, niter, xsh_clipping_param::niter, ORDERPOS_QC_PARAM::nposall, ORDERPOS_QC_PARAM::npossel, ORDERPOS_QC_PARAM::npred, xsh_pre::nx, nx, xsh_pre::ny, xsh_detect_continuum_param::poly_degree, xsh_detect_continuum_param::poly_step, xsh_clipping_param::res_max, xsh_detect_continuum_param::search_window, set_qc_parameters(), gauss_res::sigma, xsh_clipping_param::sigma, xsh_order_list::size, starty, xsh_order::starty, step, THRESH_POSITION_FLAG, x, XSH_ASSURE_NOT_NULL, xsh_debug_level_get(), XSH_DEBUG_LEVEL_HIGH, xsh_fit_gaussian(), XSH_FREE, xsh_free_polynomial(), xsh_free_propertylist(), xsh_free_vector(), XSH_GET_TAG_FROM_ARM, XSH_MALLOC, xsh_msg, xsh_msg_dbg_high, xsh_msg_dbg_low, xsh_msg_dbg_medium, xsh_msg_warning, XSH_NEW_PROPERTYLIST, xsh_order_list_free(), xsh_order_list_load(), xsh_order_list_save(), xsh_order_list_verify(), XSH_ORDER_TAB_CENTR, xsh_polynomial_fit_1d_create(), xsh_pre_free(), xsh_pre_get_ny(), xsh_pre_load(), and y.

Referenced by main(), and xsh_orderpos().

◆ xsh_fit_gaussian()

static cpl_error_code xsh_fit_gaussian ( xsh_detect_continuum_param detect_param,
int  x,
int  y,
int  nx,
float *  data,
float *  p_errs,
struct gauss_res result,
xsh_instrument instrument,
int  order,
double  threshold 
)
static

◆ xsh_order_table_from_fmtchk()

cpl_frame * xsh_order_table_from_fmtchk ( xsh_pre pre,
cpl_frame *  spectral_frame,
xsh_detect_continuum_param detect_param,
xsh_instrument instrument 
)

Variable Documentation

◆ absorder

int START_ORDER::absorder

Definition at line 65 of file xsh_order_table_from_fmtchk.c.

◆ DeltaPoints

int DeltaPoints = 0
static

◆ Deltas

double* Deltas = NULL
static

◆ DeltaSize

int DeltaSize = 0
static

Definition at line 259 of file xsh_detect_continuum.c.

Referenced by cumulate_qc_parameter().

◆ flux

double CENTER_ORDER::flux

◆ Nb_nofit

int Nb_nofit
static

Definition at line 96 of file xsh_detect_continuum.c.

Referenced by xsh_detect_continuum(), and xsh_fit_gaussian().

◆ Nb_noflux

int Nb_noflux
static

Definition at line 96 of file xsh_detect_continuum.c.

Referenced by xsh_detect_continuum(), and xsh_fit_gaussian().

◆ order

int CENTER_ORDER::order

◆ Orders

int* Orders = NULL
static

◆ pos_x

int CENTER_ORDER::pos_x

◆ pos_y

int CENTER_ORDER::pos_y

◆ PosX

double * PosX = NULL
static

◆ PosY

double * PosY = NULL
static

◆ start_x

int START_ORDER::start_x

Definition at line 66 of file xsh_order_table_from_fmtchk.c.

◆ XorderPos

double * XorderPos = NULL
static