X-shooter Pipeline Reference Manual 3.8.15
Macros | Functions | Variables
Subtract Sky in single frame

Macros

#define HAVE_INLINE   1
 
#define REGDEBUG_MEDIAN_SPLINE   0
 
#define REGDEBUG_BSPLINE   0
 

Functions

static xsh_wavemap_listxsh_wavemap_list_new (cpl_frame *wavemap_frame, cpl_frame *slitmap_frame, xsh_localization *list, cpl_frame *order_table_frame, xsh_pre *pre_sci, int nbkpts, cpl_frame *usr_def_sampl_points, cpl_frame *ref_sky_list, cpl_frame *sky_orders_chunks, xsh_subtract_sky_single_param *sky_par, xsh_instrument *instrument)
 
static xsh_rec_listxsh_wavemap_list_build_sky (xsh_wavemap_list *wave_list, xsh_instrument *instr)
 Build the sky spectrum list.
 
static int xsh_wave_compare (const void *un, const void *deux)
 
static cpl_frame * xsh_wavelist_subtract_sky (xsh_pre *pre_sci, xsh_rec_list *sky_list, xsh_wavemap_list *wave_list, xsh_instrument *instrument, const char *rec_prefix, xsh_subtract_sky_single_param *sky_par)
 subtract sky
 
static cpl_table * xsh_table_unique_wave (cpl_table *tab, const char *wname, const char *fname)
 
static cpl_table * xsh_model_to_table (const xsh_wavemap_list *wlist, const int order)
 determines sky outliers on a 1D spectrum via kappa-sigma clipping
 
static cpl_error_code xsh_table_column_smooth (cpl_table **tab, const char *name_i, const char *name_o, const int hsize)
 determines sky outliers on a 1D spectrum via kappa-sigma clipping
 
static cpl_error_code xsh_table_column_clip (cpl_table **tab, const char *name_d, const char *name_s, const double kappa, const int niter, const double gain, const double ron2, const int decode_bp)
 
static cpl_table * xsh_detect_raw_data_outliers_1d (const xsh_wavemap_list *wlist, const int hsize, const double ron2, const double gain, const int order, const int iter, const int decode_bp)
 determines sky outliers on a 1D spectrum via kappa-sigma clipping
 
static cpl_table * xsh_detect_raw_data_outliers_1d_slice (const xsh_wavemap_list *wlist, const int hsize, const double ron2, const double gain, const int order, const int iter, const int decode_bp, const double s1, const double s2, const int slice_id)
 determines sky outliers on a 1D spectrum via kappa-sigma clipping
 
static int xsh_get_edge_x_min (xsh_order_list *otab, const int iorder, const int iy)
 
static int xsh_get_edge_x_max (xsh_order_list *otab, const int iorder, const int iy)
 
static void xsh_dump_table_on_region_file (cpl_table *tab, const char *fname, const int symbol)
 
static cpl_table * xsh_create_sampl_table (const int iorder, double *wave_ref, const int nref, xsh_wavemap_list *wlist, const int nsampl_2, const char *prefix)
 
static cpl_table * xsh_create_sampl_uniform_continuum (const int iorder, xsh_wavemap_list *wlist, const int nsampl, const char *prefix)
 
static cpl_error_code xsh_wavemap_list_rms_sky_image_save (xsh_wavemap_list *smap, const double ron2, const double gain, xsh_instrument *instr, const int iter)
 
static double xsh_skycorr_rms (xsh_wavemap_list *wlist, const int iorder, const double ron2, const double gain)
 
static cpl_table * xsh_table_unique_column (cpl_table *tab_inp, const char *col_wav)
 
static cpl_table * xsh_skycorr_sample_continuum (xsh_wavemap_list *wlist, const int ord, const int n)
 
static cpl_table * xsh_skycorr_sampl_lines_from_static_tab (xsh_wavemap_list *wlist, const cpl_table *tab_ord, const int ord)
 
static cpl_table * xsh_model2tab (xsh_wavemap_list *wlist, int order)
 
static cpl_table * xsh_skycorr_wave_sampling_create (xsh_wavemap_list *wlist, const int ord, const int nbkpts_ord, const cpl_table *bkpts_tab)
 
static cpl_table * xsh_detect_outliers_thres_new (xsh_wavemap_list *wlist, const double kappa2, const double ron2, const double gain, const int order, const int iter, cpl_table **tab_line_res)
 
static cpl_error_code xsh_model_fill_fit (xsh_wavemap_list *wlist, const int order, cpl_table *stab, const float ron2, const float gain)
 
static cpl_error_code xsh_model_fill_obj (xsh_wavemap_list *wlist, const int order, const double s1, const double s2, cpl_table *stab, const float ron2, const float gain)
 
static cpl_error_code xsh_model_fill_fit_bfit (xsh_wavemap_list *wlist, const int order, cpl_table *stab, const float ron2, const float gain)
 
static cpl_error_code xsh_model_fill_fit_slice (xsh_wavemap_list *wlist, const int order, const double s1, const double s2, cpl_table *stab, const float ron2, const float gain)
 
static cpl_error_code xsh_model_fill_fit_slice_bfit (xsh_wavemap_list *wlist, const int order, const double s1, const double s2, cpl_table *stab, const float ron2, const float gain)
 
static void test_gsl_example (double *data_x, double *data_y, double *data_e, double *yfit, const int i_start, const size_t n, const size_t ncoeffs)
 
static void xsh_gsl_bspline_non_uniform (double *data_x, double *data_y, double *data_e, double *bkpts, double *yfit, const int i_start, const size_t n, const size_t ncoeffs)
 
cpl_error_code xsh_bspline_smooth_uniform_sl (cpl_table **tab, xsh_instrument *instrument, const double s1, const double s2)
 
cpl_error_code xsh_bspline_smooth_uniform (cpl_table **tab, xsh_instrument *instrument)
 
static cpl_error_code xsh_bspline_smooth_non_uniform2 (cpl_table *bkpts, cpl_frame *sky_orders_chunks, cpl_table **tab, const int iorder, xsh_instrument *instrument)
 
static cpl_table * xsh_fit_spline1 (xsh_wavemap_list *wlist, int order, cpl_table *sampl_tab, cpl_frame *sky_orders_chunks, int sampl_pts_no, int iter_no, xsh_subtract_sky_single_param *sky_par, float ron2, float gain, cpl_table **tab_line_res)
 This routine performs the B-SPLINE fit of a set of sky data non-uniformly sampled.
 
static cpl_table * xsh_fit_spline2 (xsh_wavemap_list *wlist, int order, cpl_table *sampl_tab, cpl_frame *sky_orders_chunks, int sampl_pts_no, int iter_no, xsh_subtract_sky_single_param *sky_par, float ron2, float gain, cpl_table **tab_line_res)
 This routine performs the B-SPLINE fit of a set of sky data non-uniformly sampled.
 
static cpl_error_code xsh_get_obj_and_sky_extraction_slits (xsh_subtract_sky_single_param *sky_par, xsh_localization *list, const double smap_min, const double smap_max, double *obj_slit_min, double *obj_slit_max, double *sky_slit_min, double *sky_slit_max)
 
static cpl_error_code xsh_get_sky_edges_min_max_and_size (xsh_subtract_sky_single_param *sky_par, const int miny, const int maxy, const int iorder, const int order, const int nx, const int wmap_xsize_diff, xsh_order_list *ord_tab, cpl_image *slitmap, double *sky_slit_min, double *sky_slit_max, int *max_size, int *max_size_x)
 
static cpl_error_code xsh_wavecal_list_pupulate (xsh_pre *pre_sci, const int iorder, const int miny, const int maxy, const int wmap_xsize_diff, const int decode_bp, const double obj_slit_min, const double obj_slit_max, const double sky_slit_min, const double sky_slit_max, const int order, xsh_wavemap_list *wave_list, int *sky_size, xsh_order_list *ord_tab, cpl_image *wavemap, cpl_image *slitmap)
 
static cpl_error_code xsh_skycor_def_nbkpts_ord (const int iorder, const int nbkpts, cpl_frame *break_pts_frame, xsh_instrument *inst, int bspline_sampling_method, int *nbkpts_ord)
 
cpl_error_code xsh_wavemap_list_full_sky_save (xsh_wavemap_list *wave_list, xsh_instrument *instr)
 
static void xsh_obj_fit_dump (int iorder, xsh_wavemap_list *wave_list)
 
static cpl_error_code xsh_subtract_sky_at_pix2 (const int all_size, const int sky_size, const int nx, wavemap_item *pall, wavemap_item *psky, float *pflux, float *pflat, float *perrs, int *pqual)
 
static cpl_error_code xsh_subtract_sky_at_pix (const int sky_size, const int nx, wavemap_item *psky, float *pflux, float *pflat, float *perrs, int *pqual)
 
static cpl_error_code xsh_subtract_sky_on_obj_at_pix (xsh_rec_list *sky_list, const int iorder, const int object_size, const int nx, wavemap_item **pobject, float *pflux, float *perrs, int *pqual)
 
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 *ref_sky_list, cpl_frame *ref_sky_orders_chunks, cpl_frame *usr_def_sampl_points, 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]
 

Detailed Description

Function ...

Macro Definition Documentation

◆ HAVE_INLINE

#define HAVE_INLINE   1

Definition at line 75 of file xsh_subtract_sky_single.c.

◆ REGDEBUG_BSPLINE

#define REGDEBUG_BSPLINE   0

Definition at line 77 of file xsh_subtract_sky_single.c.

◆ REGDEBUG_MEDIAN_SPLINE

#define REGDEBUG_MEDIAN_SPLINE   0

Definition at line 76 of file xsh_subtract_sky_single.c.

Function Documentation

◆ test_gsl_example()

static void test_gsl_example ( double *  data_x,
double *  data_y,
double *  data_e,
double *  yfit,
const int  i_start,
const size_t  n,
const size_t  ncoeffs 
)
static

Definition at line 3031 of file xsh_subtract_sky_single.c.

References n, sigma, x, and y.

◆ xsh_add_sky_model()

cpl_frame * xsh_add_sky_model ( cpl_frame *  subsky_frame,
cpl_frame *  sky_frame,
xsh_instrument instrument,
const char *  prefix 
)

◆ xsh_bspline_smooth_non_uniform2()

static cpl_error_code xsh_bspline_smooth_non_uniform2 ( cpl_table *  bkpts,
cpl_frame *  sky_orders_chunks,
cpl_table **  tab,
const int  iorder,
xsh_instrument instrument 
)
static

◆ xsh_bspline_smooth_uniform()

cpl_error_code xsh_bspline_smooth_uniform ( cpl_table **  tab,
xsh_instrument instrument 
)

Definition at line 3326 of file xsh_subtract_sky_single.c.

References test_gsl_example(), xsh_free_table(), and xsh_msg.

Referenced by xsh_fit_spline1(), and xsh_fit_spline2().

◆ xsh_bspline_smooth_uniform_sl()

cpl_error_code xsh_bspline_smooth_uniform_sl ( cpl_table **  tab,
xsh_instrument instrument,
const double  s1,
const double  s2 
)

◆ xsh_create_sampl_table()

static cpl_table * xsh_create_sampl_table ( const int  iorder,
double *  wave_ref,
const int  nref,
xsh_wavemap_list wlist,
const int  nsampl_2,
const char *  prefix 
)
static

◆ xsh_create_sampl_uniform_continuum()

static cpl_table * xsh_create_sampl_uniform_continuum ( const int  iorder,
xsh_wavemap_list wlist,
const int  nsampl,
const char *  prefix 
)
static

◆ xsh_detect_outliers_thres_new()

static cpl_table * xsh_detect_outliers_thres_new ( xsh_wavemap_list wlist,
const double  kappa2,
const double  ron2,
const double  gain,
const int  order,
const int  iter,
cpl_table **  tab_line_res 
)
static

◆ xsh_detect_raw_data_outliers_1d()

static cpl_table * xsh_detect_raw_data_outliers_1d ( const xsh_wavemap_list wlist,
const int  hsize,
const double  ron2,
const double  gain,
const int  order,
const int  iter,
const int  decode_bp 
)
static

determines sky outliers on a 1D spectrum via kappa-sigma clipping

Parameters
[in]wlisti/o structure with sky data and its B-spline model info
[in]hsizemedian filter half window size
[in]ron2square of RON
[in]gaingain value
[in]orderextraction order (relative no)
[in]itermodel iteration ID
Returns
[out] table with relevant info on sky, model, flagged pixels.

Definition at line 751 of file xsh_subtract_sky_single.c.

References kappa, xsh_wavemap_list::list, n, niter, order, QFLAG_SKY_MODEL_BAD_PIX, wavemap_item::qual, xsh_wavemap::sky, xsh_wavemap::sky_size, xsh_free_table(), xsh_model_to_table(), xsh_msg, xsh_msg_dbg_medium, xsh_table_column_clip(), and xsh_table_column_smooth().

Referenced by xsh_fit_spline1().

◆ xsh_detect_raw_data_outliers_1d_slice()

static cpl_table * xsh_detect_raw_data_outliers_1d_slice ( const xsh_wavemap_list wlist,
const int  hsize,
const double  ron2,
const double  gain,
const int  order,
const int  iter,
const int  decode_bp,
const double  s1,
const double  s2,
const int  slice_id 
)
static

determines sky outliers on a 1D spectrum via kappa-sigma clipping

Parameters
[in]wlisti/o structure with sky data and its B-spline model info
[in]hsizemedian filter half window size
[in]ron2square of RON
[in]gaingain value
[in]orderextraction order (relative no)
[in]itermodel iteration ID
Returns
[out] table with relevant info on sky, model, flagged pixels.

Definition at line 847 of file xsh_subtract_sky_single.c.

References check, wavemap_item::ix, wavemap_item::iy, kappa, wavemap_item::lambda, xsh_wavemap_list::list, n, niter, order, QFLAG_SKY_MODEL_BAD_PIX, wavemap_item::qual, xsh_wavemap::sky, xsh_wavemap::sky_size, wavemap_item::slit, xsh_free_table(), xsh_model_to_table(), xsh_msg, xsh_msg_dbg_medium, xsh_table_column_clip(), and xsh_table_column_smooth().

Referenced by xsh_fit_spline2().

◆ xsh_dump_table_on_region_file()

static void xsh_dump_table_on_region_file ( cpl_table *  tab,
const char *  fname,
const int  symbol 
)
static

◆ xsh_fit_spline1()

static cpl_table * xsh_fit_spline1 ( xsh_wavemap_list wlist,
int  order,
cpl_table *  sampl_tab,
cpl_frame *  sky_orders_chunks,
int  sampl_pts_no,
int  iter_no,
xsh_subtract_sky_single_param sky_par,
float  ron2,
float  gain,
cpl_table **  tab_line_res 
)
static

This routine performs the B-SPLINE fit of a set of sky data non-uniformly sampled.

S

Parameters
[in]wlisti/o structure with sky data and its B-spline model info
[in]orderextraction order (relative no)
[in]sampl_pts_nonumber of sampling points (NOT USED: parameter to be removed)
[in]iter_nomodel iteration ID
[in]sky_parsky extraction parameters
[in]ron2square of RON
[in]gaingain value
[out]tab_line_resi/o table with location of line sampling points
Returns
table with location of (bad model fit) outliers.

Definition at line 3576 of file xsh_subtract_sky_single.c.

References xsh_wavemap::all, xsh_wavemap::all_size, xsh_instrument::arm, BSPLINE_METHOD, BSPLINE_METHOD1, check, xsh_instrument::decode_bp, xsh_wavemap_list::instrument, kappa, xsh_subtract_sky_single_param::kappa, wavemap_item::lambda, xsh_wavemap_list::list, xsh_subtract_sky_single_param::median_hsize, xsh_subtract_sky_single_param::method, n, xsh_wavemap::order, order, xsh_wavemap::sky_size, XSH_ARM_UVB, xsh_bspline_interpolate_data_at_pos(), xsh_bspline_smooth_non_uniform2(), xsh_bspline_smooth_uniform(), xsh_detect_outliers_thres_new(), xsh_detect_raw_data_outliers_1d(), xsh_free_table(), xsh_model2tab(), xsh_model_fill_fit(), xsh_model_to_table(), xsh_msg, xsh_sort_table_1(), and xsh_table_unique_wave().

Referenced by xsh_wavemap_list_new().

◆ xsh_fit_spline2()

static cpl_table * xsh_fit_spline2 ( xsh_wavemap_list wlist,
int  order,
cpl_table *  sampl_tab,
cpl_frame *  sky_orders_chunks,
int  sampl_pts_no,
int  iter_no,
xsh_subtract_sky_single_param sky_par,
float  ron2,
float  gain,
cpl_table **  tab_line_res 
)
static

This routine performs the B-SPLINE fit of a set of sky data non-uniformly sampled.

S

Parameters
[in]wlisti/o structure with sky data and its B-spline model info
[in]orderextraction order (relative no)
[in]sampl_pts_nonumber of sampling points (NOT USED: parameter to be removed)
[in]iter_nomodel iteration ID
[in]sky_parsky extraction parameters
[in]ron2square of RON
[in]gaingain value
[out]tab_line_resi/o table with location of line sampling points
Returns
table with location of (bad model fit) outliers.

Definition at line 4082 of file xsh_subtract_sky_single.c.

References xsh_instrument::arm, BSPLINE_METHOD2, check, xsh_instrument::decode_bp, xsh_wavemap_list::instrument, kappa, xsh_subtract_sky_single_param::kappa, wavemap_item::lambda, xsh_wavemap::lambda_max, xsh_wavemap::lambda_min, xsh_wavemap_list::list, xsh_subtract_sky_single_param::median_hsize, xsh_subtract_sky_single_param::method, n, xsh_wavemap_list::obj_slit_max, xsh_wavemap_list::obj_slit_min, xsh_wavemap::object, xsh_wavemap::object_size, xsh_wavemap::order, order, s, xsh_wavemap::sky, xsh_wavemap::sky_size, xsh_wavemap_list::sky_slit_max, xsh_wavemap_list::sky_slit_min, XSH_ARM_UVB, xsh_bspline_interpolate_data_at_pos(), xsh_bspline_smooth_non_uniform2(), xsh_bspline_smooth_uniform(), xsh_detect_outliers_thres_new(), xsh_detect_raw_data_outliers_1d_slice(), xsh_free_table(), xsh_model_fill_fit_slice_bfit(), xsh_model_fill_obj(), xsh_msg, xsh_sort_table_1(), xsh_table_unique_wave(), xsh_wavemap_list_rms_sky_image_save(), and xsh_wavemap_list_sky_image_save().

Referenced by xsh_wavemap_list_new().

◆ xsh_get_edge_x_max()

static int xsh_get_edge_x_max ( xsh_order_list otab,
const int  iorder,
const int  iy 
)
static

◆ xsh_get_edge_x_min()

static int xsh_get_edge_x_min ( xsh_order_list otab,
const int  iorder,
const int  iy 
)
static

◆ xsh_get_obj_and_sky_extraction_slits()

static cpl_error_code xsh_get_obj_and_sky_extraction_slits ( xsh_subtract_sky_single_param sky_par,
xsh_localization list,
const double  smap_min,
const double  smap_max,
double *  obj_slit_min,
double *  obj_slit_max,
double *  sky_slit_min,
double *  sky_slit_max 
)
static

◆ xsh_get_sky_edges_min_max_and_size()

static cpl_error_code xsh_get_sky_edges_min_max_and_size ( xsh_subtract_sky_single_param sky_par,
const int  miny,
const int  maxy,
const int  iorder,
const int  order,
const int  nx,
const int  wmap_xsize_diff,
xsh_order_list ord_tab,
cpl_image *  slitmap,
double *  sky_slit_min,
double *  sky_slit_max,
int *  max_size,
int *  max_size_x 
)
static

◆ xsh_gsl_bspline_non_uniform()

static void xsh_gsl_bspline_non_uniform ( double *  data_x,
double *  data_y,
double *  data_e,
double *  bkpts,
double *  yfit,
const int  i_start,
const size_t  n,
const size_t  ncoeffs 
)
static

Definition at line 3143 of file xsh_subtract_sky_single.c.

References n, sigma, x, and y.

Referenced by xsh_bspline_smooth_non_uniform2().

◆ xsh_model2tab()

static cpl_table * xsh_model2tab ( xsh_wavemap_list wlist,
int  order 
)
static

◆ xsh_model_fill_fit()

static cpl_error_code xsh_model_fill_fit ( xsh_wavemap_list wlist,
const int  order,
cpl_table *  stab,
const float  ron2,
const float  gain 
)
static

◆ xsh_model_fill_fit_bfit()

static cpl_error_code xsh_model_fill_fit_bfit ( xsh_wavemap_list wlist,
const int  order,
cpl_table *  stab,
const float  ron2,
const float  gain 
)
static

◆ xsh_model_fill_fit_slice()

static cpl_error_code xsh_model_fill_fit_slice ( xsh_wavemap_list wlist,
const int  order,
const double  s1,
const double  s2,
cpl_table *  stab,
const float  ron2,
const float  gain 
)
static

◆ xsh_model_fill_fit_slice_bfit()

static cpl_error_code xsh_model_fill_fit_slice_bfit ( xsh_wavemap_list wlist,
const int  order,
const double  s1,
const double  s2,
cpl_table *  stab,
const float  ron2,
const float  gain 
)
static

◆ xsh_model_fill_obj()

static cpl_error_code xsh_model_fill_obj ( xsh_wavemap_list wlist,
const int  order,
const double  s1,
const double  s2,
cpl_table *  stab,
const float  ron2,
const float  gain 
)
static

◆ xsh_model_to_table()

static cpl_table * xsh_model_to_table ( const xsh_wavemap_list wlist,
const int  order 
)
static

determines sky outliers on a 1D spectrum via kappa-sigma clipping

Parameters
[in]wlisti/o structure with sky data and its B-spline model info
[in]orderextraction order (relative no)
Returns
[out] table with relevant info on sky, model, flagged pixels.

Definition at line 574 of file xsh_subtract_sky_single.c.

References wavemap_item::flux, wavemap_item::ix, wavemap_item::iy, wavemap_item::lambda, xsh_wavemap_list::list, order, wavemap_item::qual, wavemap_item::sigma, xsh_wavemap::sky, xsh_wavemap::sky_size, and wavemap_item::slit.

Referenced by xsh_detect_raw_data_outliers_1d(), xsh_detect_raw_data_outliers_1d_slice(), and xsh_fit_spline1().

◆ xsh_obj_fit_dump()

static void xsh_obj_fit_dump ( int  iorder,
xsh_wavemap_list wave_list 
)
static

◆ xsh_save_sky_model()

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 5800 of file xsh_subtract_sky_single.c.

References instrument, and xsh_pre_frame_subtract().

Referenced by xsh_check_subtract_sky_single().

◆ xsh_skycor_def_nbkpts_ord()

static cpl_error_code xsh_skycor_def_nbkpts_ord ( const int  iorder,
const int  nbkpts,
cpl_frame *  break_pts_frame,
xsh_instrument inst,
int  bspline_sampling_method,
int *  nbkpts_ord 
)
static

◆ xsh_skycorr_rms()

static double xsh_skycorr_rms ( xsh_wavemap_list wlist,
const int  iorder,
const double  ron2,
const double  gain 
)
static

◆ xsh_skycorr_sampl_lines_from_static_tab()

static cpl_table * xsh_skycorr_sampl_lines_from_static_tab ( xsh_wavemap_list wlist,
const cpl_table *  tab_ord,
const int  ord 
)
static

◆ xsh_skycorr_sample_continuum()

static cpl_table * xsh_skycorr_sample_continuum ( xsh_wavemap_list wlist,
const int  ord,
const int  n 
)
static

◆ xsh_skycorr_wave_sampling_create()

static cpl_table * xsh_skycorr_wave_sampling_create ( xsh_wavemap_list wlist,
const int  ord,
const int  nbkpts_ord,
const cpl_table *  bkpts_tab 
)
static

◆ xsh_subtract_sky_at_pix()

static cpl_error_code xsh_subtract_sky_at_pix ( const int  sky_size,
const int  nx,
wavemap_item psky,
float *  pflux,
float *  pflat,
float *  perrs,
int *  pqual 
)
static

◆ xsh_subtract_sky_at_pix2()

static cpl_error_code xsh_subtract_sky_at_pix2 ( const int  all_size,
const int  sky_size,
const int  nx,
wavemap_item pall,
wavemap_item psky,
float *  pflux,
float *  pflat,
float *  perrs,
int *  pqual 
)
static

◆ xsh_subtract_sky_on_obj_at_pix()

static cpl_error_code xsh_subtract_sky_on_obj_at_pix ( xsh_rec_list sky_list,
const int  iorder,
const int  object_size,
const int  nx,
wavemap_item **  pobject,
float *  pflux,
float *  perrs,
int *  pqual 
)
static

◆ xsh_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 *  ref_sky_list,
cpl_frame *  ref_sky_orders_chunks,
cpl_frame *  usr_def_sampl_points,
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.

Parameters
[in]sci_frameInput Science frame after divide by flat
[in]order_table_frameInput Order Table Frame
[in]slitmap_frameInput Wavesolution frame
[in]wavemap_frameWave map: each pixel content is the wave length
[in]loc_table_frameLocalisation table (NULL if not applicable)
[in]usr_defined_break_points_frameuser defined break points frame
[in]instrumentPointer to instrument description structure
[in]nbkptsNb of break points used for Bezier Spline
[in]sky_parparameters 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_prefixInput recipe prefix
Returns
The frame (PRE) after sky subtraction.

Definition at line 5674 of file xsh_subtract_sky_single.c.

References check, xsh_pre::data_header, xsh_subtract_sky_single_param::gain, instrument, xsh_subtract_sky_single_param::kappa, xsh_subtract_sky_single_param::median_hsize, MEDIAN_METHOD, 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_compute_ron_nir(), xsh_free_frame(), xsh_instrument_arm_tostring(), xsh_instrument_get_arm(), xsh_localization_free(), xsh_localization_load(), xsh_msg, xsh_msg_dbg_low, xsh_msg_dbg_medium, xsh_msg_warning, xsh_pfits_get_dit(), xsh_pfits_get_gain(), xsh_pfits_get_ron(), xsh_pre_free(), xsh_pre_load(), xsh_rec_list1D_save_as_tab(), xsh_rec_list_free(), xsh_rec_list_save(), xsh_wavelist_subtract_sky(), xsh_wavemap_list_build_sky(), xsh_wavemap_list_free(), and xsh_wavemap_list_new().

Referenced by xsh_check_subtract_sky_single().

◆ xsh_table_column_clip()

static cpl_error_code xsh_table_column_clip ( cpl_table **  tab,
const char *  name_d,
const char *  name_s,
const double  kappa,
const int  niter,
const double  gain,
const double  ron2,
const int  decode_bp 
)
static

◆ xsh_table_column_smooth()

static cpl_error_code xsh_table_column_smooth ( cpl_table **  tab,
const char *  name_i,
const char *  name_o,
const int  hsize 
)
static

determines sky outliers on a 1D spectrum via kappa-sigma clipping

Parameters
[in]tabi/o table
[in]name_iinput column name to be smoothed
[in]name_ooutput column name with smoothed values
[in]hsizemedian filter half window size
Returns
[out] table with relevant info on sky, model, flagged pixels.

Definition at line 638 of file xsh_subtract_sky_single.c.

Referenced by xsh_detect_raw_data_outliers_1d(), and xsh_detect_raw_data_outliers_1d_slice().

◆ xsh_table_unique_column()

static cpl_table * xsh_table_unique_column ( cpl_table *  tab_inp,
const char *  col_wav 
)
static

◆ xsh_table_unique_wave()

static cpl_table * xsh_table_unique_wave ( cpl_table *  tab,
const char *  wname,
const char *  fname 
)
static

Definition at line 103 of file xsh_subtract_sky_single.c.

References xsh_msg.

Referenced by xsh_fit_spline1(), and xsh_fit_spline2().

◆ xsh_wave_compare()

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

Definition at line 4308 of file xsh_subtract_sky_single.c.

References wavemap_item::lambda.

Referenced by xsh_wavecal_list_pupulate().

◆ xsh_wavecal_list_pupulate()

static cpl_error_code xsh_wavecal_list_pupulate ( xsh_pre pre_sci,
const int  iorder,
const int  miny,
const int  maxy,
const int  wmap_xsize_diff,
const int  decode_bp,
const double  obj_slit_min,
const double  obj_slit_max,
const double  sky_slit_min,
const double  sky_slit_max,
const int  order,
xsh_wavemap_list wave_list,
int *  sky_size,
xsh_order_list ord_tab,
cpl_image *  wavemap,
cpl_image *  slitmap 
)
static

◆ xsh_wavelist_subtract_sky()

static cpl_frame * xsh_wavelist_subtract_sky ( xsh_pre pre_sci,
xsh_rec_list sky_list,
xsh_wavemap_list wave_list,
xsh_instrument instrument,
const char *  rec_prefix,
xsh_subtract_sky_single_param sky_par 
)
static

◆ xsh_wavemap_list_build_sky()

xsh_rec_list * xsh_wavemap_list_build_sky ( xsh_wavemap_list wave_list,
xsh_instrument instr 
)
static

◆ xsh_wavemap_list_full_sky_save()

cpl_error_code xsh_wavemap_list_full_sky_save ( xsh_wavemap_list wave_list,
xsh_instrument instr 
)

◆ xsh_wavemap_list_new()

static xsh_wavemap_list * xsh_wavemap_list_new ( cpl_frame *  wavemap_frame,
cpl_frame *  slitmap_frame,
xsh_localization list,
cpl_frame *  order_table_frame,
xsh_pre pre_sci,
int  nbkpts,
cpl_frame *  usr_def_sampl_points,
cpl_frame *  ref_sky_list,
cpl_frame *  sky_orders_chunks,
xsh_subtract_sky_single_param sky_par,
xsh_instrument instrument 
)
static

Definition at line 4776 of file xsh_subtract_sky_single.c.

References xsh_order::absorder, xsh_instrument::arm, xsh_instrument::biny, BSPLINE_METHOD, BSPLINE_METHOD1, BSPLINE_METHOD2, BSPLINE_METHOD3, BSPLINE_METHOD4, BSPLINE_METHOD5, xsh_subtract_sky_single_param::bspline_sampling, check, xsh_instrument::decode_bp, endy, xsh_order::endy, wavemap_item::fit_err, wavemap_item::fitted, xsh_subtract_sky_single_param::gain, instrument, xsh_wavemap::lambda_max, xsh_wavemap::lambda_min, xsh_order_list::list, xsh_wavemap_list::list, xsh_subtract_sky_single_param::median_hsize, MEDIAN_METHOD, xsh_subtract_sky_single_param::method, xsh_instrument::nir_orders_nb, xsh_subtract_sky_single_param::niter, xsh_pre::nx, nx, order, xsh_subtract_sky_single_param::ron, xsh_order_list::size, xsh_wavemap::sky, xsh_wavemap::sky_size, starty, xsh_order::starty, xsh_instrument::uvb_orders_nb, xsh_instrument::vis_orders_nb, XSH_ARM_NIR, XSH_ARM_UVB, XSH_ARM_VIS, XSH_ASSURE_NOT_NULL, xsh_dump_table_on_region_file(), xsh_fit_spline1(), xsh_fit_spline2(), xsh_free_image(), xsh_free_table(), xsh_free_vector(), xsh_get_obj_and_sky_extraction_slits(), xsh_get_sky_edges_min_max_and_size(), xsh_instrument_get_arm(), xsh_msg, xsh_msg_dbg_medium, xsh_msg_error, xsh_order_list_free(), xsh_order_list_get_endy(), xsh_order_list_get_starty(), xsh_order_list_load(), xsh_pre_get_nx(), xsh_skycor_def_nbkpts_ord(), xsh_skycorr_rms(), xsh_skycorr_wave_sampling_create(), xsh_sort_table_1(), xsh_wavecal_list_pupulate(), xsh_wavemap_list_create(), xsh_wavemap_list_object_image_save(), xsh_wavemap_list_rms_sky_image_save(), xsh_wavemap_list_set_max_size(), and xsh_wavemap_list_sky_image_save().

Referenced by xsh_subtract_sky_single().

◆ xsh_wavemap_list_rms_sky_image_save()

static cpl_error_code xsh_wavemap_list_rms_sky_image_save ( xsh_wavemap_list smap,
const double  ron2,
const double  gain,
xsh_instrument instr,
const int  iter 
)
static

Variable Documentation

◆ xsh_nbkpts_nir

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 4354 of file xsh_subtract_sky_single.c.

Referenced by xsh_skycor_def_nbkpts_ord().

◆ xsh_nbkpts_uvb

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 4325 of file xsh_subtract_sky_single.c.

Referenced by xsh_skycor_def_nbkpts_ord().

◆ xsh_nbkpts_vis

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 4332 of file xsh_subtract_sky_single.c.

Referenced by xsh_skycor_def_nbkpts_ord().