Defines | |
#define | RECIPE_ID "xsh_mbias" |
#define | HIST_FACT 2.354820045 |
Functions | |
static cpl_error_code | xsh_compute_ron_mbias (cpl_frameset *raws, xsh_pre *master, cpl_parameterlist *parameters) |
static cpl_error_code | xsh_compute_fpn_mbias (cpl_frameset *raws, xsh_pre *master, xsh_instrument *instrument, cpl_parameterlist *parameters) |
static cpl_error_code | xsh_mbias_get_fpn (const cpl_image *ima, cpl_parameterlist *parameters, double *fpn) |
static double | xsh_mdark_get_contam (xsh_pre *pre, cpl_parameterlist *params, xsh_instrument *instr) |
cpl_error_code | xsh_mdark_get_median_stdev (xsh_pre *preFrame, cpl_parameterlist *parameters, cpl_frame *crh_frm, cpl_frame *bpm_frm) |
static cpl_error_code | xsh_mdark_measure_fpn (xsh_pre *preFrame, cpl_parameterlist *parameters, xsh_instrument *instrument) |
cpl_error_code | xsh_mdark_measure_ron (xsh_pre *preFrame, cpl_parameterlist *parameters) |
static void | set_masterdark_qc (xsh_pre *preFrame, xsh_instrument *instrument, cpl_parameterlist *parameters, cpl_frame *crh_frm, cpl_frame *bpm_frm) |
static cpl_error_code | xsh_mdark_get_fpn (cpl_image *ima, cpl_parameterlist *params, cpl_propertylist *qc_log, const double exptime) |
static cpl_error_code | xsh_mdark_compute_fpn (cpl_frameset *raws, cpl_parameterlist *params, cpl_propertylist *qclog, xsh_instrument *instrument) |
cpl_frame * | xsh_create_master_dark2 (cpl_frameset *raws, xsh_stack_param *stack_param, cpl_parameterlist *params, cpl_propertylist *qc_log, xsh_instrument *instr) |
cpl_frame * | xsh_create_master_dark (cpl_frame *medFrame, xsh_instrument *instr, cpl_parameterlist *parameters, cpl_frame *crh_frm, cpl_frame *bpm_frm) |
static void | reject_lo_hi (cpl_image *image, double min, double max) |
Reject outlier pixels. | |
static int | count_good (const cpl_image *image) |
static double | get_masterbias_qc_structure_row_region (cpl_image *tima) |
static double | get_masterbias_qc_structure_col_region (cpl_image *tima) |
static void | set_masterbias_qc_xsh_structure_region (xsh_pre *master, const int llx, const int lly, const int urx, const int ury, const int ref_x, const int ref_y, const int reg_id) |
static void | set_masterbias_qc_structure_region (xsh_pre *master, const int llx, const int lly, const int urx, const int ury, const int ref_x, const int ref_y, const int reg_id) |
static void | set_masterbias_qc_structure (xsh_pre *master, cpl_parameterlist *parameters) |
cpl_frame * | xsh_create_master_bias2 (cpl_frameset *rawFrames, xsh_stack_param *stack_par, xsh_instrument *instr, const char *result_tag, const int method_code) |
Creates master bias. | |
cpl_frame * | xsh_compute_qc_on_master_bias (cpl_frameset *raws, cpl_frame *frame, xsh_instrument *instr, cpl_parameterlist *params) |
Computes QC on a master bias frame. | |
cpl_frame * | xsh_create_master_flat_with_mask (cpl_frame *frame, cpl_frame *edges, xsh_instrument *instr) |
cpl_frame * | xsh_create_master_flat (cpl_frame *frame, xsh_instrument *instr) |
cpl_frame * | xsh_create_master_dark_bpmap (cpl_frame *mdarkFrame, xsh_instrument *instr) |
static cpl_image * | xsh_flat_create_normalized_master (cpl_imagelist *flats, const cpl_table *ordertable, xsh_order_list *order_locations, xsh_stack_param *stack_param) |
Stack images using k-sigma clipping. | |
static cpl_image * | xsh_flat_create_normalized_master2 (cpl_imagelist *flats, const cpl_table *ordertable, xsh_order_list *order_locations, const cpl_image *mflat, xsh_stack_param *stack_param, cpl_vector **vec_flux_stack) |
Stack images using k-sigma clipping. | |
cpl_frame * | xsh_create_master_flat2 (cpl_frameset *set, cpl_frame *order_tab_cen, xsh_stack_param *stack_par, xsh_instrument *inst) |
Combine master frames. |
#define HIST_FACT 2.354820045 |
Definition at line 74 of file xsh_create_master.c.
Referenced by xsh_detmon_ronbias_histo().
#define RECIPE_ID "xsh_mbias" |
Definition at line 73 of file xsh_create_master.c.
static int count_good | ( | const cpl_image * | image | ) | [static] |
Definition at line 845 of file xsh_create_master.c.
Referenced by get_masterbias_qc_structure_col_region(), and get_masterbias_qc_structure_row_region().
static double get_masterbias_qc_structure_col_region | ( | cpl_image * | tima | ) | [static] |
Definition at line 897 of file xsh_create_master.c.
References check, count_good(), reject_lo_hi(), xsh_free_image(), and xsh_msg_warning.
Referenced by set_masterbias_qc_xsh_structure_region().
static double get_masterbias_qc_structure_row_region | ( | cpl_image * | tima | ) | [static] |
Definition at line 853 of file xsh_create_master.c.
References check, count_good(), reject_lo_hi(), xsh_free_image(), and xsh_msg_warning.
Referenced by set_masterbias_qc_xsh_structure_region().
static void reject_lo_hi | ( | cpl_image * | image, | |
double | min, | |||
double | max | |||
) | [static] |
Reject outlier pixels.
image | image with pixels | |
min | reject pixels below this value | |
max | reject pixels abouve this value |
Definition at line 824 of file xsh_create_master.c.
References assure_mem, and xsh_free_mask().
Referenced by get_masterbias_qc_structure_col_region(), and get_masterbias_qc_structure_row_region().
static void set_masterbias_qc_structure | ( | xsh_pre * | master, | |
cpl_parameterlist * | parameters | |||
) | [static] |
Calculates and sets QC parameters: Median, Average, Stdev and Slope, for primary image AND qual.
master | Master Bias Frame (PRE format) | |
parameters | Recipe input parameters |
Definition at line 1084 of file xsh_create_master.c.
References check, xsh_pre::data, ref_llx, ref_lly, ref_urx, ref_ury, and set_masterbias_qc_structure_region().
Referenced by xsh_compute_qc_on_master_bias().
static void set_masterbias_qc_structure_region | ( | xsh_pre * | master, | |
const int | llx, | |||
const int | lly, | |||
const int | urx, | |||
const int | ury, | |||
const int | ref_x, | |||
const int | ref_y, | |||
const int | reg_id | |||
) | [static] |
Calculates and sets QC parameters: Median, Average, Stdev and Slope, for primary image AND qual.
master | Master Bias Frame (PRE format) | |
llx | lower left X | |
lly | lower left Y | |
urx | upper right X | |
ury | upper right Y | |
ref_x | reference X | |
ref_y | reference Y | |
reg_id | region id |
Definition at line 1056 of file xsh_create_master.c.
References check, and set_masterbias_qc_xsh_structure_region().
Referenced by set_masterbias_qc_structure().
static void set_masterbias_qc_xsh_structure_region | ( | xsh_pre * | master, | |
const int | llx, | |||
const int | lly, | |||
const int | urx, | |||
const int | ury, | |||
const int | ref_x, | |||
const int | ref_y, | |||
const int | reg_id | |||
) | [static] |
Calculates and sets QC parameters: Median, Average, Stdev and Slope, for primary image AND qual.
master | Master Bias Frame (PRE format) | |
llx | lower left X | |
lly | lower left Y | |
urx | upper right X | |
ury | upper right Y | |
ref_x | reference X | |
ref_y | reference Y | |
reg_id | region id | |
dlevel | debug level |
Definition at line 953 of file xsh_create_master.c.
References check, xsh_pre::data, xsh_pre::data_header, get_masterbias_qc_structure_col_region(), get_masterbias_qc_structure_row_region(), xsh_free_image(), xsh_pfits_set_qc_mbiasavg(), xsh_pfits_set_qc_mbiasmed(), xsh_pfits_set_qc_mbiasrms(), xsh_pfits_set_qc_reg1_structx(), xsh_pfits_set_qc_reg1_structy(), xsh_pfits_set_qc_reg2_structx(), xsh_pfits_set_qc_reg2_structy(), and xsh_pre_median_mean_stdev_window().
Referenced by set_masterbias_qc_structure_region().
static void set_masterdark_qc | ( | xsh_pre * | preFrame, | |
xsh_instrument * | instrument, | |||
cpl_parameterlist * | parameters, | |||
cpl_frame * | crh_frm, | |||
cpl_frame * | bpm_frm | |||
) | [static] |
Calculates and sets QC parameters: Median, Average, Stdev and Slope, for primary image AND qual.
preFrame | Master Dark Frame (PRE format) | |
instrument | Pointer to the instrument description structure | |
parameters | parameters of recipe | |
crh_frm | CRH frame | |
bpm_frm | BPM frame |
Definition at line 420 of file xsh_create_master.c.
References assure, check, xsh_pre::data_header, nx, ny, xsh_mdark_get_contam(), xsh_mdark_get_median_stdev(), xsh_mdark_measure_fpn(), xsh_pfits_set_qc_contamination(), xsh_pre_get_nx(), and xsh_pre_get_ny().
Referenced by xsh_create_master_dark().
static cpl_error_code xsh_compute_fpn_mbias | ( | cpl_frameset * | raws, | |
xsh_pre * | master, | |||
xsh_instrument * | instrument, | |||
cpl_parameterlist * | parameters | |||
) | [static] |
Definition at line 1703 of file xsh_create_master.c.
Referenced by xsh_compute_qc_on_master_bias().
cpl_frame* xsh_compute_qc_on_master_bias | ( | cpl_frameset * | raws, | |
cpl_frame * | frame, | |||
xsh_instrument * | instr, | |||
cpl_parameterlist * | params | |||
) |
Computes QC on a master bias frame.
raws | The raw frames | |
frame | The master bias frame | |
instr | The instrument containing the arm in use | |
parameters | The instrument recipe parameters (To be removed) | |
params | Additional params to compute QC |
Definition at line 1282 of file xsh_create_master.c.
References check, xsh_pre::data_header, set_masterbias_qc_structure(), XSH_ASSURE_NOT_NULL, xsh_compute_fpn_mbias(), xsh_compute_ron_mbias(), XSH_GET_TAG_FROM_ARM, xsh_instrument_arm_tostring(), XSH_MASTER_BIAS, xsh_msg, xsh_pfits_set_pcatg(), xsh_pre_free(), xsh_pre_load(), and xsh_pre_save().
Referenced by main(), and xsh_mbias().
static cpl_error_code xsh_compute_ron_mbias | ( | cpl_frameset * | raws, | |
xsh_pre * | master, | |||
cpl_parameterlist * | parameters | |||
) | [static] |
Definition at line 1552 of file xsh_create_master.c.
References check, random_nsamples, random_sizex, ref_llx, ref_lly, ref_urx, ref_ury, size, and XSH_ASSURE_NOT_ILLEGAL_MSG.
Referenced by xsh_compute_qc_on_master_bias().
cpl_frame* xsh_create_master_bias2 | ( | cpl_frameset * | rawFrames, | |
xsh_stack_param * | stack_par, | |||
xsh_instrument * | instr, | |||
const char * | result_tag, | |||
const int | method_code | |||
) |
Creates master bias.
rawFrames | Pointer to the frameset | |
stack_par | Pointer to stack param structure | |
instr | instrument containing the arm , mode and lamp in use | |
result_tag | product catg |
Definition at line 1154 of file xsh_create_master.c.
References assure, check, check_msg, xsh_pre::data, xsh_pre::data_header, xsh_pre::errs, xsh_stack_param::khigh, xsh_stack_param::klow, xsh_pre::qual, size, XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_NULL, xsh_badpixelmap_image_coadd(), xsh_collapse_errs(), xsh_free_frame(), xsh_free_image(), xsh_free_imagelist(), xsh_image_flag_bp(), xsh_irplib_mkmaster_mean(), xsh_irplib_mkmaster_median(), xsh_pfits_set_datancom(), xsh_pre_free(), xsh_pre_load(), and xsh_pre_save().
Referenced by main(), and xsh_mbias().
cpl_frame* xsh_create_master_dark | ( | cpl_frame * | medFrame, | |
xsh_instrument * | instr, | |||
cpl_parameterlist * | parameters, | |||
cpl_frame * | crh_frm, | |||
cpl_frame * | bpm_frm | |||
) |
PELIMINARY: Creates a master dark frame from input frame. Input frame is in PRE format: medianFrame, errsFrame, bpmapFrame. Divide median frame by exposure time and calculate QC params.
medFrame | Frame in PRE format | |
instr | instrument containing the arm in use | |
parameters | of the recipe | |
crh_frm | CRH frame | |
bpm_frm | BPM frame |
Definition at line 738 of file xsh_create_master.c.
References xsh_instrument::arm, assure, check, check_msg, xsh_pre::data, xsh_pre::data_header, xsh_pre::errs, xsh_pre::errs_header, xsh_pre::exptime, exptime, set_masterdark_qc(), XSH_ARM_NIR, XSH_ASSURE_NOT_NULL, xsh_free_frame(), XSH_GET_TAG_FROM_ARM, xsh_instrument_arm_tostring(), xsh_instrument_get_arm(), XSH_MASTER_DARK, xsh_msg_dbg_high, xsh_pfits_set_exptime(), xsh_pre_free(), xsh_pre_load(), and xsh_pre_save().
Referenced by xsh_get_master_dark_opt(), and xsh_mdark().
cpl_frame* xsh_create_master_dark2 | ( | cpl_frameset * | raws, | |
xsh_stack_param * | stack_param, | |||
cpl_parameterlist * | params, | |||
cpl_propertylist * | qc_log, | |||
xsh_instrument * | instr | |||
) |
Calculates master dark frame.
raws | raw input frames (PRE format) | |
stack_param | parameters to do frame stacking | |
instr | Pointer to the instrument description structure | |
output | data imagelist (to later compute QC). |
Definition at line 591 of file xsh_create_master.c.
References xsh_instrument::arm, check, check_msg, xsh_pre::data, xsh_pre::data_header, xsh_pre::errs, xsh_pre::errs_header, kappa, xsh_stack_param::khigh, xsh_stack_param::klow, xsh_pre::qual, xsh_stack_param::stack_method, tolerance, XSH_ARM_NIR, xsh_badpixelmap_image_coadd(), xsh_collapse_errs(), xsh_free_image(), xsh_free_imagelist(), xsh_free_propertylist(), xsh_image_flag_bp(), xsh_instrument_arm_tostring(), xsh_irplib_mkmaster_dark_fill_imagelist(), xsh_irplib_mkmaster_mean(), xsh_irplib_mkmaster_median(), XSH_MASTER_DARK, xsh_mdark_compute_fpn(), xsh_msg, xsh_msg_dbg_high, xsh_pfits_set_exptime(), xsh_pre_free(), xsh_pre_load(), and xsh_pre_save().
Referenced by xsh_mdark().
cpl_frame* xsh_create_master_dark_bpmap | ( | cpl_frame * | mdarkFrame, | |
xsh_instrument * | instr | |||
) |
Definition at line 1460 of file xsh_create_master.c.
References check, check_msg, nx, ny, xsh_pre::qual, xsh_pre::qual_header, XSH_ARM_NIR, XSH_ASSURE_NOT_NULL, xsh_frame_product(), XSH_FREE, xsh_free_frame(), XSH_GET_TAG_FROM_ARM, xsh_instrument_arm_tostring(), xsh_instrument_get_arm(), XSH_MASTER_BP_MAP_DARK, xsh_pfits_set_qc_bp_map_ntotal(), xsh_pfits_set_qc_multi(), XSH_PRE_DATA_BPP, xsh_pre_free(), xsh_pre_load(), and XSH_QC_BP_MAP_NFLAGi.
cpl_frame* xsh_create_master_flat | ( | cpl_frame * | frame, | |
xsh_instrument * | instr | |||
) |
Definition at line 1426 of file xsh_create_master.c.
References check, xsh_pre::data_header, XSH_ASSURE_NOT_NULL, XSH_FREE, XSH_GET_TAG_FROM_LAMP, XSH_MASTER_FLAT, xsh_msg, XSH_NAME_LAMP_MODE_ARM, xsh_pfits_set_pcatg(), xsh_pre_free(), xsh_pre_load(), xsh_pre_normalize(), and xsh_pre_save().
cpl_frame* xsh_create_master_flat2 | ( | cpl_frameset * | set, | |
cpl_frame * | order_tab_cen, | |||
xsh_stack_param * | stack_par, | |||
xsh_instrument * | inst | |||
) |
Combine master frames.
raw_images | The input images | |
raw_headers | An array containing the input image headers. The ordering must be the same as the ordering of images in the input image list | |
master_flat_header | This header is updated with the normalized exposure time | |
master_bias | The master bias image for this chip, or NULL | |
master_dark | If non-null this master dark frame is subtracted | |
mdark_header | The header of the master dark frame (used only if master_dark is non-null). | |
ordertable | The order table for this chip. Used for background subtraction. | |
order_locations | Polynomial defining the order locations. Used for background subtraction. | |
flames | FLAMES reduction? In this case the background image is not computed/subtracted | |
parameters | The recipe parameter list | |
chip | CCD chip | |
recipe_id | name of calling recipe | |
DEBUG | Save intermediate results to disk? | |
background | (output) The background image which was subtracted |
This function
xsh_backsub_spline()
) .masterflat = median( (flat_i - masterbias)/exptime_i ) - masterdark/exptime_mdark - background
Dark subtraction is optional and is done only if the parameter master_dark is non-NULL.
Definition at line 2198 of file xsh_create_master.c.
Referenced by xsh_mflat_combine_flats().
cpl_frame* xsh_create_master_flat_with_mask | ( | cpl_frame * | frame, | |
cpl_frame * | edges, | |||
xsh_instrument * | instr | |||
) |
Definition at line 1324 of file xsh_create_master.c.
References xsh_pre::biny, check, xsh_pre::data, xsh_pre::data_header, xsh_order::edglopoly, xsh_order::edguppoly, xsh_order::endy, endy, xsh_pre::errs, xsh_order_list::list, xsh_pre::nx, nx, xsh_pre::ny, ny, xsh_pre::qual, xsh_order::starty, starty, x, XSH_ARM_NIR, XSH_ARM_VIS, XSH_ASSURE_NOT_NULL, XSH_FREE, xsh_free_image(), XSH_GET_TAG_FROM_LAMP, xsh_image_flag_bp(), xsh_instrument_get_arm(), xsh_instrument_get_lamp(), XSH_LAMP_D2, XSH_LAMP_QTH, XSH_MASTER_FLAT, xsh_msg, XSH_NAME_LAMP_MODE_ARM, xsh_order_list_eval(), xsh_order_list_free(), xsh_order_list_load(), xsh_pfits_set_pcatg(), xsh_pre_free(), xsh_pre_load(), xsh_pre_save(), and y.
Referenced by xsh_mflat().
static cpl_image* xsh_flat_create_normalized_master | ( | cpl_imagelist * | flats, | |
const cpl_table * | ordertable, | |||
xsh_order_list * | order_locations, | |||
xsh_stack_param * | stack_param | |||
) | [static] |
Stack images using k-sigma clipping.
flats | List of flats to stack | |
ordertable | Input order table | |
order_locations | polynomial description of order locations |
The input list of flats is analized to compute for each flat for each order The median flux on a number of windows of given X * Y size. The mean flux of the values computed on each order is computed. endfor Finally the mean flux of all means is computed. The flat is normalized by the computed mean endfor
Definition at line 1841 of file xsh_create_master.c.
static cpl_image* xsh_flat_create_normalized_master2 | ( | cpl_imagelist * | flats, | |
const cpl_table * | ordertable, | |||
xsh_order_list * | order_locations, | |||
const cpl_image * | mflat, | |||
xsh_stack_param * | stack_param, | |||
cpl_vector ** | vec_flux_stack | |||
) | [static] |
Stack images using k-sigma clipping.
flats | List of flats to stack | |
ordertable | Input order table | |
order_locations | polynomial description of order locations |
The input list of flats is analyzed to compute for each flat for each order The median flux on a number of windows of given X * Y size. The mean flux of the values computed on each order is computed. endfor Finally the mean flux of all means is computed. The flat is normalized by the computed mean endfor
Definition at line 1990 of file xsh_create_master.c.
static cpl_error_code xsh_mbias_get_fpn | ( | const cpl_image * | ima, | |
cpl_parameterlist * | parameters, | |||
double * | fpn | |||
) | [static] |
Definition at line 1756 of file xsh_create_master.c.
static cpl_error_code xsh_mdark_compute_fpn | ( | cpl_frameset * | raws, | |
cpl_parameterlist * | params, | |||
cpl_propertylist * | qclog, | |||
xsh_instrument * | instrument | |||
) | [static] |
Definition at line 546 of file xsh_create_master.c.
References check, xsh_pre::data, xsh_pre::data_header, exptime, XSH_ASSURE_NOT_ILLEGAL_MSG, XSH_ASSURE_NOT_NULL_MSG, xsh_mdark_get_fpn(), xsh_pfits_get_exptime(), xsh_pre_free(), xsh_pre_load(), and xsh_pre_subtract().
Referenced by xsh_create_master_dark2().
static double xsh_mdark_get_contam | ( | xsh_pre * | pre, | |
cpl_parameterlist * | params, | |||
xsh_instrument * | instr | |||
) | [static] |
Definition at line 103 of file xsh_create_master.c.
References xsh_pre::binx, xsh_pre::biny, check, xsh_pre::data, XSH_ARM_NIR, XSH_ARM_UVB, XSH_ARM_VIS, xsh_instrument_get_arm(), xsh_parameters_find(), and xsh_parameters_get_int().
Referenced by set_masterdark_qc().
static cpl_error_code xsh_mdark_get_fpn | ( | cpl_image * | ima, | |
cpl_parameterlist * | params, | |||
cpl_propertylist * | qc_log, | |||
const double | exptime | |||
) | [static] |
Definition at line 462 of file xsh_create_master.c.
References assure, check, check_msg, XSH_ASSURE_NOT_NULL_MSG, xsh_parameters_get_int(), xsh_pfits_set_qc_fpn(), xsh_pfits_set_qc_fpn_err(), xsh_pfits_set_qc_norm_fpn(), and xsh_pfits_set_qc_norm_fpn_err().
Referenced by xsh_mdark_compute_fpn().
cpl_error_code xsh_mdark_get_median_stdev | ( | xsh_pre * | preFrame, | |
cpl_parameterlist * | parameters, | |||
cpl_frame * | crh_frm, | |||
cpl_frame * | bpm_frm | |||
) |
get master mean and stdev over a user defined region
Definition at line 172 of file xsh_create_master.c.
References check, xsh_pre::data, xsh_pre::data_header, xsh_pre::nx, xsh_pre::ny, xsh_pre::qual, ref_llx, ref_lly, ref_urx, ref_ury, xsh_free_image(), XSH_GOOD_PIXEL_LEVEL, xsh_parameters_get_int(), xsh_pfits_set_qc_mdarkavg(), xsh_pfits_set_qc_mdarkmed(), xsh_pfits_set_qc_mdarkrms(), xsh_pre_duplicate(), xsh_pre_free(), xsh_pre_median_mean_stdev_window(), and XSH_PRE_QUAL_TYPE.
Referenced by set_masterdark_qc().
static cpl_error_code xsh_mdark_measure_fpn | ( | xsh_pre * | preFrame, | |
cpl_parameterlist * | parameters, | |||
xsh_instrument * | instrument | |||
) | [static] |
Definition at line 285 of file xsh_create_master.c.
References xsh_instrument::arm, assure, check, check_msg, xsh_pre::data, xsh_pre::data_header, xsh_pre::exptime, exptime, XSH_ARM_NIR, xsh_parameters_get_int(), xsh_pfits_set_qc_fpn(), xsh_pfits_set_qc_fpn_err(), xsh_pfits_set_qc_norm_fpn(), and xsh_pfits_set_qc_norm_fpn_err().
Referenced by set_masterdark_qc().
cpl_error_code xsh_mdark_measure_ron | ( | xsh_pre * | preFrame, | |
cpl_parameterlist * | parameters | |||
) |
Definition at line 373 of file xsh_create_master.c.
References check, xsh_pre::data, ron_llx, ron_lly, ron_urx, ron_ury, and xsh_parameters_get_int().