Finds optical distortions and slitlets distances
This recipe determines the optical distortions and the slitlets distances.
Necessary input are: Several (usually 75) raw frames classified as FIBRE_NS Standard (an ‘ON’ and an ‘OFF’) flat frames having classified as FLAT_NS Standard (an ‘ON’ and an ‘OFF’) arc lamp frames having classified as WAVE_NS A corresponding (band) reference arc line list classified as REF_LINE_ARC A reference table with data reduction parameters classified as DRS_SETUP_WAVE.
Default output are (with their PRO.CATG) A master flat: MASTER_FLAT_LAMP A Bad pixel map: BP_MAP_DI A fake-off fibre stacked frame: FIBRE_NS_STACKED_OFF A fake-on fibre stacked frame: FIBRE_NS_STACKED_ON A fake on-off fibre stacked frame: FIBRE_NS_STACKED A table with optical distortion coefficients: DISTORTION A distortion corrected frame: FIBRE_NS_STACKED_DIST A temporary frame: MASTER_SLIT A table with the slitlets distances: SLITLETS_DISTANCE Information on relevant parameters can be found with: esorex –params sinfo_rec_distortion esorex –help sinfo_rec_distortion
Create an object for the recipe sinfo_rec_distortion.
import cpl
sinfo_rec_distortion = cpl.Recipe("sinfo_rec_distortion")
Overwrite DRS ini parameters: (bool; default: True) [default=True].
Correct for bad lines introduced by instrument software: (bool; default: False) [default=False].
Kappa sigma value (long; default: 18) [default=18].
Filtering radii applied during median filter. Should be small (long; default: 3) [default=3].
Density of pipeline products: 0 (low), 1 (low+skycor), 2 (med-QC), 3 (high-debug+skycor) (long; default: 2) [default=2].
lower rejection: percentage of rejected low intensity pixels before averaging (float; default: 0.1) [default=0.1].
high rejection: percentage of rejected high intensity pixels before averaging (float; default: 0.1) [default=0.1].
Interpolation index switch: indicator if the bad pixels of the flatfield should be interpolated (bool; default: False) [default=False].
Max Rad: maximal pixel distance from bad pixel to take valid pixels (long; default: 4) [default=4].
indicator if a bad pixel mask should be generated or not (bool; default: False) [default=False].
Sigma Factor: factor of the sigma noise limit; to remove the column intensity tilt only pixels which lie within a defined noise limit are used to fit a straight line (float; default: 5.0) [default=5.0].
Factor: if |pixel - median| > factor * standard deviation -> then the pixel value is replaced by the median of the 8 nearest neighbors (float; default: 3.0) [default=3.0].
Iterations: number of iterations to of median filtering to find bad pixel clusters (long; default: 8) [default=8].
low rejection: Percentage for bad pixel low rejection (float; default: 10.0) [default=10.0].
high rejection: Percentage for bad pixel high rejection (float; default: 10.0) [default=10.0].
Lower Lext X corner (long; default: 1350) [default=1350].
Lower Lext Y corner (long; default: 1000) [default=1000].
Upper right X corner (long; default: 1390) [default=1390].
Upper right Y corner (long; default: 1200) [default=1200].
Treshold index: (bool; default: False) [default=False].
Mean Factor: factor to the clean standard deviation to define the threshold deviation from the clean mean (float; default: 10.0) [default=10.0].
qc_fpn_xmin1 (long; default: 512) [default=512].
qc_fpn_xmax1 (long; default: 1536) [default=1536].
qc_fpn_ymin1 (long; default: 512) [default=512].
qc_fpn_ymax1 (long; default: 1536) [default=1536].
qc_fpn_xmin2 (long; default: 1350) [default=1350].
qc_fpn_xmax2 (long; default: 1390) [default=1390].
qc_fpn_ymin2 (long; default: 1000) [default=1000].
qc_fpn_ymax2 (long; default: 1200) [default=1200].
qc_thresh_min (long; default: 0) [default=0].
qc_thresh_max (long; default: 49000) [default=49000].
Data reduction method: (str; default: ‘Normal’) [default=”Normal”].
Threshold Sigma Factor: to remove the column intensity tilt only pixels which lie within a defined noiselimit are used to fit a straight line (float; default: 2.0) [default=2.0].
Bad pixel Method Index1: median of nearest neighbors,2: absolute distances check, 3: mean of nearest spectral neighbors (long; default: 1) [default=1].
Factor: if |pixel - sinfo_median| > factor * standard deviation -> then the pixel value is replaced by the median of the 8 nearest neighbors (float; default: 999.0) [default=999.0].
Iterations: number of iterations to of median filtering to find bad pixel clusters (long; default: 8) [default=8].
low_rejection: percentage of rejected low intensity pixels before averaging (float; default: 0.1) [default=0.1].
high_rejection: percentage of rejected high intensity pixels before averaging (float; default: 0.1) [default=0.1].
llx: to compute image statistics on a rectangularzone of the image the coordinates of the rectangle are needed:lower left x coordinate (long; default: 1350) [default=1350].
lly: to compute image statistics on a rectangularzone of the image the coordinates of the rectangle are needed:lower left y coordinate (long; default: 1000) [default=1000].
urx: to compute image statistics on a rectangularzone of the image the coordinates of the rectangle are needed:upper right x coordinate (long; default: 1390) [default=1390].
ury: to compute image statistics on a rectangularzone of the image the coordinates of the rectangle are needed:upper right y coordinate (long; default: 1200) [default=1200].
Threshold Index: indicator that indicates if the values beyond a threshold deviation from the mean are flagged as bad pixels (bool; default: True) [default=True].
Mean Factor: factor to the clean standard deviation to define the threshold deviation from the clean mean (float; default: 999.0) [default=999.0].
the minimum value of real data (float; default: 0.1) [default=0.1].
the minimum value of real data (float; default: 50000.0) [default=50000.0].
lower rejection (float; default: 0.1) [default=0.1].
higher rejection (float; default: 0.1) [default=0.1].
Flat Index: (bool; default: True) [default=True].
Normalize master flat to its smoothed value (to remove lamp response curve). 0 (no smooth). 1 (apply fft filter along y).2 (apply running median filter along y). (long; default: 0) [default=0].
Normalization smoothing radii (long; default: 16) [default=16].
BP Mask Interpolation Switch: indicates if the bad pixel mask should be applied (1) or not (0) (long; default: 1) [default=1].
indicates if the bad pixels should be indicated (yes) or interpolated (no) (bool; default: False) [default=False].
Max distance bad-good pix: (long; default: 4) [default=4].
Gaussian Convolution Switch: (bool; default: False) [default=False].
Kernel Half Width (long; default: 2) [default=2].
Warp Fix Index: (bool; default: True) [default=True].
Warpfix kernel: (str; default: ‘tanh’) [default=”tanh”].
qc_thresh_min (long; default: 0) [default=0].
qc_thresh_max (long; default: 49000) [default=49000].
indicates if the raw sky frame should be subtracted (TRUE) or (FALSE) (bool; default: True) [default=True].
Calib Indicator: FALSE: if the dispersion relation is already known, the routine can jump to the waveMap section TRUE: if the dispersion relation must first be determined (bool; default: True) [default=True].
Minimum Of Difference: minimum difference of mean and median column intensity to carry out the cross correlation (float; default: 10.0) [default=10.0].
Half Width: half width of a box within which the line must be placed (long; default: 7) [default=7].
Sigma: sigma of Gaussian which is convolved with the artificial spectrum generated using the line list (float; default: 2.0) [default=2.0].
FWHM: initial guess value for the fwhm of the Gaussian used for the line fit (float; default: 2.83) [default=2.83].
Minimum Of Amplitude: of the Gaussian to do the fit (float; default: 5.0) [default=5.0].
Maximum Residuals value: beyond this value the fit is rejected (float; default: 0.5) [default=0.5].
Number of A coefficients: number of polynomial coefficients for the dispersion relation (long; default: 4) [default=4].
Number of B coefficients: number of polynomial coefficients for the polynomial fit of the dispersion coefficients (long; default: 2) [default=2].
Sigma Factor: Factor of the standard deviation of the polynomial coefficients of the dispersion relation beyond which the coefficients are not used for the fit (float; default: 1.5) [default=1.5].
Write Coefficients Index: indicates if the coefficients should be written into a file or not (bool; default: True) [default=True].
Write Parameter Index: indicates if the fit parameters should be written into a file or not (bool; default: True) [default=True].
Minimal Slitlets’s Distance in spectral direction (long; default: 15) [default=15].
Pixel Tolerance: allowed pixel position tolerance between estimated and fitted line position (float; default: 5.0) [default=5.0].
Wavelength Map Indicator: indicates if the wavelength calibration map should be generated (TRUE) or not (FALSE) (bool; default: False) [default=False].
Magnificator Factor: magnifying factor for the number of pixels in the columns needed for FFT (long; default: 8) [default=8].
Slit Position Indicator: indicates if the fits of the slitlet edge positions should be carried through or not (bool; default: True) [default=True].
Fit Boltzmann Indicator: indicates if the fits of the slitlet edge positions is carried trough by using a Boltzmann function as model function (bool; default: True) [default=True].
Fit Edge Indicator: indicates if the fits of the slitlet edge positions is carried through by using a simple edge function as model function (bool; default: False) [default=False].
Estimate Indicator: indicates if the fits of the slitlet edge positions is carried through by using a list of estimated guess positions in a file (TRUE)or if the initial positions are calculated automatically (FALSE). The estimation case is more stable (bool; default: False) [default=False].
Box Length: pixel length of the row box within which the fit is carried out (long; default: 32) [default=32].
Y Box: half width of a small box in spectral direction within which the maximal intensity pixel is searched (float; default: 5.0) [default=5.0].
Difference Tolearance: maximal tolerable difference of the resulting fit positions of the slitlet edges with respect to the expected positions (float; default: 2.0) [default=2.0].
qc_thresh_min (long; default: 0) [default=0].
qc_thresh_max (long; default: 49000) [default=49000].
lower rejection: percentage of rejected low intensity pixels before averaging (float; default: 0.1) [default=0.1].
higher rejection: percentage of rejected high intensity pixels before averaging (float; default: 0.1) [default=0.1].
Mask Index: indicator if a bad pixel mask is applied or not (bool; default: False) [default=False].
Gauss Index: (bool; default: False) [default=False].
Kernel Half Width kernel half width of the Gaussian response function (long; default: 2) [default=2].
Half Width (long; default: 4) [default=4].
FWHM (float; default: 2.0) [default=2.0].
Minimum of Difference (float; default: 1.0) [default=1.0].
Dev Tol (float; default: 20.0) [default=20.0].
arcs threshold factor. median_value(image)+ kappa*sigma is the minimum intensity threshold of accepted imagepixels (float; default: 0.33333) [default=0.33333].
factor which sets minimum arc length (1.0-2) (float; default: 1.19) [default=1.19].
Size of window for low pass fileter used inan horizzontal low pass filter to remove unwanted arcs (5-64) (long; default: 14) [default=14].
Size of smoothing factor (1-11) used to prevent for possible intensity drops from detector electronics on fibre illuminated slitlets (1-11) (long; default: 3) [default=3].
lower rejection: percentage of rejected low intensity pixels before averaging (float; default: 0.1) [default=0.1].
higher rejection: percentage of rejected high intensity pixels before averaging (float; default: 0.1) [default=0.1].
Mask Index: indicator if a bad pixel mask is applied or not (bool; default: False) [default=False].
Gauss Index: (bool; default: False) [default=False].
Kernel Half Width kernel half width of the Gaussian response function (long; default: 2) [default=2].
Half Width (long; default: 4) [default=4].
FWHM (float; default: 2.0) [default=2.0].
Minimum of Difference (float; default: 1.0) [default=1.0].
Dev Tol (float; default: 20.0) [default=20.0].
The following code snippet shows the default settings for the available parameters.
import cpl
sinfo_rec_distortion = cpl.Recipe("sinfo_rec_distortion")
sinfo_rec_distortion.param.gen_overpar = True
sinfo_rec_distortion.param.lc_sw = False
sinfo_rec_distortion.param.lc_kappa = 18
sinfo_rec_distortion.param.lc_filt_rad = 3
sinfo_rec_distortion.param.product_density = 2
sinfo_rec_distortion.param.lamp_flats_lo_rej = 0.1
sinfo_rec_distortion.param.lamp_flats_hi_rej = 0.1
sinfo_rec_distortion.param.lamp_flats_interpol_index = False
sinfo_rec_distortion.param.lamp_flats_max_rad = 4
sinfo_rec_distortion.param.lamp_flats_bad_ind = False
sinfo_rec_distortion.param.lamp_flats_sigma_factor = 5.0
sinfo_rec_distortion.param.lamp_flats_factor = 3.0
sinfo_rec_distortion.param.lamp_flats_iterations = 8
sinfo_rec_distortion.param.lamp_flats_bad_lo_rej = 10.0
sinfo_rec_distortion.param.lamp_flats_bad_hi_rej = 10.0
sinfo_rec_distortion.param.lamp_flats_llx = 1350
sinfo_rec_distortion.param.lamp_flats_lly = 1000
sinfo_rec_distortion.param.lamp_flats_rrx = 1390
sinfo_rec_distortion.param.lamp_flats_ury = 1200
sinfo_rec_distortion.param.lamp_flats_tresh_ind = False
sinfo_rec_distortion.param.lamp_flats_mean_factor = 10.0
sinfo_rec_distortion.param.lamp_flats_qc_fpn_xmin1 = 512
sinfo_rec_distortion.param.lamp_flats_qc_fpn_xmax1 = 1536
sinfo_rec_distortion.param.lamp_flats_qc_fpn_ymin1 = 512
sinfo_rec_distortion.param.lamp_flats_qc_fpn_ymax1 = 1536
sinfo_rec_distortion.param.lamp_flats_qc_fpn_xmin2 = 1350
sinfo_rec_distortion.param.lamp_flats_qc_fpn_xmax2 = 1390
sinfo_rec_distortion.param.lamp_flats_qc_fpn_ymin2 = 1000
sinfo_rec_distortion.param.lamp_flats_qc_fpn_ymax2 = 1200
sinfo_rec_distortion.param.lamp_flats_qc_thresh_min = 0
sinfo_rec_distortion.param.lamp_flats_qc_thresh_max = 49000
sinfo_rec_distortion.param.bp_method = "Normal"
sinfo_rec_distortion.param.bp_dist_s_factor = 2.0
sinfo_rec_distortion.param.bp_dist_method_ind = 1
sinfo_rec_distortion.param.bp_dist_fct = 999.0
sinfo_rec_distortion.param.bp_dist_it = 8
sinfo_rec_distortion.param.bp_dist_lo_rej = 0.1
sinfo_rec_distortion.param.bp_dist_hi_rej = 0.1
sinfo_rec_distortion.param.bp_dist_llx = 1350
sinfo_rec_distortion.param.bp_dist_lly = 1000
sinfo_rec_distortion.param.bp_dist_urx = 1390
sinfo_rec_distortion.param.bp_dist_ury = 1200
sinfo_rec_distortion.param.bp_dist_thr_ind = True
sinfo_rec_distortion.param.bp_dist_mean_fct = 999.0
sinfo_rec_distortion.param.bp_dist_min_cut = 0.1
sinfo_rec_distortion.param.bp_dist_max_cut = 50000.0
sinfo_rec_distortion.param.stack_lo_rej = 0.1
sinfo_rec_distortion.param.stack_hi_rej = 0.1
sinfo_rec_distortion.param.stack_flat_ind = True
sinfo_rec_distortion.param.stack_mflat_norm_smooth = 0
sinfo_rec_distortion.param.stack_mflat_smooth_rad = 16
sinfo_rec_distortion.param.stack_mask_ind = 1
sinfo_rec_distortion.param.stack_ind_ind = False
sinfo_rec_distortion.param.stack_mask_rad = 4
sinfo_rec_distortion.param.stack_gauss_ind = False
sinfo_rec_distortion.param.stack_khw = 2
sinfo_rec_distortion.param.stack_warpfix_ind = True
sinfo_rec_distortion.param.stack_warpfix_kernel = "tanh"
sinfo_rec_distortion.param.stack_qc_thresh_min = 0
sinfo_rec_distortion.param.stack_qc_thresh_max = 49000
sinfo_rec_distortion.param.stack_sub_raw_sky = True
sinfo_rec_distortion.param.dist_calib_indicator = True
sinfo_rec_distortion.param.dist_min_diff_mean_med_col_int = 10.0
sinfo_rec_distortion.param.dist_hw = 7
sinfo_rec_distortion.param.dist_sigma = 2.0
sinfo_rec_distortion.param.dist_fwhm = 2.83
sinfo_rec_distortion.param.dist_min_amplitude = 5.0
sinfo_rec_distortion.param.dist_max_residual = 0.5
sinfo_rec_distortion.param.dist_n_a_coeffs = 4
sinfo_rec_distortion.param.dist_n_b_coeffs = 2
sinfo_rec_distortion.param.dist_sigma_factor = 1.5
sinfo_rec_distortion.param.dist_wcoeff_ind = True
sinfo_rec_distortion.param.dist_par_ind = True
sinfo_rec_distortion.param.dist_pixel_dist = 15
sinfo_rec_distortion.param.dist_pixel_tol = 5.0
sinfo_rec_distortion.param.dist_wave_map_ind = False
sinfo_rec_distortion.param.dist_mag_factor = 8
sinfo_rec_distortion.param.dist_slit_pos_ind = True
sinfo_rec_distortion.param.dist_fit_boltz_ind = True
sinfo_rec_distortion.param.dist_fit_edge_ind = False
sinfo_rec_distortion.param.dist_estimate_ind = False
sinfo_rec_distortion.param.dist_box_len = 32
sinfo_rec_distortion.param.dist_y_box = 5.0
sinfo_rec_distortion.param.dist_diff_toll = 2.0
sinfo_rec_distortion.param.dist_qc_thresh_min = 0
sinfo_rec_distortion.param.dist_qc_thresh_max = 49000
sinfo_rec_distortion.param.ns_lo_rejection = 0.1
sinfo_rec_distortion.param.ns_hi_rejection = 0.1
sinfo_rec_distortion.param.ns_mask_ind = False
sinfo_rec_distortion.param.ns_gauss_ind = False
sinfo_rec_distortion.param.ns_khw = 2
sinfo_rec_distortion.param.ns_hw = 4
sinfo_rec_distortion.param.ns_fwhm = 2.0
sinfo_rec_distortion.param.ns_min_diff = 1.0
sinfo_rec_distortion.param.ns_dev_tol = 20.0
sinfo_rec_distortion.param.arcs_thresh_factor = 0.33333
sinfo_rec_distortion.param.arcs_min_arclen_factor = 1.19
sinfo_rec_distortion.param.arcs_window_size = 14
sinfo_rec_distortion.param.smooth_rad = 3
sinfo_rec_distortion.param.ns_lo_rej = 0.1
sinfo_rec_distortion.param.ns_hi_rej = 0.1
sinfo_rec_distortion.param.ns_mask_ind = False
sinfo_rec_distortion.param.ns_gauss_ind = False
sinfo_rec_distortion.param.ns_khw = 2
sinfo_rec_distortion.param.ns_hw = 4
sinfo_rec_distortion.param.ns_fwhm = 2.0
sinfo_rec_distortion.param.ns_min_diff = 1.0
sinfo_rec_distortion.param.ns_dev_tol = 20.0
You may also set or overwrite some or all parameters by the recipe parameter param, as shown in the following example:
import cpl
sinfo_rec_distortion = cpl.Recipe("sinfo_rec_distortion")
[...]
res = sinfo_rec_distortion( ..., param = {"gen_overpar":True, "lc_sw":False})
See also
cpl.Recipe for more information about the recipe object.
Please report any problems to Andrea Modigliani. Alternatively, you may send a report to the ESO User Support Department.
This file is part of the SINFONI Instrument Pipeline Copyright (C) 2002,2003 European Southern Observatory
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Code author: Andrea Modigliani <Andrea.Modigliani@eso.org>