X-shooter Pipeline Reference Manual 3.8.15
Functions | Variables
Subtraction of Frames (xsh_subtract)

Functions

static cpl_image * xsh_image_generate_background (const int sx, const int sy, const polynomial *background_pol)
 Subtract the previously defined background.
 
static cpl_image * xsh_background_poly (xsh_pre *image, cpl_table **grid_tbl, xsh_background_param *back_par)
 
cpl_frame * xsh_subtract_bias (cpl_frame *frame, cpl_frame *bias, xsh_instrument *instr, const char *type, const int pre_overscan_corr, const int save_tmp)
 Subtract the master bias frame from PRE frame.
 
cpl_frameset * xsh_subtract_nir_on_off (cpl_frameset *on, cpl_frameset *off, xsh_instrument *instr)
 (NIR only) subtract the OFF set of files from the On set of files
 
cpl_frame * xsh_subtract_dark (cpl_frame *frame, cpl_frame *dark, const char *filename, xsh_instrument *instr)
 subtract the master dark frame from PRE frame
 
static void xsh_fill_bkg_mask_range (const int y, const int nx, const int xmin, const int xmax, const int x_hbox, const int decode_bp, int *qual, int *pmask, int *size)
 
static xsh_gridxsh_crea_grid_from_mask (xsh_pre *pre, xsh_order_list *orderlist, const int x_hbox, xsh_instrument *instr, const char *prefix)
 Generates sampling grid using sampling boxes distributed along inter-order background regions.
 
cpl_frame * xsh_subtract_background (cpl_frame *frame, cpl_frame *edges_order_tab_frame, xsh_background_param *background_par, xsh_instrument *instr, const char *prefix, cpl_frame **grid_frame, cpl_frame **backg_frame, const int save_bkg, const int save_grid, const int save_sub_bkg)
 Subtract the inter-order background from PRE frame.
 

Variables

int xsh_bkg_yskip_lo_uvb [XSH_ORDERS_UVB]
 
int xsh_bkg_yskip_up_uvb [XSH_ORDERS_UVB]
 
int xsh_bkg_yskip_lo_vis [XSH_ORDERS_VIS]
 
int xsh_bkg_yskip_up_vis [XSH_ORDERS_VIS]
 
int xsh_bkg_yskip_lo_nir [XSH_ORDERS_NIR]
 
int xsh_bkg_yskip_up_nir [XSH_ORDERS_NIR]
 

Detailed Description

Contains functions to subtract various frames.

Function Documentation

◆ xsh_background_poly()

static cpl_image * xsh_background_poly ( xsh_pre image,
cpl_table **  grid_tbl,
xsh_background_param back_par 
)
static

◆ xsh_crea_grid_from_mask()

static xsh_grid * xsh_crea_grid_from_mask ( xsh_pre pre,
xsh_order_list orderlist,
const int  x_hbox,
xsh_instrument instr,
const char *  prefix 
)
static

Generates sampling grid using sampling boxes distributed along inter-order background regions.

Parameters
[in]preThe frame from we subtract the background in PRE format
[in]orderlistThe order-list structure where the orders positions are
[in]background_parThe background_img parameters structure
[in]instrThe instrument containing the arm , mode and lamp in use
Returns
The grid structure with inter-order background sampled points

Definition at line 348 of file xsh_subtract.c.

References check, xsh_pre::data, xsh_instrument::decode_bp, xsh_order::edglopoly, xsh_order::edguppoly, endy, xsh_order::endy, xsh_pre::errs, xsh_order_list::list, xsh_pre::nx, nx, xsh_pre::ny, ny, xsh_pre::qual, xsh_order_list::size, size, starty, xsh_order::starty, x, XSH_ARM_NIR, XSH_ARM_UVB, XSH_ARM_VIS, xsh_bkg_yskip_lo_nir, xsh_bkg_yskip_lo_uvb, xsh_bkg_yskip_up_nir, xsh_bkg_yskip_up_uvb, xsh_fill_bkg_mask_range(), xsh_free_image(), xsh_grid_add(), xsh_grid_create(), xsh_grid_sort(), xsh_instrument_get_arm(), xsh_msg, xsh_order_list_eval(), and y.

Referenced by xsh_subtract_background().

◆ xsh_fill_bkg_mask_range()

static void xsh_fill_bkg_mask_range ( const int  y,
const int  nx,
const int  xmin,
const int  xmax,
const int  x_hbox,
const int  decode_bp,
int *  qual,
int *  pmask,
int *  size 
)
static

Definition at line 300 of file xsh_subtract.c.

References nx, x, and y.

Referenced by xsh_crea_grid_from_mask().

◆ xsh_image_generate_background()

static cpl_image * xsh_image_generate_background ( const int  sx,
const int  sy,
const polynomial background_pol 
)
static

Subtract the previously defined background.

Parameters
imageImage to be background subtracted
background_imBackground image, may be NULL. If non-NULL, this is updated to contain the flux values that were actually subtracted.
background_polBackground polynomial, may be NULL
Returns
CPL_ERROR_NONE iff OK.

Exactly one of background_im and background_pol must be non-NULL.

Definition at line 1112 of file xsh_subtract.c.

References x, xsh_polynomial_evaluate_2d(), XSH_PRE_DATA_TYPE, and y.

Referenced by xsh_background_poly().

◆ xsh_subtract_background()

cpl_frame * xsh_subtract_background ( cpl_frame *  frame,
cpl_frame *  edges_order_tab_frame,
xsh_background_param background_par,
xsh_instrument instr,
const char *  prefix,
cpl_frame **  grid_frame,
cpl_frame **  backg_frame,
const int  save_bkg,
const int  save_grid,
const int  save_sub_bkg 
)

Subtract the inter-order background from PRE frame.

Parameters
[in]frameThe frame from we subtract the background
[in]edges_order_tab_frameThe table where the orders positions are
[in]background_parThe background_img parameters structure
[in]instrThe instrument containing the arm , mode and lamp in use
[in]prefix
[out]grid_framegrid sampling point frame
[out]backg_framebackground frame
Returns
The subtracted frame

Definition at line 947 of file xsh_subtract.c.

References xsh_pre::binx, xsh_pre::biny, check, xsh_pre::data, xsh_pre::data_header, xsh_background_param::edges_margin, xsh_add_temporary_file(), XSH_ASSURE_NOT_NULL_MSG, xsh_background_poly(), xsh_crea_grid_from_mask(), xsh_frame_product(), XSH_FREE, xsh_free_frame(), xsh_free_image(), xsh_free_propertylist(), xsh_free_table(), xsh_grid2table(), xsh_grid_free(), xsh_instrument_get_binx(), xsh_instrument_get_biny(), xsh_msg, XSH_NAME_PREFIX_LAMP_MODE_ARM, xsh_order_list_free(), xsh_order_list_load(), xsh_order_list_set_bin_x(), xsh_order_list_set_bin_y(), xsh_pfits_set_pcatg(), xsh_pfits_set_wcs(), xsh_pre_free(), xsh_pre_load(), and xsh_pre_save().

Referenced by xsh_absorp(), xsh_geom_ifu(), xsh_mflat(), xsh_respon_slit_stare(), xsh_scired_ifu_offset(), xsh_scired_ifu_stare(), and xsh_scired_slit_stare().

◆ xsh_subtract_bias()

cpl_frame * xsh_subtract_bias ( cpl_frame *  frame,
cpl_frame *  bias,
xsh_instrument instr,
const char *  type,
const int  pre_overscan_corr,
const int  save_tmp 
)

Subtract the master bias frame from PRE frame.

Parameters
frameThe frame from we subtracted the master bias
biasThe master bias frame
instrThe xsh instrument
type
frame type used to define bias subtracted frame filename
pre_overscan_corrswitch on/off pre-overscan correction
save_tmpswitch on/off tmp product saving
Returns
the subtracted frame

Definition at line 120 of file xsh_subtract.c.

References check, xsh_pre::data, xsh_pre::data_header, XSH_ASSURE_NOT_NULL, xsh_free_frame(), xsh_instrument_arm_tostring(), xsh_pfits_set_pcatg(), xsh_pre_free(), xsh_pre_load(), xsh_pre_save(), xsh_pre_subtract(), and xsh_pre_subtract_scalar().

Referenced by main(), xsh_2dmap(), xsh_cfg_recover_last_step(), xsh_check_subtract_bias(), xsh_flexcomp(), xsh_get_master_dark_opt(), xsh_mflat_combine_flats(), xsh_orderpos(), xsh_predict(), and xsh_wavecal().

◆ xsh_subtract_dark()

cpl_frame * xsh_subtract_dark ( cpl_frame *  frame,
cpl_frame *  dark,
const char *  filename,
xsh_instrument instr 
)

subtract the master dark frame from PRE frame

Parameters
frameframe to be sutracted
darkthe master dark frame
filenamethe result frame filename
instrinstrument containing the arm , mode and lamp in use
Returns
the subtracted frame

Definition at line 247 of file xsh_subtract.c.

References assure, check, xsh_pre::data_header, exptime, xsh_pre::exptime, XSH_ARM_NIR, XSH_ASSURE_NOT_ILLEGAL_MSG, XSH_ASSURE_NOT_NULL, xsh_free_frame(), xsh_instrument_get_arm(), xsh_pfits_get_dit(), xsh_pre_free(), xsh_pre_load(), xsh_pre_multiply_scalar(), xsh_pre_save(), and xsh_pre_subtract().

Referenced by main(), xsh_2dmap(), xsh_cfg_recover_last_step(), xsh_check_subtract_dark(), xsh_flexcomp(), xsh_mflat_combine_flats(), xsh_orderpos(), xsh_predict(), xsh_scired_ifu_stare(), and xsh_subtract_nir_on_off().

◆ xsh_subtract_nir_on_off()

cpl_frameset * xsh_subtract_nir_on_off ( cpl_frameset *  on,
cpl_frameset *  off,
xsh_instrument instr 
)

(NIR only) subtract the OFF set of files from the On set of files

Parameters
onthe ON set of files
offthe OFF set of files
instrinstrument containing the arm , mode and lamp in use
Returns
the ON subtract OFF set of files

Definition at line 194 of file xsh_subtract.c.

References check, xsh_add_temporary_file(), XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_NULL, xsh_free_frame(), xsh_free_frameset(), XSH_NEW_FRAMESET, and xsh_subtract_dark().

Referenced by xsh_2dmap(), xsh_cfg_recover_last_step(), xsh_mflat_combine_flats(), xsh_predict(), and xsh_wavecal().

Variable Documentation

◆ xsh_bkg_yskip_lo_nir

int xsh_bkg_yskip_lo_nir[XSH_ORDERS_NIR]
Initial value:
={0,0,0,0,
0,50,50,80,
70,50,50,50,
50,50,50,50}

Definition at line 76 of file xsh_subtract.c.

Referenced by xsh_crea_grid_from_mask().

◆ xsh_bkg_yskip_lo_uvb

int xsh_bkg_yskip_lo_uvb[XSH_ORDERS_UVB]
Initial value:
={0,0,0,0,
0,0,0,0,
0,0,0,0}

Definition at line 58 of file xsh_subtract.c.

Referenced by xsh_crea_grid_from_mask().

◆ xsh_bkg_yskip_lo_vis

int xsh_bkg_yskip_lo_vis[XSH_ORDERS_VIS]
Initial value:
={0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0}

Definition at line 67 of file xsh_subtract.c.

◆ xsh_bkg_yskip_up_nir

int xsh_bkg_yskip_up_nir[XSH_ORDERS_NIR]
Initial value:
={0,0,0,0,
0,50,100,60,
90,70,50,50,
50,50,50,50}

Definition at line 82 of file xsh_subtract.c.

Referenced by xsh_crea_grid_from_mask().

◆ xsh_bkg_yskip_up_uvb

int xsh_bkg_yskip_up_uvb[XSH_ORDERS_UVB]
Initial value:
={0,0,0,0,
0,0,0,0,
0,0,0,0}

Definition at line 62 of file xsh_subtract.c.

Referenced by xsh_crea_grid_from_mask().

◆ xsh_bkg_yskip_up_vis

int xsh_bkg_yskip_up_vis[XSH_ORDERS_VIS]
Initial value:
={0,0,0,0,0,
50,50,70,50,50,
50,50,50,50,50}

Definition at line 71 of file xsh_subtract.c.