X-shooter Pipeline Reference Manual 3.8.15
Macros | Functions
Compute Linearity (xsh_compute_linearity)

Macros

#define USE_CPL_POLYNOMIAL
 
#define OPTIMIZE_IMAGE_HANDLING
 

Functions

static int orderCompare (const void *one, const void *two)
 
static int onoffCompare (const void *one, const void *two)
 
cpl_frameset * xsh_subtract_on_off (cpl_frameset *set, xsh_instrument *instrument)
 
int xsh_linear_group_by_exptime (cpl_frameset *raws, xsh_instrument *instrument, double exp_toler, cpl_frameset **groupSet)
 
cpl_frame * xsh_compute_linearity (cpl_frameset *medSet, xsh_instrument *instrument, xsh_clipping_param *lin_clipping, const int decode_bp)
 

Detailed Description

Functions used to compute the linearity bad pixel mask (recipe xsh_linear)

Macro Definition Documentation

◆ OPTIMIZE_IMAGE_HANDLING

#define OPTIMIZE_IMAGE_HANDLING

Definition at line 62 of file xsh_compute_linearity.c.

◆ USE_CPL_POLYNOMIAL

#define USE_CPL_POLYNOMIAL

Definition at line 61 of file xsh_compute_linearity.c.

Function Documentation

◆ onoffCompare()

static int onoffCompare ( const void *  one,
const void *  two 
)
static

Function used by qsort to order frames by ON/OFF Lamp keyword.

Parameters
onePointer to first item to be compared
twoPointer to second item ...
Returns
1 if first on_off flag is > than second, -1 otherwise

Definition at line 101 of file xsh_compute_linearity.c.

References TIME_FRAME::on_off.

Referenced by xsh_linear_group_by_exptime().

◆ orderCompare()

static int orderCompare ( const void *  one,
const void *  two 
)
static

Function used by qsort to order frames by increasing exptime.

Parameters
onePointer to first item to be compared
twoPointer to second item ...
Returns
1 if first exptime is > than second, -1 otherwise

Definition at line 81 of file xsh_compute_linearity.c.

References TIME_FRAME::exptime.

Referenced by xsh_linear_group_by_exptime().

◆ xsh_compute_linearity()

cpl_frame * xsh_compute_linearity ( cpl_frameset *  medSet,
xsh_instrument instrument,
xsh_clipping_param lin_clipping,
const int  decode_bp 
)

Computes the linearity bad pixel mask from median frames with increasing exposure times.

Parameters
medSetThe frameset of median frames (as returned by remove_crh)
instrumentPointer to the instrument description structure
lin_clippingParameters of linearity sigma clipping
Returns
The linearity bad pixel mask

< The final result bad pixel map image

< The final frame

< Temporary image list (to be freed)

< Temporary image list (to be freed)

< Temporary propertylist (to be freed)

< Temporary image list (to be freed)

< List of Bad pixel maps

Definition at line 547 of file xsh_compute_linearity.c.

References xsh_instrument::arm, assure, check, check_msg, instrument, LINEAR_POLYNOMIAL_DEGREE, xsh_clipping_param::niter, nx, ny, QFLAG_NON_LINEAR_PIXEL, xsh_clipping_param::sigma, XSH_ARM_NIR, XSH_BP_MAP_LIN, xsh_bpmap_collapse_bpmap_create(), xsh_bpmap_set_bad_pixel(), xsh_fit_imagelist_polynomial(), xsh_frame_product(), xsh_free_image(), xsh_free_imagelist(), xsh_free_propertylist(), XSH_GET_TAG_FROM_ARM, xsh_instrument_arm_tostring(), xsh_msg, xsh_msg_dbg_low, xsh_pfits_get_dit(), xsh_pfits_get_exptime(), xsh_pfits_set_qc(), xsh_pfits_set_qc_multi(), XSH_PRE_DATA_TYPE, XSH_QC_BP_MAP_LINi_MEAN, XSH_QC_BP_MAP_LINi_MED, XSH_QC_BP_MAP_LINi_RMS, XSH_QC_BP_MAP_NBADPIX, and xsh_set_image_cpl_bpmap().

Referenced by xsh_linear().

◆ xsh_linear_group_by_exptime()

int xsh_linear_group_by_exptime ( cpl_frameset *  raws,
xsh_instrument instrument,
double  exp_toler,
cpl_frameset **  groupSet 
)

Create a list of framesets, each frameset containing frames with the same exposure time (+- tolerance). One should find at least 3 groups, each group with 3 frames. If arm is NIR, also spread ON and OFF frames into different framesets.

Parameters
rawsFrameset of raw frames (LINEARITY)
instrumentPointer to instrument description structure
exp_tolerTolerance on same exposure time in a group
groupSetPointer to list of framesets, one frameset per group
Returns
Number of groups of same exposure time

Definition at line 210 of file xsh_compute_linearity.c.

References xsh_instrument::arm, assure, check, check_msg, TIME_FRAME::exptime, first, TIME_FRAME::frame, instrument, TIME_FRAME::on_off, onoffCompare(), orderCompare(), XSH_ARM_NIR, xsh_free_propertylist(), xsh_msg, xsh_msg_dbg_low, xsh_pfits_get_dit(), xsh_pfits_get_exptime(), and xsh_pfits_get_lamp_on_off().

Referenced by xsh_linear().

◆ xsh_subtract_on_off()

cpl_frameset * xsh_subtract_on_off ( cpl_frameset *  set,
xsh_instrument instrument 
)

Subtracts OFF frames from ON frames with same DIT (NIR only)

Parameters
setFrameset of all the frames at same DIT
instrumentPointer to instrument structure
Returns
Frameset of the subtracted frames

Definition at line 120 of file xsh_compute_linearity.c.

References assure, check_msg, instrument, xsh_free_frameset(), XSH_LINEARITY_NIR, xsh_msg, xsh_msg_dbg_low, xsh_pre_duplicate(), xsh_pre_free(), xsh_pre_load(), xsh_pre_save(), and xsh_pre_subtract().

Referenced by xsh_linear().