Subtract Sky in single frame
[DRL Functions]

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 ron, float gain, const char *sarm)
static xsh_wavemap_listxsh_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_listxsh_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)
 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]

Detailed Description

Function ...


Define Documentation

#define REGDEBUG_MEDIAN_SPLINE   0

Definition at line 74 of file xsh_subtract_sky_single.c.


Function Documentation

void fit_spline ( xsh_wavemap_list wave_list,
int  idx,
int  nbkpts,
int  order,
int  niter,
float  kappa,
float  ron,
float  gain,
const char *  sarm 
) [static]
static int wave_compare ( const void *  un,
const void *  deux 
) [static]

Definition at line 442 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 
)
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 1461 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 1537 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.

Parameters:
[in] order_table Edge order table list
[in] pre_mflat Master flat image
Returns:
Normalized master flat image.

Definition at line 1209 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 1587 of file xsh_subtract_sky_single.c.

References check, and 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 
)

Subtract the sky background for single frame. If sky_spectrum is NOT NULL it is saved as a product, of type REC.

Parameters:
[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
Returns:
The frame (PRE) after sky subtraction.

Definition at line 1314 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_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]
xsh_rec_list * xsh_wavemap_list_build_sky ( xsh_wavemap_list list,
xsh_pre pre_mflat,
xsh_instrument instrument 
) [static]
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 492 of file xsh_subtract_sky_single.c.

References xsh_order::absorder, xsh_subtract_sky_single_param::bezier_spline_order, BSPLINE_METHOD, xsh_subtract_sky_single_param::bspline_sampling, check, 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_debug_level_get(), XSH_DEBUG_LEVEL_MEDIUM, xsh_free_vector(), XSH_GOOD_PIXEL_LEVEL, 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().


Variable Documentation

double xsh_nbkpts_nir[XSH_ORDERS_NIR]
Initial value:
{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 482 of file xsh_subtract_sky_single.c.

Referenced by xsh_wavemap_list_new().

double xsh_nbkpts_uvb[XSH_ORDERS_UVB]
Initial value:
{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 459 of file xsh_subtract_sky_single.c.

Referenced by xsh_wavemap_list_new().

double xsh_nbkpts_vis[XSH_ORDERS_VIS]
Initial value:
{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 466 of file xsh_subtract_sky_single.c.

Referenced by xsh_wavemap_list_new().


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