Defines | |
#define | REGDEBUG_MEDIAN_SPLINE 0 |
Functions | |
static void | fit_spline (xsh_wavemap_list *wave_list, int idx, int nbkpts, int order, int niter, float kappa, float ron2, float gain, const char *sarm) |
static xsh_wavemap_list * | xsh_wavemap_list_new (cpl_image *wavemap, cpl_image *slitmap, xsh_localization *list, xsh_order_list *order_table, xsh_pre *pre_sci, int nbkpts, cpl_frame *usr_defined_break_points_frame, xsh_subtract_sky_single_param *sky_par, xsh_instrument *instrument) |
static xsh_rec_list * | xsh_wavemap_list_build_sky (xsh_wavemap_list *wave_list, xsh_pre *pre_mflat, xsh_instrument *instr) |
Build the sky spectrum list. | |
static int | wave_compare (const void *un, const void *deux) |
static cpl_frame * | xsh_wavelist_subtract_sky (xsh_pre *pre_sci, xsh_pre *pre_mflat, xsh_rec_list *sky_list, xsh_wavemap_list *wave_list, xsh_instrument *instrument, const char *rec_prefix) |
subtract sky | |
static int | xsh_bspline_eval_all (const double x, gsl_vector *B, size_t *idx, gsl_bspline_workspace *w, size_t *start_i) |
static size_t | xsh_bspline_find_interval (const double x, int *flag, gsl_bspline_workspace *w, size_t *start_i) |
static cpl_error_code | xsh_mflat_normalize (xsh_order_list *order_table, xsh_pre *pre_mflat) |
Normalize the master flat to the value at the center of the slit on each order and Y position. | |
cpl_frame * | xsh_subtract_sky_single (cpl_frame *sci_frame, cpl_frame *order_table_frame, cpl_frame *slitmap_frame, cpl_frame *wavemap_frame, cpl_frame *loc_table_frame, cpl_frame *mflat_frame, cpl_frame *usr_defined_break_points_frame, xsh_instrument *instrument, int nbkpts, xsh_subtract_sky_single_param *sky_par, cpl_frame **sky_spectrum, cpl_frame **sky_spectrum_eso, const char *rec_prefix, const int clean_tmp) |
Subtract the sky background for single frame. If sky_spectrum is NOT NULL it is saved as a product, of type REC. | |
cpl_frame * | xsh_save_sky_model (cpl_frame *obj_frame, cpl_frame *sub_sky_frame, const char *sky_tag, xsh_instrument *instrument) |
cpl_frame * | xsh_add_sky_model (cpl_frame *subsky_frame, cpl_frame *sky_frame, xsh_instrument *instrument, const char *prefix) |
Variables | |
double | xsh_nbkpts_uvb [XSH_ORDERS_UVB] |
Create the wavemap list. | |
double | xsh_nbkpts_vis [XSH_ORDERS_VIS] |
double | xsh_nbkpts_nir [XSH_ORDERS_NIR] |
Function ...
#define REGDEBUG_MEDIAN_SPLINE 0 |
Definition at line 74 of file xsh_subtract_sky_single.c.
void fit_spline | ( | xsh_wavemap_list * | wave_list, | |
int | idx, | |||
int | nbkpts, | |||
int | order, | |||
int | niter, | |||
float | kappa, | |||
float | ron2, | |||
float | gain, | |||
const char * | sarm | |||
) | [static] |
Definition at line 119 of file xsh_subtract_sky_single.c.
References check, wavemap_item::fit_err, wavemap_item::fitted, wavemap_item::flux, wavemap_item::ix, wavemap_item::iy, wavemap_item::lambda, lambda_fit(), xsh_wavemap::lambda_max, xsh_wavemap::lambda_min, xsh_wavemap_list::list, xsh_wavemap::order, order, wavemap_item::sigma, xsh_wavemap::sky, xsh_wavemap::sky_size, XSH_ASSURE_NOT_NULL, xsh_bspline_eval_all(), xsh_debug_level_get(), XSH_DEBUG_LEVEL_HIGH, XSH_DEBUG_LEVEL_LOW, xsh_free_table(), xsh_msg_dbg_medium, xsh_msg_debug, and y.
Referenced by xsh_wavemap_list_new().
static int wave_compare | ( | const void * | un, | |
const void * | deux | |||
) | [static] |
Definition at line 450 of file xsh_subtract_sky_single.c.
References wavemap_item::lambda.
Referenced by xsh_wavemap_list_new().
cpl_frame* xsh_add_sky_model | ( | cpl_frame * | subsky_frame, | |
cpl_frame * | sky_frame, | |||
xsh_instrument * | instrument, | |||
const char * | prefix | |||
) |
Definition at line 1586 of file xsh_subtract_sky_single.c.
References check, xsh_pre::data, xsh_free_image(), xsh_instrument_arm_tostring(), xsh_pre_free(), xsh_pre_load(), and xsh_pre_save().
Referenced by xsh_slit_stare_correct_crh_and_sky().
static int xsh_bspline_eval_all | ( | const double | x, | |
gsl_vector * | B, | |||
size_t * | idx, | |||
gsl_bspline_workspace * | w, | |||
size_t * | start_i | |||
) | [static] |
Definition at line 1454 of file xsh_subtract_sky_single.c.
References xsh_bspline_find_interval().
Referenced by fit_spline().
static size_t xsh_bspline_find_interval | ( | const double | x, | |
int * | flag, | |||
gsl_bspline_workspace * | w, | |||
size_t * | start_i | |||
) | [static] |
Definition at line 1518 of file xsh_subtract_sky_single.c.
Referenced by xsh_bspline_eval_all().
static cpl_error_code xsh_mflat_normalize | ( | xsh_order_list * | order_table, | |
xsh_pre * | pre_mflat | |||
) | [static] |
Normalize the master flat to the value at the center of the slit on each order and Y position.
[in] | order_table | Edge order table list |
[in] | pre_mflat | Master flat image |
Definition at line 1199 of file xsh_subtract_sky_single.c.
References xsh_order::absorder, check, xsh_order::edglopoly, xsh_order::edguppoly, xsh_order_list::list, xsh_order_list::size, XSH_ASSURE_NOT_NULL, xsh_free_image(), xsh_image_smooth_median_x(), xsh_order_list_eval_int(), xsh_order_list_get_endy(), xsh_order_list_get_starty(), xsh_pre_get_data(), xsh_pre_get_nx(), xsh_pre_get_ny(), and xsh_pre_get_qual().
Referenced by xsh_subtract_sky_single().
cpl_frame* xsh_save_sky_model | ( | cpl_frame * | obj_frame, | |
cpl_frame * | sub_sky_frame, | |||
const char * | sky_tag, | |||
xsh_instrument * | instrument | |||
) |
Definition at line 1568 of file xsh_subtract_sky_single.c.
References xsh_pre_frame_subtract().
Referenced by xsh_check_subtract_sky_single().
cpl_frame* xsh_subtract_sky_single | ( | cpl_frame * | sci_frame, | |
cpl_frame * | order_table_frame, | |||
cpl_frame * | slitmap_frame, | |||
cpl_frame * | wavemap_frame, | |||
cpl_frame * | loc_table_frame, | |||
cpl_frame * | mflat_frame, | |||
cpl_frame * | usr_defined_break_points_frame, | |||
xsh_instrument * | instrument, | |||
int | nbkpts, | |||
xsh_subtract_sky_single_param * | sky_par, | |||
cpl_frame ** | sky_spectrum, | |||
cpl_frame ** | sky_spectrum_eso, | |||
const char * | rec_prefix, | |||
const int | clean_tmp | |||
) |
Subtract the sky background for single frame. If sky_spectrum is NOT NULL it is saved as a product, of type REC.
[in] | sci_frame | Input Science frame after divide by flat |
[in] | order_table_frame | Input Order Table Frame |
[in] | slitmap_frame | Input Wavesolution frame |
[in] | wavemap_frame | Wave map: each pixel content is the wave length |
[in] | loc_table_frame | Localisation table (NULL if not applicable) |
[in] | mflat_frame | Master Flat frame |
[in] | usr_defined_break_points_frame | user defined break points frame |
[in] | instrument | Pointer to instrument description structure |
[in] | nbkpts | Nb of break points used for Bezier Spline |
[in] | sky_par | parameters structure to control the sky subtraction |
[out] | sky_spectrum | The 1D supersampled observed sky spectrum [REC] |
[out] | sky_spectrum_eso | The 1D supersampled observed sky spectrum [ESO format] |
[in] | rec_prefix | Input recipe prefix |
Definition at line 1304 of file xsh_subtract_sky_single.c.
References BSPLINE_METHOD, check, xsh_pre::data_header, xsh_subtract_sky_single_param::gain, xsh_subtract_sky_single_param::kappa, xsh_subtract_sky_single_param::median_hsize, xsh_subtract_sky_single_param::method, xsh_subtract_sky_single_param::niter, xsh_subtract_sky_single_param::ron, SKY_METHOD_PRINT, xsh_subtract_sky_single_param::slit_edges_mask, xsh_add_temporary_file(), XSH_ARM_NIR, XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_NULL_MSG, xsh_free_frame(), xsh_free_image(), xsh_instrument_arm_tostring(), xsh_instrument_get_arm(), xsh_localization_free(), xsh_localization_load(), xsh_mflat_normalize(), xsh_msg, xsh_msg_dbg_low, xsh_msg_dbg_medium, xsh_order_list_free(), xsh_order_list_load(), xsh_pfits_get_gain(), xsh_pfits_get_ron(), xsh_pre_free(), xsh_pre_get_data(), xsh_pre_load(), xsh_rec_list_free(), xsh_rec_list_save(), xsh_rec_list_save2(), xsh_wavelist_subtract_sky(), xsh_wavemap_list_build_sky(), xsh_wavemap_list_free(), and xsh_wavemap_list_new().
Referenced by main(), and xsh_check_subtract_sky_single().
static cpl_frame * xsh_wavelist_subtract_sky | ( | xsh_pre * | pre_sci, | |
xsh_pre * | pre_mflat, | |||
xsh_rec_list * | sky_list, | |||
xsh_wavemap_list * | wave_list, | |||
xsh_instrument * | instrument, | |||
const char * | rec_prefix | |||
) | [static] |
subtract sky
Definition at line 1014 of file xsh_subtract_sky_single.c.
References check, wavemap_item::fit_err, wavemap_item::fitted, wavemap_item::ix, wavemap_item::iy, wavemap_item::lambda, xsh_wavemap_list::list, nx, ny, xsh_wavemap::object, xsh_wavemap::object_size, xsh_wavemap::order, order, xsh_wavemap_list::size, xsh_wavemap::sky, xsh_wavemap::sky_size, wavemap_item::slit, x, XSH_ASSURE_NOT_NULL, xsh_debug_level_get(), XSH_DEBUG_LEVEL_MEDIUM, xsh_frame_config(), xsh_instrument_arm_tostring(), xsh_msg_dbg_medium, xsh_pre_duplicate(), xsh_pre_free(), xsh_pre_get_data(), xsh_pre_get_errs(), xsh_pre_get_nx(), xsh_pre_get_ny(), xsh_pre_get_qual(), xsh_pre_save(), xsh_rec_list_get_data1(), xsh_rec_list_get_errs1(), xsh_rec_list_get_lambda(), xsh_rec_list_get_nlambda(), and y.
Referenced by xsh_subtract_sky_single().
xsh_rec_list * xsh_wavemap_list_build_sky | ( | xsh_wavemap_list * | list, | |
xsh_pre * | pre_mflat, | |||
xsh_instrument * | instrument | |||
) | [static] |
Build the sky spectrum list.
Definition at line 896 of file xsh_subtract_sky_single.c.
References check, wavemap_item::fit_err, wavemap_item::fitted, wavemap_item::ix, wavemap_item::iy, wavemap_item::lambda, xsh_wavemap_list::list, xsh_wavemap::order, order, xsh_wavemap_list::size, xsh_wavemap::sky, xsh_wavemap::sky_size, wavemap_item::slit, XSH_ASSURE_NOT_NULL, xsh_debug_level_get(), XSH_DEBUG_LEVEL_MEDIUM, xsh_msg, xsh_pre_get_data(), xsh_rec_list_create_with_size(), xsh_rec_list_free(), xsh_rec_list_get_data1(), xsh_rec_list_get_errs1(), xsh_rec_list_get_lambda(), and xsh_rec_list_set_data_size().
Referenced by xsh_subtract_sky_single().
static xsh_wavemap_list * xsh_wavemap_list_new | ( | cpl_image * | wavemap, | |
cpl_image * | slitmap, | |||
xsh_localization * | list, | |||
xsh_order_list * | order_table, | |||
xsh_pre * | pre_sci, | |||
int | nbkpts, | |||
cpl_frame * | usr_defined_break_points_frame, | |||
xsh_subtract_sky_single_param * | sky_par, | |||
xsh_instrument * | instrument | |||
) | [static] |
Definition at line 500 of file xsh_subtract_sky_single.c.
References xsh_order::absorder, assure, xsh_subtract_sky_single_param::bezier_spline_order, BSPLINE_METHOD, xsh_subtract_sky_single_param::bspline_sampling, check, xsh_instrument::decode_bp, xsh_order::edglopoly, xsh_localization::edglopoly, xsh_order::edguppoly, xsh_localization::edguppoly, FINE, wavemap_item::fit_err, fit_spline(), wavemap_item::fitted, wavemap_item::flux, xsh_subtract_sky_single_param::gain, xsh_subtract_sky_single_param::hheight1, xsh_subtract_sky_single_param::hheight2, wavemap_item::ix, wavemap_item::iy, xsh_subtract_sky_single_param::kappa, wavemap_item::lambda, xsh_wavemap::lambda_max, xsh_wavemap::lambda_min, xsh_wavemap_list::list, xsh_order_list::list, M_PI, xsh_subtract_sky_single_param::median_hsize, xsh_subtract_sky_single_param::method, xsh_subtract_sky_single_param::niter, xsh_pre::nx, nx, ny, xsh_wavemap::object, xsh_wavemap::object_size, order, xsh_subtract_sky_single_param::pos1, xsh_subtract_sky_single_param::pos2, xsh_subtract_sky_single_param::ron, wavemap_item::sigma, xsh_order_list::size, xsh_wavemap::sky, xsh_wavemap::sky_size, wavemap_item::slit, xsh_subtract_sky_single_param::slit_edges_mask, wave_compare(), XSH_ARM_NIR, XSH_ARM_UVB, XSH_ARM_VIS, XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_ILLEGAL_MSG, XSH_ASSURE_NOT_NULL, XSH_CMP_INT, xsh_free_vector(), xsh_instrument_arm_tostring(), xsh_instrument_get_arm(), xsh_msg, xsh_msg_dbg_medium, xsh_nbkpts_nir, xsh_nbkpts_uvb, xsh_nbkpts_vis, xsh_order_list_eval_int(), xsh_order_list_get_endy(), xsh_order_list_get_starty(), XSH_ORDERS_NIR, XSH_ORDERS_UVB, XSH_ORDERS_VIS, xsh_pre_get_data(), xsh_pre_get_errs(), xsh_pre_get_nx(), xsh_pre_get_ny(), xsh_pre_get_qual(), XSH_REGDEBUG, xsh_wavemap_list_create(), and xsh_wavemap_list_set_max_size().
Referenced by xsh_subtract_sky_single().
double xsh_nbkpts_nir[XSH_ORDERS_NIR] |
{0.30,0.28,0.28,0.7, 0.9,0.8,0.9,0.9, 0.5,0.7,1.0,0.5, 0.7,0.7,0.7,0.4}
Definition at line 490 of file xsh_subtract_sky_single.c.
Referenced by xsh_wavemap_list_new().
double xsh_nbkpts_uvb[XSH_ORDERS_UVB] |
{2.0,2.0,2.0,2.0, 2.0,2.0,2.0,2.0, 2.0,2.0,2.0,2.0}
Create the wavemap list.
Definition at line 467 of file xsh_subtract_sky_single.c.
Referenced by xsh_wavemap_list_new().
double xsh_nbkpts_vis[XSH_ORDERS_VIS] |
{1.5,0.8,0.8,0.7, 0.8,0.8,0.7,0.7, 0.7,0.75,0.7,0.6, 0.6,0.6,0.6}
Definition at line 474 of file xsh_subtract_sky_single.c.
Referenced by xsh_wavemap_list_new().