Continuum Detection (xsh_detect_continuum)
[DRL Functions]

Data Structures

struct  gauss_res
struct  CENTROIDS_STRUCT
struct  CENTER_ORDER
struct  START_ORDER

Defines

#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::pos_x
int CENTER_ORDER::pos_y
double CENTER_ORDER::flux
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)


Define Documentation

#define BAD_POSITION_FLAG   999999

Definition at line 110 of file xsh_detect_continuum.c.

Referenced by xsh_detect_continuum().

#define THRESH_POSITION_FLAG   9999999

Definition at line 111 of file xsh_detect_continuum.c.

Referenced by xsh_detect_continuum().


Function Documentation

static cpl_frame* calculate_qc_parameters ( ORDERPOS_QC_PARAM qcparam,
xsh_instrument instrument 
) [static]
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().

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

Definition at line 418 of file xsh_detect_continuum.c.

References CENTROIDS_STRUCT::position.

Referenced by xsh_detect_continuum().

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

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

Referenced by compute_abs_order().

static cpl_frame* create_resid_tab ( xsh_instrument instrument,
ORDERPOS_QC_PARAM qcparam 
) [static]
static void cumulate_qc_parameter ( int  order,
xsh_order_list list,
CENTROIDS_STRUCT pcent,
int  npts 
) [static]
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_x Array of flux [0,n-1]
ix0 First position to search from [0,n-1]
max Size of the array
thresh minimum 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 xsh_msg, and xsh_msg_dbg_high.

Referenced by xsh_order_table_from_fmtchk().

static void fit_order_list ( xsh_order_list list,
int  npos,
CENTER_ORDER pcent,
int  degree 
) [static]
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().

static void save_centers ( CENTER_ORDER pcent,
int  fpos,
int  npos,
const char *  arm 
) [static]
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.

Referenced by xsh_order_table_from_fmtchk().

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:
pre PRE format image
iy Y position [1,ny]
ix0 X min position [1,nz]
ix1 X 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.

Referenced by xsh_order_table_from_fmtchk().

static void set_qc_parameters ( xsh_order_list list,
ORDERPOS_QC_PARAM pqc,
xsh_instrument instrument 
) [static]
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] frame The frame which contains data
[in] order_table The table data with theorical description of polynomial coefficient of centroid order or NULL
[in] spectral_frame The spectral format table frame or NULL
[in] detect_param The detect continuum parameters
[in] dcn_clipping Pointer to sigma clipping parameters
[in] instr The instrument settings
[out] resid_frame table 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 502 of file xsh_detect_continuum.c.

References xsh_order::absorder, assure, BAD_POSITION_FLAG, calculate_qc_parameters(), xsh_order::cenpoly, gauss_res::centroid, check, 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, xsh_order::starty, starty, step, THRESH_POSITION_FLAG, x, xsh_add_temporary_file(), 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_dump(), 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().

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* xsh_order_table_from_fmtchk ( xsh_pre pre,
cpl_frame *  spectral_frame,
xsh_detect_continuum_param detect_param,
xsh_instrument instrument 
)

Variable Documentation

int DeltaPoints = 0 [static]
double* Deltas = NULL [static]
int DeltaSize = 0 [static]

Definition at line 257 of file xsh_detect_continuum.c.

Referenced by cumulate_qc_parameter().

double CENTER_ORDER::flux [inherited]
int Nb_nofit [static]

Definition at line 96 of file xsh_detect_continuum.c.

Referenced by xsh_detect_continuum(), and xsh_fit_gaussian().

int Nb_noflux [static]

Definition at line 96 of file xsh_detect_continuum.c.

Referenced by xsh_detect_continuum(), and xsh_fit_gaussian().

int* Orders = NULL [static]
int CENTER_ORDER::pos_x [inherited]
int CENTER_ORDER::pos_y [inherited]
double * PosX = NULL [static]
double * PosY = NULL [static]
int START_ORDER::start_x [inherited]

Definition at line 66 of file xsh_order_table_from_fmtchk.c.

double * XorderPos = NULL [static]

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