Pre Format
[Data Format Handling functions]

Functions

static cpl_error_code xsh_preoverscan_corr (cpl_frame *raw, const int corr_mode, double *cor_val)
static 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)
 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)
 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.
void xsh_pre_divide (xsh_pre *self, const xsh_pre *right, 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)
 compute median on the data window with preallocated memory tab
double xsh_pre_data_window_sample_flux_pa (xsh_pre *pre, int x, int y, int size_x, int size_y, double *tab, const char *method, double min_window_frac)
 compute sample value (median/minimum) on the data window with preallocated memory tab
double xsh_pre_data_window_median_flux (xsh_pre *pre, int x, int y, int size_x, int size_y)
 compute median on the data window
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.

Function Documentation

static double xsh_compute_ron_nir ( const double  dit  )  [static]

Definition at line 230 of file xsh_data_pre.c.

Referenced by xsh_pre_init().

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

Average set of frames in PRE format.

Parameters:
set the input frameset
instr the instrument setting
tag the output frame tag
Returns:
the frame product

Definition at line 2653 of file xsh_data_pre.c.

References check, xsh_pre::data, xsh_pre::errs, xsh_pre::nx, nx, xsh_pre::ny, ny, xsh_pre::qual, size, xsh_frame_product(), 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().

cpl_image* xsh_pre_abs ( const xsh_pre pre  ) 

computes absolute value of a frame in PRE format

Parameters:
pre frame in PRE format
Returns:
image = |pre|

Definition at line 2610 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().

void xsh_pre_add ( xsh_pre self,
const xsh_pre right 
)

Add two PRE images.

Parameters:
self The first operand modified by the add operation
right The 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 1326 of file xsh_data_pre.c.

References assure, check, xsh_pre::data, xsh_pre::errs, QFLAG_CALIB_FILE_DEFECT, XSH_ASSURE_NOT_NULL, xsh_badpixelmap_or(), xsh_pre_get_bpmap(), xsh_pre_get_group(), xsh_pre_get_nx(), and xsh_pre_get_ny().

void xsh_pre_add_scalar ( const xsh_pre pre,
double  x 
)

add a scalar to a frame in PRE format

Parameters:
pre frame in PRE format
x scalar

Definition at line 2548 of file xsh_data_pre.c.

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

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

Create a XSH_PRE from a raw frame.

Parameters:
[in] raw The raw frame
[in] bpmap The bad pixel map associated to the data or NULL if not
[in] bias_data The bias data image or NULL if not
[in] instr The instrument to be attached
[in] pre_overscan_corr switch to use or not pre/overscan for bias estimation
Returns:
A newly allocated XSH_PRE structure
Return values:
NULL in case of error

The data and errs units are initialized to zero.

Definition at line 432 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_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_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_ILLEGAL_MSG, XSH_ASSURE_NOT_NULL, XSH_BIAS_UVB, XSH_BIAS_VIS, XSH_BP_MAP_NL_UVB, XSH_BP_MAP_NL_VIS, XSH_CALLOC, XSH_DPR_TECH_SINGLE_PINHOLE, xsh_free_image(), xsh_free_propertylist(), xsh_instrument_get_arm(), 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_set_bias_down_median(), xsh_pfits_set_bias_down_stdev(), xsh_pfits_set_bias_left_median(), xsh_pfits_set_bias_left_stdev(), xsh_pfits_set_bias_right_median(), xsh_pfits_set_bias_right_stdev(), xsh_pfits_set_bias_up_median(), xsh_pfits_set_bias_up_stdev(), xsh_pfits_set_dpr_tech(), xsh_pfits_set_extname(), xsh_pfits_set_frac_sat(), xsh_pfits_set_nsat(), 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().

double xsh_pre_data_window_median_flux ( xsh_pre pre,
int  x,
int  y,
int  size_x,
int  size_y 
)

compute median on the data window

Parameters:
pre the PRE image
x coordinate along X axis of window first pixel
y coordinate along Y axis of window first pixel
size_x size of the window along X axis
size_y size of the window along Y axis
Returns:
the median of the window data

Definition at line 2263 of file xsh_data_pre.c.

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

compute median on the data window with preallocated memory tab

Parameters:
pre the PRE image
x coordinate along X axis of window first pixel
y coordinate along Y axis of window first pixel
size_x size of the window along X axis
size_y size of the window along Y axis
tab preallocated memory of sizex * sizey
Returns:
the median of the window data

Definition at line 2074 of file xsh_data_pre.c.

References check, xsh_pre::data, xsh_pre::nx, nx, xsh_pre::ny, ny, xsh_pre::qual, size, XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_NULL, XSH_GOOD_PIXEL_LEVEL, xsh_msg_warning, xsh_unwrap_vector(), and XSH_WINDOW_MEDIAN_FRAC.

Referenced by xsh_pre_data_window_median_flux(), and xsh_pre_window_best_median_flux_pos().

double xsh_pre_data_window_sample_flux_pa ( xsh_pre pre,
int  x,
int  y,
int  size_x,
int  size_y,
double *  tab,
const char *  method,
double  min_window_frac 
)

compute sample value (median/minimum) on the data window with preallocated memory tab

Parameters:
pre the PRE image
x coordinate along X axis of window first pixel
y coordinate along Y axis of window first pixel
size_x size of the window along X axis
size_y size of the window along Y axis
tab preallocated memory of sizex * sizey
method method used for median determination
min_window_frac minimum allowed fraction of good detector pixels
Returns:
the sample value of the window data
Note:
generalization of xsh_pre_data_window_median_flux_pa

Definition at line 2163 of file xsh_data_pre.c.

References check, xsh_pre::data, xsh_pre::nx, nx, xsh_pre::ny, ny, xsh_pre::qual, size, XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_NULL, XSH_GOOD_PIXEL_LEVEL, xsh_msg_warning, xsh_unwrap_vector(), and XSH_WINDOW_MEDIAN_FRAC.

Referenced by xsh_subtract_background().

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

Divide a PRE image from another.

Parameters:
self The first operand modified by the divide operation
right The image to divide with
threshold minimal 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 = 1/ data2 * sqrt(sigma1^2 + sigma1^2 / sigma2^2 * data2^2 -2 * data1 / data2 * sigma1 * sigma2)

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

Definition at line 1576 of file xsh_data_pre.c.

References assure, check, xsh_pre::data, xsh_pre::errs, QFLAG_CALIB_FILE_DEFECT, QFLAG_DIVISOR_ZERO, xsh_pre::qual, XSH_GOOD_PIXEL_LEVEL, xsh_pre_get_group(), xsh_pre_get_nx(), and xsh_pre_get_ny().

Referenced by xsh_divide_flat().

void xsh_pre_divide_scalar ( const xsh_pre pre,
double  x 
)

divides a frame in PRE format by a scalar

Parameters:
pre frame in PRE format
x scalar

Definition at line 2526 of file xsh_data_pre.c.

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

void xsh_pre_dump ( const xsh_pre pre,
FILE *  stream 
)

Dump image to stream.

Parameters:
pre The PRE image to dump
stream The stream to dump to

This function might be used for debugging purposes.

Definition at line 2477 of file xsh_data_pre.c.

References xsh_pre::data, and xsh_free_stats().

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

Create a sub pre image.

Parameters:
pre The image to cut (PRE format)
xmin x lower left point of the result image (FITS coordinate)
ymin y lower left point of the result image (FITS coordinate)
xmax x upper left point of the result image (FITS coordinate)
ymax y upper left point of the result image (FITS coordinate)

Definition at line 2767 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().

void xsh_pre_flip ( xsh_pre pre,
int  angle 
)

Flip an image on a given miror line.

Parameters:
pre Image to turn (PRE format)
angle mirror line in polar coord. is theta = (PI/4) * angle

Definition at line 2803 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_format().

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

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

Parameters:
one First pre frame
two Second pre frame
filename Name of the saved subtracted file
instr Pointer to the instrument description structure
Returns:
The result frame (one - two)

Definition at line 1444 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().

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:
set Frameset to be corrected
sub pre frame to be subtracted
spec specifier for Name of the saved subtracted file
instr Pointer to the instrument description structure
Returns:
The result frame (one - two)

Definition at line 1400 of file xsh_data_pre.c.

References size, and xsh_pre_frame_subtract().

Referenced by xsh_respon_slit_offset(), and xsh_scired_slit_offset().

void xsh_pre_free ( xsh_pre **  pre  ) 
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:
pre the pre structure
raw_x Raw X pixel
raw_y Raw Y pixel
x Result X value
y Result Y value

x = raw_y - pre->cuty;

Definition at line 1195 of file xsh_data_pre.c.

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

int xsh_pre_get_binx ( const xsh_pre pre  ) 

Get binx of pre structure.

Parameters:
pre the pre structure
Returns:
the binx value

Definition at line 1138 of file xsh_data_pre.c.

References xsh_pre::binx, and XSH_ASSURE_NOT_NULL.

int xsh_pre_get_biny ( const xsh_pre pre  ) 

Get biny of pre structure.

Parameters:
pre the pre structure
Returns:
the ny value

Definition at line 1156 of file xsh_data_pre.c.

References xsh_pre::biny, and XSH_ASSURE_NOT_NULL.

cpl_mask* xsh_pre_get_bpmap ( const xsh_pre pre  ) 

Get bpmap of pre structure.

Parameters:
pre the pre structure
Returns:
the cpl_mask represented the bpmap

Definition at line 1281 of file xsh_data_pre.c.

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

Referenced by xsh_create_master_bias2(), xsh_pre_add(), xsh_pre_subtract(), xsh_rectify_orders(), and xsh_remove_cosmics().

cpl_image* xsh_pre_get_data ( xsh_pre pre  ) 
double* xsh_pre_get_data_buffer ( xsh_pre pre  ) 

Get data buffer.

Parameters:
pre The PRE image
Returns:
Pointer to existing data buffer

Definition at line 2431 of file xsh_data_pre.c.

References xsh_pre_get_data_buffer_const().

const double* xsh_pre_get_data_buffer_const ( const xsh_pre pre  ) 

Get data buffer.

Parameters:
pre The PRE image
Returns:
Pointer to existing data buffer

Definition at line 2409 of file xsh_data_pre.c.

References xsh_pre::data, passure, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_pre_get_data_buffer().

const cpl_image* xsh_pre_get_data_const ( const xsh_pre pre  ) 

Get data.

Parameters:
pre The PRE image
Returns:
Pointer to existing data image

Definition at line 2320 of file xsh_data_pre.c.

References xsh_pre::data, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_pre_get_data().

cpl_image* xsh_pre_get_errs ( xsh_pre pre  ) 

Get errs.

Parameters:
pre The PRE image
Returns:
Pointer to existing errs image

Definition at line 2368 of file xsh_data_pre.c.

References xsh_pre_get_errs_const().

Referenced by xsh_frameset_add(), xsh_pre_extract(), xsh_pre_flip(), xsh_pre_turn(), xsh_rec_list_rectify(), xsh_wavelist_subtract_sky(), and xsh_wavemap_list_new().

double* xsh_pre_get_errs_buffer ( xsh_pre pre  ) 

Get errs buffer.

Parameters:
pre The PRE image
Returns:
Pointer to existing errs buffer

Definition at line 2462 of file xsh_data_pre.c.

References xsh_pre_get_errs_buffer_const().

const double* xsh_pre_get_errs_buffer_const ( const xsh_pre pre  ) 

Get errs buffer.

Parameters:
pre The PRE image
Returns:
Pointer to existing errs buffer

Definition at line 2443 of file xsh_data_pre.c.

References xsh_pre::errs, passure, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_pre_get_errs_buffer().

const cpl_image* xsh_pre_get_errs_const ( const xsh_pre pre  ) 

Get errs.

Parameters:
pre The PRE image
Returns:
Pointer to existing errs image

Definition at line 2350 of file xsh_data_pre.c.

References xsh_pre::errs, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_pre_get_errs().

float xsh_pre_get_gain ( const xsh_pre pre  ) 

Get gain of pre structure.

Parameters:
pre the pre structure
Returns:
the gain value

Definition at line 1247 of file xsh_data_pre.c.

References xsh_pre::gain, and XSH_ASSURE_NOT_NULL.

cpl_frame_group xsh_pre_get_group ( const xsh_pre pre  ) 

Get ny of pre structure.

Parameters:
pre the pre structure
Returns:
the ny value

Definition at line 1264 of file xsh_data_pre.c.

References xsh_pre::group, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_pre_add(), xsh_pre_divide(), xsh_pre_duplicate(), xsh_pre_frame_subtract(), xsh_pre_multiply(), xsh_pre_save(), and xsh_pre_subtract().

cpl_propertylist* xsh_pre_get_header ( xsh_pre pre  ) 

Get header.

Parameters:
pre The PRE image
Returns:
Pointer to existing PRE image header.

Definition at line 2304 of file xsh_data_pre.c.

References XSH_ASSURE_NOT_NULL, and xsh_pre_get_header_const().

const cpl_propertylist* xsh_pre_get_header_const ( const xsh_pre pre  ) 

Get header.

Parameters:
pre The PRE image
Returns:
Pointer to existing PRE image header.

Definition at line 2285 of file xsh_data_pre.c.

References xsh_pre::data_header, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_pre_get_header().

int xsh_pre_get_nx ( const xsh_pre pre  ) 
int xsh_pre_get_ny ( const xsh_pre pre  ) 
float xsh_pre_get_pszx ( const xsh_pre pre  ) 

Get pszx of pre structure.

Parameters:
pre the pre structure
Returns:
the pszx value

Definition at line 1174 of file xsh_data_pre.c.

References assure, and xsh_pre::pszx.

float xsh_pre_get_pszy ( const xsh_pre pre  ) 

Get pszy of pre structure.

Parameters:
pre the pre structure
Returns:
the pszy value

Definition at line 1229 of file xsh_data_pre.c.

References xsh_pre::pszy, and XSH_ASSURE_NOT_NULL.

cpl_image* xsh_pre_get_qual ( xsh_pre pre  ) 

Get qual.

Parameters:
pre The PRE image
Returns:
Pointer to existing qual image

Definition at line 2397 of file xsh_data_pre.c.

References xsh_pre_get_qual_const().

Referenced by xsh_compute_noise_map(), xsh_frameset_add(), xsh_mflat_normalize(), xsh_pre_extract(), xsh_pre_flip(), xsh_pre_turn(), xsh_rec_list_rectify(), xsh_wavelist_subtract_sky(), and xsh_wavemap_list_new().

const cpl_image* xsh_pre_get_qual_const ( const xsh_pre pre  ) 

Get QUAL.

Parameters:
pre The PRE image
Returns:
Pointer to existing qual image

Definition at line 2380 of file xsh_data_pre.c.

References xsh_pre::qual, and XSH_ASSURE_NOT_NULL.

Referenced by xsh_pre_get_qual().

static void xsh_pre_init ( xsh_pre pre,
cpl_propertylist *  header,
xsh_instrument instrument 
) [static]
xsh_pre* xsh_pre_load ( cpl_frame *  frame,
xsh_instrument instr 
)

Load a xsh_pre structure from a frame.

Parameters:
[in] frame The frame pointing on the file to load
instr The instrument to be attached
Returns:
A newly allocated PRE structure

Definition at line 767 of file xsh_data_pre.c.

References assure, check, check_msg, xsh_pre::data, 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(), create_blaze(), get_max_pos(), main(), save_pre_frame(), verifCr(), verify_noisy(), xsh_add_product_pre(), xsh_add_sky_model(), xsh_compute_noise_map(), xsh_create_dispersol_physmod(), xsh_create_map(), xsh_create_master_bias(), xsh_create_master_bias2(), xsh_create_master_bpmap(), xsh_create_master_dark(), xsh_create_master_flat(), xsh_create_order_table(), xsh_create_poly_wavemap(), xsh_detect_arclines(), xsh_detect_continuum(), xsh_detect_order_edge(), xsh_divide_flat(), xsh_flat_merge_qth_d2(), xsh_follow_arclines(), xsh_format(), xsh_frame_abs(), xsh_frame_inv(), xsh_frame_mult(), xsh_frameset_add(), xsh_frameset_average_pre(), xsh_multiply_flat(), xsh_opt_extract_orders(), xsh_pre_frame_subtract(), xsh_preframe_extract(), xsh_prepare(), xsh_rectify_orders(), xsh_remove_cosmics(), xsh_remove_crh_single(), xsh_respon_slit_offset(), xsh_respon_slit_stare(), xsh_subtract_background(), xsh_subtract_bias(), xsh_subtract_dark(), xsh_subtract_on_off(), and xsh_subtract_sky_single().

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:
preFrame XSH_PRE strucure
mean Average value
median Median value
stdev Standard deviation (output)

Definition at line 1779 of file xsh_data_pre.c.

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

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:
preFrame XSH_PRE strucure
mean Average value
median Median value
stdev standard deviation value
llx lower left x value
lly lower left x value
urx upper right x value
ury upper right y value

Definition at line 1837 of file xsh_data_pre.c.

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

Referenced by set_masterbias_qc_uves_structure_region(), and set_masterdark_qc().

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

Multiply a PRE image from another.

Parameters:
self The first operand modified by the multiply operation
right The image to multiply with
threshold minimal 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 = 1/ data1/data2 * sqrt( (sigma1/data1)^2 + (sigma2/data2)^2 ) sigma = sqrt( data2^2 * sigma1^2 + data1^2 sigma2^2 )

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

Definition at line 1662 of file xsh_data_pre.c.

References assure, check, xsh_pre::data, xsh_pre::errs, QFLAG_CALIB_FILE_DEFECT, QFLAG_OUTSIDE_DATA_RANGE, xsh_pre::qual, XSH_GOOD_PIXEL_LEVEL, xsh_pre_get_group(), xsh_pre_get_nx(), and xsh_pre_get_ny().

Referenced by xsh_multiply_flat().

void xsh_pre_multiply_image ( const xsh_pre pre,
cpl_image *  img 
)

multiply a frame in PRE format by an image

Parameters:
pre frame in PRE format
img image

Definition at line 2586 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().

void xsh_pre_multiply_scalar ( const xsh_pre pre,
double  x 
)

multiply a frame in PRE format by a scalar

Parameters:
pre frame in PRE format
x scalar

Definition at line 2506 of file xsh_data_pre.c.

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

Referenced by xsh_frame_inv(), and xsh_subtract_dark().

xsh_pre* xsh_pre_new ( int  nx,
int  ny 
)

Create new PRE image.

Parameters:
nx The x-size
ny The y-size
Returns:
The newly allocated PRE image

The data and errs units are initialized to zero.

Definition at line 1067 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, xsh_pre::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.

void xsh_pre_normalize ( xsh_pre self  ) 

Normalize data flux.

Parameters:
self The PRE image to normalize

Definition at line 1734 of file xsh_data_pre.c.

References check, XSH_ASSURE_NOT_NULL, and xsh_msg.

Referenced by xsh_create_master_flat().

cpl_frame* xsh_pre_save ( const xsh_pre pre,
const char *  filename,
const char *  tag,
int  temp 
)
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:
pre the pre image structure
frame The frame describing the product
frameset The initial frameset containing raw frames
parameters The recipe parameters
recipe_id The recipe id
prefix Prefix used to build the filename
Returns:
A frame pointing to the file product

Definition at line 993 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().

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] self The first operand modified by the subtract operation
[in] right The image to subtract

Definition at line 1503 of file xsh_data_pre.c.

References assure, check, xsh_pre::data, xsh_pre::errs, QFLAG_CALIB_FILE_DEFECT, XSH_ASSURE_NOT_NULL, xsh_badpixelmap_or(), xsh_pre_get_bpmap(), xsh_pre_get_group(), xsh_pre_get_nx(), and xsh_pre_get_ny().

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

void xsh_pre_subtract_scalar ( const xsh_pre pre,
double  x 
)

subtract a scalar from a frame in PRE format

Parameters:
pre frame in PRE format
x scalar

Definition at line 2567 of file xsh_data_pre.c.

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

Referenced by xsh_subtract_bias().

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:
pre Image to turn (PRE format)
rot Number of 90 degrees to turn (counterclockwise)

Definition at line 2734 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().

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] pre The PRE image
[in] xcen The position in pixel along X axis defining the center of the search window
[in] ycen The position in pixel along Y axis defining the center of the search window
[in] search_window_hsize THe half size of search box
[in] running_median_hsize The half size of running median box
[out] xadj The finding pixel position along X
[out] yadj The finding pixel position along Y

Definition at line 1977 of file xsh_data_pre.c.

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

Referenced by xsh_detect_arclines().

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

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