Data Structures | |
struct | CENTROIDS |
Defines | |
#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) |
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. | |
Variables | |
static const char * | fwhm_debug_mode = NULL |
Functions used to detect and follow arc lines, compute center, width and tilt parameters.
#define XSH_SPECRES_CLIP_FRAC 0.5 |
Definition at line 76 of file xsh_follow_arclines.c.
#define XSH_SPECRES_CLIP_KAPPA 3. |
Definition at line 74 of file xsh_follow_arclines.c.
#define XSH_SPECRES_CLIP_NITER 2 |
Definition at line 75 of file xsh_follow_arclines.c.
anonymous enum |
Definition at line 84 of file xsh_follow_arclines.c.
anonymous enum |
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.
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] |
Definition at line 772 of file xsh_follow_arclines.c.
References xsh_instrument::binx, xsh_instrument::biny, check, xsh_arclist_free(), xsh_arclist_get_size(), xsh_arclist_get_wavelength(), xsh_arclist_load(), xsh_arclist_reject(), XSH_ASSURE_NOT_ILLEGAL_MSG, XSH_CALLOC, XSH_FREE, xsh_free_vector(), XSH_MALLOC, xsh_model_binxy(), xsh_model_config_load_best(), xsh_model_get_xy(), xsh_model_temperature_update_frame(), xsh_msg, xsh_msg_dbg_low, xsh_msg_dbg_medium, xsh_order_list_get_endy(), xsh_order_list_get_index_by_absorder(), xsh_order_list_get_starty(), xsh_spectralformat_list_free(), xsh_spectralformat_list_get_orders(), xsh_spectralformat_list_load(), xsh_wavesol_eval_polx(), xsh_wavesol_eval_poly(), xsh_wavesol_free(), and xsh_wavesol_load().
Referenced by xsh_follow_arclines().
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.
wavemap_frame | wave map frame | |
disptab_frame | dispersion table frame | |
instr | Instrument structure | |
tilt_list | Line tilt list frame | |
niter | number of iterations for kappa sigma clip of outliers | |
kappa | kappa value used in kappa sigma clip of outliers | |
frac | minimum fraction of detector's good pixels | |
specres_med | vector with median values of spectral resolution | |
specres_stdev | vector with stdev values of spectral resolution |
Definition at line 556 of file xsh_follow_arclines.c.
References xsh_dispersol::absorder, xsh_linetilt::cenposx, check, xsh_linetilt::deltay, xsh_linetilt::flag, get_lambda(), xsh_dispersol::lambda_poly, xsh_dispersol_list::list, xsh_linetilt_list::list, 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().
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.
pre | Scientific Frame (xsh_pre format) | |
lambda | Wavelength | |
ordnum | Order number | |
xpix | X position of the initial center (in [1,nx]) | |
y | Y position of the initial center (in [1,ny]) | |
follow_param | Parameters used to follow the line | |
is_center | parameter NOT USED!! | |
fit_res | Result of the tilt fit |
Definition at line 129 of file xsh_follow_arclines.c.
References XSH_GAUSSIAN_FIT::area, check, xsh_pre::data, first, last, M_PI, nx, xsh_pre::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(), and xsh_vector_fit_gaussian().
Referenced by find_tilt(), and xsh_follow_arclines().
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] |
Definition at line 266 of file xsh_follow_arclines.c.
References XSH_GAUSSIAN_FIT::area, CENTROIDS::area, check, detect_centroid(), FIND_TILT_BAD_CENTER, FIND_TILT_BAD_EDGES, FIND_TILT_BAD_FIT, FIND_TILT_UNKNOW_ORDER, xsh_clipping_param::frac, CENTROIDS::fwhm, fwhm_debug_mode, get_slit_ifu_lo_poly(), get_slit_ifu_up_poly(), CENTROIDS::good, xsh_order_list::list, xsh_follow_arclines_param::margin, xsh_clipping_param::niter, XSH_GAUSSIAN_FIT::peakpos, XSH_GAUSSIAN_FIT::sigma, xsh_clipping_param::sigma, xsh_follow_arclines_param::tilt_clipping, x, CENTROIDS::xpos, xsh_array_clip_poly1d(), XSH_ASSURE_NOT_NULL, XSH_CALLOC, XSH_FREE, xsh_free_polynomial(), xsh_free_vector(), xsh_msg, xsh_msg_dbg_medium, xsh_order_list_eval(), xsh_order_list_get_order(), xsh_round_double(), xsh_unwrap_vector(), and CENTROIDS::ypos.
Referenced by xsh_follow_arclines().
static float get_lambda | ( | float * | data, | |
float | x, | |||
float | y, | |||
int | nx, | |||
int | ny | |||
) | [static] |
Definition at line 513 of file xsh_follow_arclines.c.
References linear_interpol(), xsh_msg_dbg_high, and xsh_round_double().
Referenced by compute_specres().
static cpl_polynomial* get_slit_ifu_lo_poly | ( | xsh_order * | porder, | |
int | ifu_flag | |||
) | [static] |
Definition at line 228 of file xsh_follow_arclines.c.
References CENTER_IFU_SLITLET, CENTER_SLIT, xsh_order::edglopoly, LOWER_IFU_SLITLET, xsh_order::sliclopoly, xsh_order::slicuppoly, and UPPER_IFU_SLITLET.
Referenced by find_tilt().
static cpl_polynomial* get_slit_ifu_up_poly | ( | xsh_order * | porder, | |
int | ifu_flag | |||
) | [static] |
Definition at line 245 of file xsh_follow_arclines.c.
References CENTER_IFU_SLITLET, CENTER_SLIT, xsh_order::edguppoly, LOWER_IFU_SLITLET, xsh_order::sliclopoly, xsh_order::slicuppoly, and UPPER_IFU_SLITLET.
Referenced by find_tilt().
static float linear_interpol | ( | float | xa, | |
float | ya, | |||
float | xb, | |||
float | yb, | |||
float | x | |||
) | [static] |
Definition at line 504 of file xsh_follow_arclines.c.
Referenced by get_lambda().
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 | |||
) | [static] |
Definition at line 685 of file xsh_follow_arclines.c.
References check, xsh_linetilt::flag, xsh_linetilt_list::list, n, QC_RESOLMED, QC_RESOLRMS, QC_WAVECAL_CATLINE, QC_WAVECAL_DIFFYAVG, QC_WAVECAL_DIFFYMED, QC_WAVECAL_DIFFYSTD, QC_WAVECAL_FOUNDLINE, QC_WAVECAL_FWHMAVG, QC_WAVECAL_FWHMRMS, QC_WAVECAL_MATCHLINE, QC_WAVECAL_NLININT, xsh_linetilt_list::size, xsh_msg, xsh_msg_dbg_low, xsh_pfits_set_qc(), and xsh_unwrap_array().
Referenced by 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.
pre_frame | input frame in PRE format | |
arclines_frame | Input image with arcs | |
wavesol_frame | original wavesolution (from 2dmap) | |
order_frame | Order table frame | |
[in] | spectralformat_frame | The spectral format |
[in] | config_model_frame | The model configuration frame |
[in] | wavemap_frame | wavemap frame |
[in] | disptab_frame | dispersion solution frame |
[in] | follow_param | parameters to control line tilt determination |
[in] | slit | slit extension value |
[in] | slit_min | min slit value in arcsec |
[in] | slit_max | max slit value in arcsec |
[in] | tag_id | product category |
[in] | ifu_flag | flag to know if arc frame is observed in IFU mode |
[in] | instrument | instrument arm setting |
[out] | tilt_frame | line tilt table frame |
[out] | shift_frame | line shift frame |
Definition at line 972 of file xsh_follow_arclines.c.
References XSH_GAUSSIAN_FIT::area, xsh_linetilt::area, xsh_linetilt::cenposx, xsh_linetilt::cenposy, CENTER_SLIT, check, xsh_linetilt::chisq, clean_arclist_data(), compute_specres(), xsh_pre::data, xsh_instrument::decode_bp, xsh_linetilt::deltay, detect_centroid(), xsh_pre::errs, find_tilt(), xsh_clipping_param::frac, xsh_shift_tab::header, 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_shift_tab::shift_y, xsh_linetilt::shift_y, xsh_shift_tab::shift_y_cen, XSH_GAUSSIAN_FIT::sigma, xsh_clipping_param::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_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().
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.
pre_frame | input frame in PRE format | |
arclines_frame | Input image with arcs | |
wavesol_frame | original wavesolution (from 2dmap) | |
order_frame | Order table frame | |
[in] | spectralformat_frame | The spectral format |
[in] | config_model_frame | The model configuration frame |
[in] | wavemap_frame | wavemap frame |
[in] | slitmap_frame | wavemap frame |
[in] | disptab_frame | dispersion solution frame |
[in] | follow_param | parameters to control line tilt determination |
[in] | instrument | instrument arm setting |
[out] | tilt_set | line tilt table frame |
[out] | shift_frame | line shift frame |
Definition at line 1326 of file xsh_follow_arclines.c.
References check, 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().
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 1267 of file xsh_follow_arclines.c.
References CENTER_SLIT, check, and xsh_follow_arclines().
Referenced by xsh_wavecal().
const char* fwhm_debug_mode = NULL [static] |
Definition at line 82 of file xsh_follow_arclines.c.
Referenced by find_tilt().