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_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. | |
void | xsh_pre_free (xsh_pre **pre) |
Free a xsh_pre structure. | |
xsh_pre * | xsh_pre_load (cpl_frame *frame, xsh_instrument *instr) |
Load a xsh_pre structure from a frame. | |
xsh_pre * | xsh_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_pre * | xsh_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_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. | |
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, 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. |
static double xsh_compute_ron_nir | ( | const double | dit | ) | [static] |
Definition at line 248 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.
set | the input frameset | |
instr | the instrument setting | |
tag | the output frame tag |
Definition at line 2720 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().
cpl_image* xsh_pre_abs | ( | const xsh_pre * | pre | ) |
computes absolute value of a frame in PRE format
pre | frame in PRE format |
Definition at line 2677 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().
Add two PRE images.
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 1409 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
pre | frame in PRE format | |
x | scalar |
Definition at line 2615 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, | |||
const bool | flag_neg_and_thresh_pix | |||
) |
Create a XSH_PRE from a raw frame.
[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 |
NULL | in case of error |
The data and errs units are initialized to zero.
Definition at line 451 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_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_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().
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.
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 |
Definition at line 2275 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, XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_NULL, and xsh_unwrap_vector().
Referenced by xsh_crea_grid_from_samples(), and xsh_pre_window_best_median_flux_pos().
Divide a PRE image from another.
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 = 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 1774 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_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
pre | frame in PRE format | |
x | scalar |
Definition at line 2593 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.
pre | The PRE image to dump | |
stream | The stream to dump to |
This function might be used for debugging purposes.
Definition at line 2544 of file xsh_data_pre.c.
References xsh_pre::data, and xsh_free_stats().
Copy a PRE structure.
pre | The PRE to copy |
Definition at line 945 of file xsh_data_pre.c.
References assure, check, check_msg, xsh_pre::data, xsh_pre::data_header, xsh_pre::decode_bp, xsh_pre::errs, xsh_pre::errs_header, xsh_pre::exptime, xsh_pre::gain, xsh_pre::group, xsh_pre::instrument, xsh_pre::nx, xsh_pre::ny, xsh_pre::pszx, xsh_pre::pszy, xsh_pre::qual, xsh_pre::qual_header, xsh_pre_free(), xsh_pre_get_group(), xsh_pre_get_nx(), and xsh_pre_get_ny().
Referenced by xsh_frameset_add(), xsh_mdark_get_median_stdev(), xsh_pre_frame_subtract(), xsh_remove_crh_single(), xsh_subtract_on_off(), and xsh_wavelist_subtract_sky().
void xsh_pre_extract | ( | xsh_pre * | pre, | |
int | xmin, | |||
int | ymin, | |||
int | xmax, | |||
int | ymax | |||
) |
Create a sub pre image.
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 2839 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.
pre | Image to turn (PRE format) | |
angle | mirror line in polar coord. is theta = (PI/4) * angle |
Definition at line 2875 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().
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.
one | First pre frame | |
two | Second pre frame | |
filename | Name of the saved subtracted file | |
instr | Pointer to the instrument description structure |
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().
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.
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 |
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().
void xsh_pre_free | ( | xsh_pre ** | pre | ) |
Free a xsh_pre structure.
pre | The xsh_pre structure to free |
Definition at line 815 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_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_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(), and xsh_wavelist_subtract_sky().
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.
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 1278 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.
pre | the pre structure |
Definition at line 1221 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.
pre | the pre structure |
Definition at line 1239 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.
pre | the pre structure |
Definition at line 1364 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_pre_add(), xsh_pre_subtract(), and xsh_remove_cosmics().
cpl_image* xsh_pre_get_data | ( | xsh_pre * | pre | ) |
Get data.
pre | The PRE image |
Definition at line 2405 of file xsh_data_pre.c.
References xsh_pre_get_data_const().
Referenced by xsh_frameset_add(), xsh_mflat_normalize(), xsh_pre_extract(), xsh_pre_flip(), xsh_pre_turn(), xsh_prepare(), xsh_rec_list_rectify(), xsh_remove_crh_single(), xsh_subtract_sky_single(), xsh_wavelist_subtract_sky(), xsh_wavemap_list_build_sky(), and xsh_wavemap_list_new().
double* xsh_pre_get_data_buffer | ( | xsh_pre * | pre | ) |
Get data buffer.
pre | The PRE image |
Definition at line 2498 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.
pre | The PRE image |
Definition at line 2476 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.
pre | The PRE image |
Definition at line 2387 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.
pre | The PRE image |
Definition at line 2435 of file xsh_data_pre.c.
References xsh_pre_get_errs_const().
Referenced by fill_rectified(), xsh_frameset_add(), xsh_pre_extract(), xsh_pre_flip(), xsh_pre_turn(), xsh_rec_list_rectify(), xsh_remove_crh_single(), xsh_wavelist_subtract_sky(), and xsh_wavemap_list_new().
double* xsh_pre_get_errs_buffer | ( | xsh_pre * | pre | ) |
Get errs buffer.
pre | The PRE image |
Definition at line 2529 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.
pre | The PRE image |
Definition at line 2510 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.
pre | The PRE image |
Definition at line 2417 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.
pre | the pre structure |
Definition at line 1330 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.
pre | the pre structure |
Definition at line 1347 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.
pre | The PRE image |
Definition at line 2371 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.
pre | The PRE image |
Definition at line 2352 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 | ) |
Get nx of pre structure.
pre | the pre structure |
Definition at line 1184 of file xsh_data_pre.c.
References xsh_pre::nx, and XSH_ASSURE_NOT_NULL.
Referenced by set_masterdark_qc(), xsh_cube(), xsh_format(), xsh_mflat_normalize(), xsh_order_table_from_fmtchk(), xsh_pre_add(), xsh_pre_divide(), xsh_pre_duplicate(), xsh_pre_median_mean_stdev(), xsh_pre_median_mean_stdev_window(), xsh_pre_multiply(), xsh_pre_subtract(), xsh_rec_list_rectify(), xsh_wavelist_subtract_sky(), and xsh_wavemap_list_new().
int xsh_pre_get_ny | ( | const xsh_pre * | pre | ) |
Get ny of pre structure.
pre | the pre structure |
Definition at line 1202 of file xsh_data_pre.c.
References xsh_pre::ny, and XSH_ASSURE_NOT_NULL.
Referenced by set_masterdark_qc(), xsh_cube(), xsh_detect_continuum(), xsh_format(), xsh_mflat_normalize(), xsh_order_table_from_fmtchk(), xsh_pre_add(), xsh_pre_divide(), xsh_pre_duplicate(), xsh_pre_median_mean_stdev(), xsh_pre_median_mean_stdev_window(), xsh_pre_multiply(), xsh_pre_subtract(), xsh_rec_list_rectify(), xsh_wavelist_subtract_sky(), and xsh_wavemap_list_new().
float xsh_pre_get_pszx | ( | const xsh_pre * | pre | ) |
Get pszx of pre structure.
pre | the pre structure |
Definition at line 1257 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.
pre | the pre structure |
Definition at line 1312 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.
pre | The PRE image |
Definition at line 2464 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_remove_crh_single(), xsh_wavelist_subtract_sky(), and xsh_wavemap_list_new().
const cpl_image* xsh_pre_get_qual_const | ( | const xsh_pre * | pre | ) |
Get QUAL.
pre | The PRE image |
Definition at line 2447 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] |
Fill the XSH_PRE structure from FITS header file.
[in] | pre | The pre structure to fill |
[in] | header | The header of fits image |
[in] | instrument | arm setting |
set: pre: header naxis1 naxis2 exptime ron conad gain binx biny ovscx ovscy prscx prscy prszx prszy cutx cuty cutmx cutmy
instrument: arm binx biny
Definition at line 319 of file xsh_data_pre.c.
References xsh_instrument::binx, xsh_pre::binx, xsh_instrument::biny, xsh_pre::biny, check, xsh_pre::conad, xsh_pre::cutmx, xsh_pre::cutmy, xsh_pre::cutx, xsh_pre::cuty, xsh_pre::data_header, xsh_instrument::decode_bp, xsh_pre::decode_bp, xsh_pre::exptime, xsh_pre::gain, xsh_pre::instrument, xsh_pre::naxis1, xsh_pre::naxis2, xsh_pre::pszx, xsh_pre::pszy, xsh_pre::ron, XSH_ARM_NIR, XSH_ASSURE_NOT_NULL, xsh_compute_ron_nir(), xsh_error_reset, xsh_instrument_get_arm(), xsh_msg, xsh_msg_warning, XSH_NIR_DEFAULT_CUT, XSH_NIR_DEFAULT_CUT_X, XSH_NIR_DEFAULT_CUT_Y, xsh_pfits_get_binx(), xsh_pfits_get_biny(), xsh_pfits_get_chip_ny(), xsh_pfits_get_conad(), xsh_pfits_get_det_gain(), xsh_pfits_get_det_pxspace(), xsh_pfits_get_dit(), xsh_pfits_get_exptime(), xsh_pfits_get_naxis1(), xsh_pfits_get_naxis2(), xsh_pfits_get_ovscx(), xsh_pfits_get_ovscy(), xsh_pfits_get_prscx(), xsh_pfits_get_prscy(), xsh_pfits_get_pszx(), xsh_pfits_get_pszy(), xsh_pfits_get_ron(), and xsh_pfits_set_arm().
Referenced by xsh_pre_create(), and xsh_pre_load().
xsh_pre* xsh_pre_load | ( | cpl_frame * | frame, | |
xsh_instrument * | instr | |||
) |
Load a xsh_pre structure from a frame.
[in] | frame | The frame pointing on the file to load |
instr | The instrument to be attached |
Definition at line 841 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_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_mdark(), xsh_mdark_compute_fpn(), 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_scired_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)
preFrame | XSH_PRE strucure | |
mean | Average value | |
median | Median value | |
stdev | Standard deviation (output) |
Definition at line 1974 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().
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
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 2033 of file xsh_data_pre.c.
References assure, check, xsh_pre::data, xsh_pre::decode_bp, kappa, nx, ny, xsh_pre::qual, 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().
Multiply a PRE image from another.
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 = sqrt( data2^2 * sigma1^2 + data1^2 sigma2^2 )
The quality maps are or'ed qual = qual1 U qual2
Definition at line 1861 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_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
pre | frame in PRE format | |
img | image |
Definition at line 2653 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
pre | frame in PRE format | |
x | scalar |
Definition at line 2573 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.
nx | The x-size | |
ny | The y-size |
The data and errs units are initialized to zero.
Definition at line 1150 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.
Referenced by xsh_pre_subsample().
void xsh_pre_normalize | ( | xsh_pre * | self | ) |
Normalize data flux.
self | The PRE image to normalize |
Definition at line 1934 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 | |||
) |
Save PRE on disk.
pre | to save | |
filename | The file to save to | |
tag | The file pro catg | |
temp | Flag if 1 frame is temporary file |
Definition at line 1011 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_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_multiply_flat(), xsh_opt_extract_orders(), xsh_pre_frame_subtract(), xsh_pre_save_product(), xsh_preframe_extract(), xsh_prepare(), 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(), and xsh_wavelist_subtract_sky().
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.
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 |
Definition at line 1076 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* 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.
self | The first operand modified by the divide operation | |
binx | bin factor along X | |
biny | bin factor along Y | |
inst | instrument setting |
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 1663 of file xsh_data_pre.c.
References assure, check, xsh_pre::data, xsh_pre::errs, m, nx, ny, xsh_pre::qual, and xsh_pre_new().
Referenced by xsh_frame_pre_subsample().
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.
[in] | self | The first operand modified by the subtract operation |
[in] | right | The image to subtract |
Definition at line 1589 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_mdark_compute_fpn(), 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
pre | frame in PRE format | |
x | scalar |
Definition at line 2634 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.
pre | Image to turn (PRE format) | |
rot | Number of 90 degrees to turn (counterclockwise) |
Definition at line 2806 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.
[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 2165 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 xsh_detect_arclines(), and xsh_detect_arclines_dan().
static cpl_error_code xsh_preoverscan_corr | ( | cpl_frame * | raw, | |
const int | corr_mode, | |||
double * | cor_val | |||
) | [static] |
Definition at line 61 of file xsh_data_pre.c.
References check, xsh_add_temporary_file(), XSH_BUNIT_FLUX_REL_C, xsh_free_image(), xsh_free_imagelist(), xsh_free_propertylist(), xsh_free_vector(), xsh_get_basename(), xsh_irplib_imagelist_get_clean_mean_levels(), xsh_msg, xsh_msg_error, xsh_pfits_get_naxis1(), xsh_pfits_get_naxis2(), xsh_pfits_get_ovscx(), xsh_pfits_get_prscx(), xsh_pfits_set_bunit(), and XSH_PRE_DATA_TYPE.
Referenced by xsh_pre_create().