X-shooter Pipeline Reference Manual 3.8.15
Functions

Functions

static cpl_error_code xsh_preoverscan_corr (cpl_frame *raw, const int corr_mode, double *cor_val)
 
double xsh_compute_ron_nir (const double dit)
 
static void xsh_pre_init (xsh_pre *pre, cpl_propertylist *header, xsh_instrument *instrument)
 Fill the XSH_PRE structure from FITS header file.
 
xsh_prexsh_pre_create (cpl_frame *raw, cpl_frame *bpmap, cpl_image *bias_data, xsh_instrument *instr, const int pre_overscan_corr, const bool flag_neg_and_thresh_pix)
 Create a XSH_PRE from a raw frame.
 
void xsh_pre_free (xsh_pre **pre)
 Free a xsh_pre structure.
 
xsh_prexsh_pre_load (cpl_frame *frame, xsh_instrument *instr)
 Load a xsh_pre structure from a frame.
 
xsh_prexsh_pre_duplicate (const xsh_pre *pre)
 Copy a PRE structure.
 
cpl_frame * xsh_pre_save (const xsh_pre *pre, const char *filename, const char *tag, int temp)
 Save PRE on disk.
 
cpl_frame * xsh_pre_save_product (xsh_pre *pre, cpl_frame *frame, cpl_frameset *frameset, const cpl_parameterlist *parameters, const char *recipe_id, const char *prefix)
 Save PRE frame like a product on disk.
 
xsh_prexsh_pre_new (int nx, int ny)
 Create new PRE image.
 
int xsh_pre_get_nx (const xsh_pre *pre)
 Get nx of pre structure.
 
int xsh_pre_get_ny (const xsh_pre *pre)
 Get ny of pre structure.
 
int xsh_pre_get_binx (const xsh_pre *pre)
 Get binx of pre structure.
 
int xsh_pre_get_biny (const xsh_pre *pre)
 Get biny of pre structure.
 
float xsh_pre_get_pszx (const xsh_pre *pre)
 Get pszx of pre structure.
 
void xsh_pre_from_raw_get (xsh_pre *pre, double raw_x, double raw_y, double *x, double *y)
 Get x, y coordinates in image from RAW coordinates.
 
float xsh_pre_get_pszy (const xsh_pre *pre)
 Get pszy of pre structure.
 
float xsh_pre_get_gain (const xsh_pre *pre)
 Get gain of pre structure.
 
cpl_frame_group xsh_pre_get_group (const xsh_pre *pre)
 Get ny of pre structure.
 
cpl_mask * xsh_pre_get_bpmap (const xsh_pre *pre)
 Get bpmap of pre structure.
 
void xsh_pre_add (xsh_pre *self, const xsh_pre *right)
 Add two PRE images.
 
cpl_frameset * xsh_pre_frameset_subtract_frame (cpl_frameset *set, cpl_frame *sub, const char *spec, xsh_instrument *instr)
 Subtract 2 frames (in XSH_PRE format) Just loads the 2 frames, subtract (xsh_pre_subtract) and save resulting frame.
 
cpl_frame * xsh_pre_frame_subtract (cpl_frame *one, cpl_frame *two, const char *filename, xsh_instrument *instr, const int clean_tmp)
 Subtract 2 frames (in XSH_PRE format) Just loads the 2 frames, subtract (xsh_pre_subtract) and save resulting frame.
 
void xsh_pre_subtract (xsh_pre *self, const xsh_pre *right)
 
Subtract one PRE image from another The data units are subtracted data = data1 - data2 The error images are propagated using sigma^2 = sigma1^2 + sigma2^2 The quality maps are or'e qual = qual1 U qual2
 
xsh_prexsh_pre_subsample (xsh_pre *self, const int binx, const int biny, const int rescale, xsh_instrument *inst)
 Subsample a PRE image of a bin factor binx X biny.
 
void xsh_pre_divide (xsh_pre *self, const xsh_pre *right, const int is_flat, double threshold)
 Divide a PRE image from another.
 
void xsh_pre_multiply (xsh_pre *self, const xsh_pre *right, double threshold)
 Multiply a PRE image from another.
 
void xsh_pre_normalize (xsh_pre *self)
 Normalize data flux.
 
void xsh_pre_median_mean_stdev (xsh_pre *preFrame, double *mean, double *median, double *stdev)
 
void xsh_pre_median_mean_stdev_window (xsh_pre *preFrame, double *mean, double *median, double *stdev, const int llx, const int lly, const int urx, const int ury)
 
int xsh_pre_window_best_median_flux_pos (xsh_pre *pre, int xcen, int ycen, int search_window_hsize, int running_median_hsize, int *xadj, int *yadj)
 Search pixel position of best running median flux in the search window.
 
double xsh_pre_data_window_median_flux_pa (xsh_pre *pre, int x, int y, int size_x, int size_y, double *tab, int *status)
 compute median sample value on the data window with preallocated memory tab. Only good pixels codes are used.
 
const cpl_propertylist * xsh_pre_get_header_const (const xsh_pre *pre)
 Get header.
 
cpl_propertylist * xsh_pre_get_header (xsh_pre *pre)
 Get header.
 
const cpl_image * xsh_pre_get_data_const (const xsh_pre *pre)
 Get data.
 
cpl_image * xsh_pre_get_data (xsh_pre *pre)
 Get data.
 
const cpl_image * xsh_pre_get_errs_const (const xsh_pre *pre)
 Get errs.
 
cpl_image * xsh_pre_get_errs (xsh_pre *pre)
 Get errs.
 
const cpl_image * xsh_pre_get_qual_const (const xsh_pre *pre)
 Get QUAL.
 
cpl_image * xsh_pre_get_qual (xsh_pre *pre)
 Get qual.
 
const double * xsh_pre_get_data_buffer_const (const xsh_pre *pre)
 Get data buffer.
 
double * xsh_pre_get_data_buffer (xsh_pre *pre)
 Get data buffer.
 
const double * xsh_pre_get_errs_buffer_const (const xsh_pre *pre)
 Get errs buffer.
 
double * xsh_pre_get_errs_buffer (xsh_pre *pre)
 Get errs buffer.
 
void xsh_pre_dump (const xsh_pre *pre, FILE *stream)
 Dump image to stream.
 
void xsh_pre_multiply_scalar (const xsh_pre *pre, double x)
 multiply a frame in PRE format by a scalar
 
void xsh_pre_divide_scalar (const xsh_pre *pre, double x)
 divides a frame in PRE format by a scalar
 
void xsh_pre_add_scalar (const xsh_pre *pre, double x)
 add a scalar to a frame in PRE format
 
void xsh_pre_subtract_scalar (const xsh_pre *pre, double x)
 subtract a scalar from a frame in PRE format
 
void xsh_pre_multiply_image (const xsh_pre *pre, cpl_image *img)
 multiply a frame in PRE format by an image
 
cpl_image * xsh_pre_abs (const xsh_pre *pre)
 computes absolute value of a frame in PRE format
 
cpl_frame * xsh_frameset_average_pre (cpl_frameset *set, xsh_instrument *instr, const char *tag)
 Average set of frames in PRE format.
 
void xsh_pre_turn (xsh_pre *pre, int rot)
 
void xsh_pre_extract (xsh_pre *pre, int xmin, int ymin, int xmax, int ymax)
 Create a sub pre image.
 
void xsh_pre_flip (xsh_pre *pre, int angle)
 Flip an image on a given miror line.
 

Detailed Description

Function Documentation

◆ xsh_compute_ron_nir()

double xsh_compute_ron_nir ( const double  dit)

Definition at line 247 of file xsh_data_pre.c.

Referenced by xsh_pre_init(), xsh_sdp_spectrum_create(), and xsh_subtract_sky_single().

◆ xsh_frameset_average_pre()

cpl_frame * xsh_frameset_average_pre ( cpl_frameset *  set,
xsh_instrument instr,
const char *  tag 
)

Average set of frames in PRE format.

Parameters
setthe input frameset
instrthe instrument setting
tagthe output frame tag
Returns
the frame product

Definition at line 2756 of file xsh_data_pre.c.

References check, xsh_pre::data, xsh_pre::errs, xsh_pre::qual, size, xsh_frame_product(), xsh_free_frame(), xsh_free_image(), xsh_free_imagelist(), xsh_free_propertylist(), xsh_pre_free(), xsh_pre_load(), and xsh_pre_save().

Referenced by xsh_respon_slit_offset(), and xsh_scired_slit_offset().

◆ xsh_pre_abs()

cpl_image * xsh_pre_abs ( const xsh_pre pre)

computes absolute value of a frame in PRE format

Parameters
preframe in PRE format
Returns
image = |pre|

Definition at line 2713 of file xsh_data_pre.c.

References check, xsh_pre::data, xsh_pre::nx, xsh_pre::ny, size, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_frame_abs().

◆ xsh_pre_add()

void xsh_pre_add ( xsh_pre self,
const xsh_pre right 
)

Add two PRE images.

Parameters
selfThe first operand modified by the add operation
rightThe second image to add

The input images must have same size.

The data units are added: data = data1 + data2

The error images are propagated using sigma^2 = sigma1^2 + sigma2^2

The quality maps are or'ed qual = qual1 U qual2

fixme: Verify that this is a sensible way of propagating the bad pixel maps.

Definition at line 1411 of file xsh_data_pre.c.

References assure, check, xsh_pre::data, xsh_pre::errs, xsh_pre::nx, xsh_pre::ny, XSH_ASSURE_NOT_NULL, xsh_badpixelmap_or(), xsh_pre_get_nx(), and xsh_pre_get_ny().

Referenced by main().

◆ xsh_pre_add_scalar()

void xsh_pre_add_scalar ( const xsh_pre pre,
double  x 
)

add a scalar to a frame in PRE format

Parameters
preframe in PRE format
xscalar

Definition at line 2651 of file xsh_data_pre.c.

References check, xsh_pre::data, x, XSH_ASSURE_NOT_ILLEGAL, and XSH_ASSURE_NOT_NULL.

◆ xsh_pre_create()

xsh_pre * xsh_pre_create ( cpl_frame *  raw,
cpl_frame *  bpmap,
cpl_image *  bias_data,
xsh_instrument instr,
const int  pre_overscan_corr,
const bool  flag_neg_and_thresh_pix 
)

Create a XSH_PRE from a raw frame.

Parameters
[in]rawThe raw frame
[in]bpmapThe bad pixel map associated to the data or NULL if not
[in]bias_dataThe bias data image or NULL if not
[in]instrThe instrument to be attached
[in]pre_overscan_corrswitch to use or not pre/overscan for bias estimation
Returns
A newly allocated XSH_PRE structure
Return values
NULLin case of error

The data and errs units are initialized to zero.

Definition at line 450 of file xsh_data_pre.c.

References assure, check, check_msg, xsh_pre::conad, xsh_pre::cutmx, xsh_pre::cutmy, xsh_pre::cutx, xsh_pre::cuty, xsh_pre::data, xsh_pre::data_header, xsh_instrument::decode_bp, xsh_pre::decode_bp, xsh_pre::errs, xsh_pre::errs_header, xsh_pre::group, xsh_pre::instrument, xsh_pre::naxis1, xsh_pre::naxis2, xsh_pre::nx, xsh_pre::ny, xsh_pre::qual, xsh_pre::qual_header, xsh_pre::ron, XSH_ARM_NIR, XSH_ARM_UVB, XSH_ARM_VIS, XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_ILLEGAL_MSG, XSH_ASSURE_NOT_NULL, xsh_badpixelmap_count_range_pixels(), xsh_badpixelmap_flag_saturated_pixels(), xsh_badpixelmap_image_coadd(), XSH_BIAS_UVB, XSH_BIAS_VIS, XSH_BP_MAP_NL_UVB, XSH_BP_MAP_NL_VIS, XSH_CALLOC, XSH_DPR_TECH_SINGLE_PINHOLE, XSH_DPR_TYPE, xsh_free_image(), xsh_free_propertylist(), xsh_image_flag_bp(), xsh_instrument_get_arm(), xsh_instrument_get_binx(), xsh_instrument_get_biny(), XSH_LINEARITY_UVB, XSH_LINEARITY_VIS, xsh_msg, xsh_msg_dbg_low, xsh_msg_dbg_medium, XSH_NEW_PROPERTYLIST, XSH_NIR_DEFAULT_CUT, xsh_pfits_get_naxis1(), xsh_pfits_get_naxis2(), xsh_pfits_is_flat(), xsh_pfits_set_dpr_tech(), xsh_pfits_set_extname(), xsh_pfits_set_frac_range_pix(), xsh_pfits_set_frac_sat(), xsh_pfits_set_n_range_pix(), xsh_pfits_set_nsat(), xsh_pfits_set_wcs(), XSH_PRE_DATA_TYPE, xsh_pre_free(), xsh_pre_init(), XSH_PRE_QUAL_TYPE, xsh_preoverscan_corr(), XSH_RAW_BP_MAP_NL_UVB, XSH_RAW_BP_MAP_NL_VIS, XSH_RAW_IMA_SLIT_UVB, and XSH_RAW_IMA_SLIT_VIS.

Referenced by main(), xsh_bpmap_2pre(), xsh_lingain(), xsh_prepare(), and xsh_util_bpmap_nl_raw2pre().

◆ xsh_pre_data_window_median_flux_pa()

double xsh_pre_data_window_median_flux_pa ( xsh_pre pre,
int  x,
int  y,
int  size_x,
int  size_y,
double *  tab,
int *  status 
)

compute median sample value on the data window with preallocated memory tab. Only good pixels codes are used.

Parameters
prethe PRE image
xcoordinate along X axis of window first pixel
ycoordinate along Y axis of window first pixel
size_xsize of the window along X axis
size_ysize of the window along Y axis
tabpreallocated memory of sizex * sizey
Returns
the sample value of the window data

Definition at line 2310 of file xsh_data_pre.c.

References check, xsh_pre::data, xsh_pre::decode_bp, xsh_pre::nx, nx, xsh_pre::ny, ny, xsh_pre::qual, size, x, XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_NULL, xsh_unwrap_vector(), and y.

Referenced by xsh_pre_window_best_median_flux_pos().

◆ xsh_pre_divide()

void xsh_pre_divide ( xsh_pre self,
const xsh_pre right,
const int  is_flat,
double  threshold 
)

Divide a PRE image from another.

Parameters
selfThe first operand modified by the divide operation
rightThe image to divide with
thresholdminimal value to divide

The input images must have same size.

The data units are divided: data = data1 / data2

The error images are propagated using

sigma = abs(1/ data2) * sqrt(sigma1^2 + data1^2 * sigma2^2 / data2^2)

The quality maps are or'ed qual = qual1 U qual2

Definition at line 1785 of file xsh_data_pre.c.

References assure, check, xsh_pre::data, xsh_pre::decode_bp, xsh_pre::errs, xsh_pre::nx, xsh_pre::ny, QFLAG_CALIB_FILE_DEFECT, QFLAG_DIVISOR_ZERO, QFLAG_SATURATED_DATA, xsh_pre::qual, threshold, xsh_pre_get_nx(), and xsh_pre_get_ny().

Referenced by xsh_divide_flat().

◆ xsh_pre_divide_scalar()

void xsh_pre_divide_scalar ( const xsh_pre pre,
double  x 
)

divides a frame in PRE format by a scalar

Parameters
preframe in PRE format
xscalar

Definition at line 2629 of file xsh_data_pre.c.

References check, xsh_pre::data, xsh_pre::errs, x, XSH_ASSURE_NOT_ILLEGAL, and XSH_ASSURE_NOT_NULL.

◆ xsh_pre_dump()

void xsh_pre_dump ( const xsh_pre pre,
FILE *  stream 
)

Dump image to stream.

Parameters
preThe PRE image to dump
streamThe stream to dump to

This function might be used for debugging purposes.

Definition at line 2580 of file xsh_data_pre.c.

References xsh_pre::data, and xsh_free_stats().

◆ xsh_pre_duplicate()

xsh_pre * xsh_pre_duplicate ( const xsh_pre pre)

◆ xsh_pre_extract()

void xsh_pre_extract ( xsh_pre pre,
int  xmin,
int  ymin,
int  xmax,
int  ymax 
)

Create a sub pre image.

Parameters
preThe image to cut (PRE format)
xminx lower left point of the result image (FITS coordinate)
yminy lower left point of the result image (FITS coordinate)
xmaxx upper left point of the result image (FITS coordinate)
ymaxy upper left point of the result image (FITS coordinate)

Definition at line 2875 of file xsh_data_pre.c.

References check, xsh_pre::data, xsh_pre::errs, xsh_pre::qual, XSH_ASSURE_NOT_NULL, xsh_free_image(), xsh_pre_get_data(), xsh_pre_get_errs(), and xsh_pre_get_qual().

Referenced by xsh_preframe_extract().

◆ xsh_pre_flip()

void xsh_pre_flip ( xsh_pre pre,
int  angle 
)

Flip an image on a given miror line.

Parameters
preImage to turn (PRE format)
anglemirror line in polar coord. is theta = (PI/4) * angle

Definition at line 2911 of file xsh_data_pre.c.

References check, XSH_ASSURE_NOT_NULL, xsh_pre_get_data(), xsh_pre_get_errs(), and xsh_pre_get_qual().

Referenced by xsh_cube(), and xsh_format().

◆ xsh_pre_frame_subtract()

cpl_frame * xsh_pre_frame_subtract ( cpl_frame *  one,
cpl_frame *  two,
const char *  filename,
xsh_instrument instr,
const int  clean_tmp 
)

Subtract 2 frames (in XSH_PRE format) Just loads the 2 frames, subtract (xsh_pre_subtract) and save resulting frame.

Parameters
oneFirst pre frame
twoSecond pre frame
filenameName of the saved subtracted file
instrPointer to the instrument description structure
Returns
The result frame (one - two)

Definition at line 1528 of file xsh_data_pre.c.

References check, xsh_add_temporary_file(), XSH_ASSURE_NOT_NULL, xsh_pre_duplicate(), xsh_pre_free(), xsh_pre_get_group(), xsh_pre_load(), xsh_pre_save(), and xsh_pre_subtract().

Referenced by xsh_orderpos(), xsh_pre_frameset_subtract_frame(), xsh_save_sky_model(), xsh_subtract_sky_nod(), and xsh_subtract_sky_offset().

◆ xsh_pre_frameset_subtract_frame()

cpl_frameset * xsh_pre_frameset_subtract_frame ( cpl_frameset *  set,
cpl_frame *  sub,
const char *  spec,
xsh_instrument instr 
)

Subtract 2 frames (in XSH_PRE format) Just loads the 2 frames, subtract (xsh_pre_subtract) and save resulting frame.

Parameters
setFrameset to be corrected
subpre frame to be subtracted
specspecifier for Name of the saved subtracted file
instrPointer to the instrument description structure
Returns
The result frame (one - two)

Definition at line 1483 of file xsh_data_pre.c.

References size, and xsh_pre_frame_subtract().

Referenced by xsh_respon_slit_offset(), and xsh_scired_slit_offset().

◆ xsh_pre_free()

void xsh_pre_free ( xsh_pre **  pre)

Free a xsh_pre structure.

Parameters
preThe xsh_pre structure to free

Definition at line 823 of file xsh_data_pre.c.

References xsh_free_image(), and xsh_free_propertylist().

Referenced by add_noisy_pixels(), get_max_pos(), main(), save_pre_frame(), verifCr(), verify_noisy(), xsh_add_product_pre(), xsh_add_sky_model(), xsh_bpmap_2pre(), xsh_compute_noise_map(), xsh_compute_qc_on_master_bias(), xsh_compute_resampling_accuracy(), xsh_compute_wavelength_resampling_accuracy(), xsh_create_blaze(), xsh_create_dispersol_physmod(), xsh_create_map(), xsh_create_master_bias2(), xsh_create_master_dark(), xsh_create_master_dark2(), xsh_create_master_dark_bpmap(), xsh_create_master_flat(), xsh_create_master_flat_with_mask(), xsh_create_order_table(), xsh_create_poly_wavemap(), xsh_cube(), xsh_detect_arclines(), xsh_detect_arclines_dan(), xsh_detect_continuum(), xsh_detect_order_edge(), xsh_divide_by_blaze(), xsh_divide_flat(), xsh_flat_merge_qth_d2(), xsh_flat_merge_qth_d2_smooth(), xsh_follow_arclines(), xsh_format(), xsh_frame_abs(), xsh_frame_divide_flat(), xsh_frame_inv(), xsh_frame_mult(), xsh_frame_pre_subsample(), xsh_frame_qual_update(), xsh_frameset_add(), xsh_frameset_average_pre(), xsh_image_mflat_detect_blemishes(), xsh_lingain(), xsh_mdark(), xsh_mdark_compute_fpn(), xsh_mdark_get_median_stdev(), xsh_multiply_flat(), xsh_opt_extract_orders(), xsh_pre_create(), xsh_pre_duplicate(), xsh_pre_frame_subtract(), xsh_pre_load(), xsh_pre_new(), xsh_preframe_extract(), xsh_prepare(), xsh_qc_write_to_flat(), xsh_rectify_orders(), xsh_remove_cosmics(), xsh_remove_crh_single(), xsh_respon_slit_offset(), xsh_respon_slit_stare(), xsh_scired_slit_stare(), xsh_subtract_background(), xsh_subtract_bias(), xsh_subtract_dark(), xsh_subtract_on_off(), xsh_subtract_sky_single(), xsh_util_bpmap_nl_raw2pre(), xsh_util_ima_arith(), xsh_wavelist_subtract_sky(), xsh_wavemap_list_object_image_save(), xsh_wavemap_list_save4debug(), and xsh_wavemap_list_sky_image_save().

◆ xsh_pre_from_raw_get()

void xsh_pre_from_raw_get ( xsh_pre pre,
double  raw_x,
double  raw_y,
double *  x,
double *  y 
)

Get x, y coordinates in image from RAW coordinates.

Parameters
prethe pre structure
raw_xRaw X pixel
raw_yRaw Y pixel
xResult X value
yResult Y value

x = raw_y - pre->cuty;

Definition at line 1280 of file xsh_data_pre.c.

References xsh_pre::cutx, xsh_pre::cuty, xsh_pre::instrument, xsh_pre::ny, x, XSH_ARM_NIR, XSH_ASSURE_NOT_NULL, xsh_instrument_get_arm(), and y.

◆ xsh_pre_get_binx()

int xsh_pre_get_binx ( const xsh_pre pre)

Get binx of pre structure.

Parameters
prethe pre structure
Returns
the binx value

Definition at line 1223 of file xsh_data_pre.c.

References xsh_pre::binx, and XSH_ASSURE_NOT_NULL.

◆ xsh_pre_get_biny()

int xsh_pre_get_biny ( const xsh_pre pre)

Get biny of pre structure.

Parameters
prethe pre structure
Returns
the ny value

Definition at line 1241 of file xsh_data_pre.c.

References xsh_pre::biny, and XSH_ASSURE_NOT_NULL.

◆ xsh_pre_get_bpmap()

cpl_mask * xsh_pre_get_bpmap ( const xsh_pre pre)

Get bpmap of pre structure.

Parameters
prethe pre structure
Returns
the cpl_mask represented the bpmap

Definition at line 1366 of file xsh_data_pre.c.

References check, xsh_pre::decode_bp, xsh_pre::nx, xsh_pre::ny, xsh_pre::qual, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_remove_cosmics().

◆ xsh_pre_get_data()

cpl_image * xsh_pre_get_data ( xsh_pre pre)

◆ xsh_pre_get_data_buffer()

double * xsh_pre_get_data_buffer ( xsh_pre pre)

Get data buffer.

Parameters
preThe PRE image
Returns
Pointer to existing data buffer

Definition at line 2534 of file xsh_data_pre.c.

References xsh_pre_get_data_buffer_const().

◆ xsh_pre_get_data_buffer_const()

const double * xsh_pre_get_data_buffer_const ( const xsh_pre pre)

Get data buffer.

Parameters
preThe PRE image
Returns
Pointer to existing data buffer

Definition at line 2512 of file xsh_data_pre.c.

References xsh_pre::data, passure, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_pre_get_data_buffer().

◆ xsh_pre_get_data_const()

const cpl_image * xsh_pre_get_data_const ( const xsh_pre pre)

Get data.

Parameters
preThe PRE image
Returns
Pointer to existing data image

Definition at line 2423 of file xsh_data_pre.c.

References xsh_pre::data, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_pre_get_data().

◆ xsh_pre_get_errs()

cpl_image * xsh_pre_get_errs ( xsh_pre pre)

◆ xsh_pre_get_errs_buffer()

double * xsh_pre_get_errs_buffer ( xsh_pre pre)

Get errs buffer.

Parameters
preThe PRE image
Returns
Pointer to existing errs buffer

Definition at line 2565 of file xsh_data_pre.c.

References xsh_pre_get_errs_buffer_const().

◆ xsh_pre_get_errs_buffer_const()

const double * xsh_pre_get_errs_buffer_const ( const xsh_pre pre)

Get errs buffer.

Parameters
preThe PRE image
Returns
Pointer to existing errs buffer

Definition at line 2546 of file xsh_data_pre.c.

References xsh_pre::errs, passure, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_pre_get_errs_buffer().

◆ xsh_pre_get_errs_const()

const cpl_image * xsh_pre_get_errs_const ( const xsh_pre pre)

Get errs.

Parameters
preThe PRE image
Returns
Pointer to existing errs image

Definition at line 2453 of file xsh_data_pre.c.

References xsh_pre::errs, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_pre_get_errs().

◆ xsh_pre_get_gain()

float xsh_pre_get_gain ( const xsh_pre pre)

Get gain of pre structure.

Parameters
prethe pre structure
Returns
the gain value

Definition at line 1332 of file xsh_data_pre.c.

References xsh_pre::gain, and XSH_ASSURE_NOT_NULL.

◆ xsh_pre_get_group()

cpl_frame_group xsh_pre_get_group ( const xsh_pre pre)

Get ny of pre structure.

Parameters
prethe pre structure
Returns
the ny value

Definition at line 1349 of file xsh_data_pre.c.

References xsh_pre::group, and XSH_ASSURE_NOT_NULL.

Referenced by main(), xsh_pre_duplicate(), xsh_pre_frame_subtract(), and xsh_pre_save().

◆ xsh_pre_get_header()

cpl_propertylist * xsh_pre_get_header ( xsh_pre pre)

Get header.

Parameters
preThe PRE image
Returns
Pointer to existing PRE image header.

Definition at line 2407 of file xsh_data_pre.c.

References XSH_ASSURE_NOT_NULL, and xsh_pre_get_header_const().

◆ xsh_pre_get_header_const()

const cpl_propertylist * xsh_pre_get_header_const ( const xsh_pre pre)

Get header.

Parameters
preThe PRE image
Returns
Pointer to existing PRE image header.

Definition at line 2388 of file xsh_data_pre.c.

References xsh_pre::data_header, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_pre_get_header().

◆ xsh_pre_get_nx()

int xsh_pre_get_nx ( const xsh_pre pre)

◆ xsh_pre_get_ny()

int xsh_pre_get_ny ( const xsh_pre pre)

◆ xsh_pre_get_pszx()

float xsh_pre_get_pszx ( const xsh_pre pre)

Get pszx of pre structure.

Parameters
prethe pre structure
Returns
the pszx value

Definition at line 1259 of file xsh_data_pre.c.

References assure, and xsh_pre::pszx.

◆ xsh_pre_get_pszy()

float xsh_pre_get_pszy ( const xsh_pre pre)

Get pszy of pre structure.

Parameters
prethe pre structure
Returns
the pszy value

Definition at line 1314 of file xsh_data_pre.c.

References xsh_pre::pszy, and XSH_ASSURE_NOT_NULL.

◆ xsh_pre_get_qual()

cpl_image * xsh_pre_get_qual ( xsh_pre pre)

◆ xsh_pre_get_qual_const()

const cpl_image * xsh_pre_get_qual_const ( const xsh_pre pre)

Get QUAL.

Parameters
preThe PRE image
Returns
Pointer to existing qual image

Definition at line 2483 of file xsh_data_pre.c.

References xsh_pre::qual, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_pre_get_qual().

◆ xsh_pre_init()

static void xsh_pre_init ( xsh_pre pre,
cpl_propertylist *  header,
xsh_instrument instrument 
)
static

◆ xsh_pre_load()

xsh_pre * xsh_pre_load ( cpl_frame *  frame,
xsh_instrument instr 
)

Load a xsh_pre structure from a frame.

Parameters
[in]frameThe frame pointing on the file to load
instrThe instrument to be attached
Returns

A newly allocated PRE structure

Definition at line 849 of file xsh_data_pre.c.

References assure, check, check_msg, xsh_pre::data, xsh_instrument::decode_bp, xsh_pre::decode_bp, xsh_pre::errs, xsh_pre::errs_header, xsh_pre::group, xsh_pre::instrument, xsh_pre::naxis1, xsh_pre::naxis2, xsh_pre::nx, xsh_pre::ny, xsh_pre::qual, xsh_pre::qual_header, XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_NULL, XSH_CALLOC, xsh_error_msg, xsh_pfits_get_extname(), XSH_PRE_DATA_TYPE, XSH_PRE_ERRS_TYPE, xsh_pre_free(), xsh_pre_init(), and XSH_PRE_QUAL_TYPE.

Referenced by add_noisy_pixels(), get_max_pos(), main(), save_pre_frame(), verifCr(), verify_noisy(), xsh_add_product_pre(), xsh_add_sky_model(), xsh_compute_noise_map(), xsh_compute_qc_on_master_bias(), xsh_create_blaze(), xsh_create_dispersol_physmod(), xsh_create_map(), xsh_create_master_bias2(), xsh_create_master_dark(), xsh_create_master_dark2(), xsh_create_master_dark_bpmap(), xsh_create_master_flat(), xsh_create_master_flat_with_mask(), xsh_create_order_table(), xsh_create_poly_wavemap(), xsh_cube(), xsh_detect_arclines(), xsh_detect_arclines_dan(), xsh_detect_continuum(), xsh_detect_order_edge(), xsh_divide_by_blaze(), xsh_divide_flat(), xsh_flat_merge_qth_d2(), xsh_flat_merge_qth_d2_smooth(), xsh_follow_arclines(), xsh_format(), xsh_frame_abs(), xsh_frame_divide_flat(), xsh_frame_inv(), xsh_frame_mult(), xsh_frame_pre_subsample(), xsh_frame_qual_update(), xsh_frameset_add(), xsh_frameset_average_pre(), xsh_hdrl_remove_crh_single(), xsh_image_mflat_detect_blemishes(), xsh_mdark(), xsh_mdark_compute_fpn(), xsh_multiply_flat(), xsh_opt_extract_orders(), xsh_pre_frame_subtract(), xsh_preframe_extract(), xsh_prepare(), xsh_qc_write_to_flat(), xsh_rectify_orders(), xsh_remove_cosmics(), xsh_remove_crh_single(), xsh_respon_slit_offset(), xsh_respon_slit_stare(), xsh_scired_slit_stare(), xsh_subtract_background(), xsh_subtract_bias(), xsh_subtract_dark(), xsh_subtract_on_off(), and xsh_subtract_sky_single().

◆ xsh_pre_median_mean_stdev()

void xsh_pre_median_mean_stdev ( xsh_pre preFrame,
double *  mean,
double *  median,
double *  stdev 
)

Calculate average, median, stdev taking into account the bad pixels ( from the bad pixel map frame->qual)

Parameters
preFrameXSH_PRE strucure
meanAverage value
medianMedian value
stdevStandard deviation (output)

Definition at line 2009 of file xsh_data_pre.c.

References assure, check, xsh_pre::data, xsh_pre::decode_bp, nx, ny, xsh_pre::qual, XSH_ASSURE_NOT_NULL, xsh_free_vector(), xsh_pre_get_nx(), and xsh_pre_get_ny().

Referenced by main().

◆ xsh_pre_median_mean_stdev_window()

void xsh_pre_median_mean_stdev_window ( xsh_pre preFrame,
double *  mean,
double *  median,
double *  stdev,
const int  llx,
const int  lly,
const int  urx,
const int  ury 
)

Calculate average, median, stdev taking into account the bad pixels ( from the bad pixel map frame->qual) in a given window

Parameters
preFrameXSH_PRE strucure
meanAverage value
medianMedian value
stdevstandard deviation value
llxlower left x value
llylower left x value
urxupper right x value
uryupper right y value

Definition at line 2068 of file xsh_data_pre.c.

References assure, check, xsh_pre::data, xsh_pre::decode_bp, kappa, llx, lly, nx, ny, xsh_pre::qual, urx, ury, XSH_ASSURE_NOT_NULL, xsh_free_table(), xsh_free_vector(), xsh_pre_get_nx(), and xsh_pre_get_ny().

Referenced by set_masterbias_qc_xsh_structure_region(), and xsh_mdark_get_median_stdev().

◆ xsh_pre_multiply()

void xsh_pre_multiply ( xsh_pre self,
const xsh_pre right,
double  threshold 
)

Multiply a PRE image from another.

Parameters
selfThe first operand modified by the multiply operation
rightThe image to multiply with
thresholdminimal value to multiply

The input images must have same size.

The data units are divided: data = data1 * data2

The error images are propagated using sigma = sqrt( data2^2 * sigma1^2 + data1^2 sigma2^2 )

The quality maps are or'ed qual = qual1 U qual2

Definition at line 1893 of file xsh_data_pre.c.

References assure, check, xsh_pre::data, xsh_pre::decode_bp, xsh_pre::errs, xsh_pre::nx, xsh_pre::ny, QFLAG_OUTSIDE_DATA_RANGE, xsh_pre::qual, threshold, xsh_pre_get_nx(), and xsh_pre_get_ny().

Referenced by xsh_multiply_flat().

◆ xsh_pre_multiply_image()

void xsh_pre_multiply_image ( const xsh_pre pre,
cpl_image *  img 
)

multiply a frame in PRE format by an image

Parameters
preframe in PRE format
imgimage

Definition at line 2689 of file xsh_data_pre.c.

References check, xsh_pre::data, xsh_pre::errs, XSH_ASSURE_NOT_NULL, and xsh_free_image().

Referenced by xsh_frame_mult(), and xsh_opt_extract_orders().

◆ xsh_pre_multiply_scalar()

void xsh_pre_multiply_scalar ( const xsh_pre pre,
double  x 
)

multiply a frame in PRE format by a scalar

Parameters
preframe in PRE format
xscalar

Definition at line 2609 of file xsh_data_pre.c.

References check, xsh_pre::data, xsh_pre::errs, x, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_frame_inv(), and xsh_subtract_dark().

◆ xsh_pre_new()

xsh_pre * xsh_pre_new ( int  nx,
int  ny 
)

Create new PRE image.

Parameters
nxThe x-size
nyThe y-size
Returns
The newly allocated PRE image

The data and errs units are initialized to zero.

Definition at line 1152 of file xsh_data_pre.c.

References assure, check, xsh_pre::data, xsh_pre::data_header, xsh_pre::errs, xsh_pre::errs_header, xsh_pre::nx, nx, xsh_pre::ny, ny, xsh_pre::qual, xsh_pre::qual_header, XSH_CALLOC, XSH_PRE_DATA_TYPE, XSH_PRE_ERRS_TYPE, xsh_pre_free(), and XSH_PRE_QUAL_TYPE.

Referenced by xsh_pre_subsample(), xsh_wavemap_list_object_image_save(), xsh_wavemap_list_save4debug(), and xsh_wavemap_list_sky_image_save().

◆ xsh_pre_normalize()

void xsh_pre_normalize ( xsh_pre self)

Normalize data flux.

Parameters
selfThe PRE image to normalize

Definition at line 1969 of file xsh_data_pre.c.

References check, xsh_pre::data, xsh_pre::errs, XSH_ASSURE_NOT_NULL, and xsh_msg.

Referenced by xsh_create_master_flat().

◆ xsh_pre_save()

cpl_frame * xsh_pre_save ( const xsh_pre pre,
const char *  filename,
const char *  tag,
int  temp 
)

Save PRE on disk.

Parameters
preto save
filenameThe file to save to
tagThe file pro catg
tempFlag if 1 frame is temporary file
Returns
A frame pointing to the file that was saved

Definition at line 1019 of file xsh_data_pre.c.

References check, check_msg, xsh_pre::data, xsh_pre::data_header, xsh_pre::errs, xsh_pre::errs_header, xsh_pre::qual, xsh_pre::qual_header, xsh_add_temporary_file(), XSH_ASSURE_NOT_NULL, XSH_BUNIT_FLUX_REL_C, XSH_BUNIT_NONE_C, xsh_free_frame(), xsh_pfits_set_bunit(), xsh_pfits_set_pcatg(), XSH_PRE_DATA_BPP, XSH_PRE_ERRS_BPP, xsh_pre_get_group(), and XSH_PRE_QUAL_BPP.

Referenced by add_noisy_pixels(), main(), save_pre_frame(), xsh_add_product_pre(), xsh_add_sky_model(), xsh_bpmap_2pre(), xsh_compute_qc_on_master_bias(), xsh_create_master_bias2(), xsh_create_master_dark(), xsh_create_master_dark2(), xsh_create_master_flat(), xsh_create_master_flat_with_mask(), xsh_divide_by_blaze(), xsh_divide_flat(), xsh_flat_merge_qth_d2(), xsh_flat_merge_qth_d2_smooth(), xsh_frame_abs(), xsh_frame_divide_flat(), xsh_frame_inv(), xsh_frame_mult(), xsh_frame_pre_subsample(), xsh_frame_qual_update(), xsh_frameset_add(), xsh_frameset_average_pre(), xsh_hdrl_remove_crh_single(), xsh_image_mflat_detect_blemishes(), xsh_lingain(), xsh_mdark(), xsh_multiply_flat(), xsh_opt_extract_orders(), xsh_pre_frame_subtract(), xsh_pre_save_product(), xsh_preframe_extract(), xsh_prepare(), xsh_qc_write_to_flat(), xsh_remove_cosmics(), xsh_remove_crh_single(), xsh_scired_slit_stare(), xsh_subtract_background(), xsh_subtract_bias(), xsh_subtract_dark(), xsh_subtract_on_off(), xsh_util_bpmap_nl_raw2pre(), xsh_wavelist_subtract_sky(), xsh_wavemap_list_object_image_save(), xsh_wavemap_list_save4debug(), and xsh_wavemap_list_sky_image_save().

◆ xsh_pre_save_product()

cpl_frame * xsh_pre_save_product ( xsh_pre pre,
cpl_frame *  frame,
cpl_frameset *  frameset,
const cpl_parameterlist *  parameters,
const char *  recipe_id,
const char *  prefix 
)

Save PRE frame like a product on disk.

Parameters
prethe pre image structure
frameThe frame describing the product
framesetThe initial frameset containing raw frames
parametersThe recipe parameters
recipe_idThe recipe id
prefixPrefix used to build the filename
Returns
A frame pointing to the file product

Definition at line 1084 of file xsh_data_pre.c.

References xsh_pre::binx, xsh_pre::biny, check, xsh_pre::data_header, xsh_instrument::dictionary, xsh_pre::instrument, xsh_instrument::pipeline_id, XSH_ASSURE_NOT_NULL, XSH_FREE, xsh_free_frame(), xsh_pfits_get_pcatg(), xsh_pre_save(), xsh_sdate_utc(), and xsh_time_stamp_get().

◆ xsh_pre_subsample()

xsh_pre * xsh_pre_subsample ( xsh_pre self,
const int  binx,
const int  biny,
const int  rescale,
xsh_instrument inst 
)

Subsample a PRE image of a bin factor binx X biny.

Parameters
selfThe first operand modified by the divide operation
binxbin factor along X
binybin factor along Y
instinstrument setting
Returns
subsampled image

The pixel intensities are summed over the integration bin size: data = sum_ij (data_i+data_j) for 0<i<binx; 0<j<biny;

The error images are propagated with sum squares

sigma = sqrt{ sum_ij[sigma_i^2 + sigma_j^2 ) ]}

The quality maps are or'ed qual = qual1 U qual2

Definition at line 1664 of file xsh_data_pre.c.

References assure, binx, biny, check, xsh_pre::data, xsh_pre::errs, m, xsh_pre::nx, nx, xsh_pre::ny, ny, xsh_pre::qual, rescale, and xsh_pre_new().

Referenced by xsh_frame_pre_subsample().

◆ xsh_pre_subtract()

void xsh_pre_subtract ( xsh_pre self,
const xsh_pre right 
)


Subtract one PRE image from another The data units are subtracted data = data1 - data2 The error images are propagated using sigma^2 = sigma1^2 + sigma2^2 The quality maps are or'e qual = qual1 U qual2

Parameters
[in]selfThe first operand modified by the subtract operation
[in]rightThe image to subtract

Definition at line 1589 of file xsh_data_pre.c.

References assure, check, xsh_pre::data, xsh_pre::errs, xsh_pre::nx, xsh_pre::ny, XSH_ASSURE_NOT_NULL, xsh_badpixelmap_or(), xsh_pre_get_nx(), and xsh_pre_get_ny().

Referenced by main(), xsh_mdark_compute_fpn(), xsh_pre_frame_subtract(), xsh_subtract_bias(), xsh_subtract_dark(), and xsh_subtract_on_off().

◆ xsh_pre_subtract_scalar()

void xsh_pre_subtract_scalar ( const xsh_pre pre,
double  x 
)

subtract a scalar from a frame in PRE format

Parameters
preframe in PRE format
xscalar

Definition at line 2670 of file xsh_data_pre.c.

References check, xsh_pre::data, x, XSH_ASSURE_NOT_ILLEGAL, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_subtract_bias().

◆ xsh_pre_turn()

void xsh_pre_turn ( xsh_pre pre,
int  rot 
)

Rotate an image by an integer number of times 90 degrees (positive is counterclockwise). Uses cpl_image_turn.

Parameters
preImage to turn (PRE format)
rotNumber of 90 degrees to turn (counterclockwise)

Definition at line 2842 of file xsh_data_pre.c.

References check, XSH_ASSURE_NOT_NULL, xsh_pre_get_data(), xsh_pre_get_errs(), and xsh_pre_get_qual().

◆ xsh_pre_window_best_median_flux_pos()

int xsh_pre_window_best_median_flux_pos ( xsh_pre pre,
int  xcen,
int  ycen,
int  search_window_hsize,
int  running_median_hsize,
int *  xadj,
int *  yadj 
)

Search pixel position of best running median flux in the search window.

Parameters
[in]preThe PRE image
[in]xcenThe position in pixel along X axis defining the center of the search window
[in]ycenThe position in pixel along Y axis defining the center of the search window
[in]search_window_hsizeTHe half size of search box
[in]running_median_hsizeThe half size of running median box
[out]xadjThe finding pixel position along X
[out]yadjThe finding pixel position along Y

Definition at line 2200 of file xsh_data_pre.c.

References check, xsh_pre::decode_bp, xsh_pre::nx, xsh_pre::ny, xsh_pre::qual, XSH_ASSURE_NOT_NULL, XSH_CALLOC, XSH_CMP_INT, xsh_error_reset, XSH_FREE, xsh_msg_dbg_high, and xsh_pre_data_window_median_flux_pa().

Referenced by main(), xsh_detect_arclines(), and xsh_detect_arclines_dan().

◆ xsh_preoverscan_corr()

static cpl_error_code xsh_preoverscan_corr ( cpl_frame *  raw,
const int  corr_mode,
double *  cor_val 
)
static