SYNOPSISesorex kmos_flat [OPTIONS] FILE.sof
DESCRIPTIONThis recipe creates the master flat field and calibration frames needed for spatial calibration for all three detectors. It must be called after the kmo_dark-recipe, which generates a bad pixel mask (badpixel_dark.fits). The bad pixel mask will be updated in this recipe.
As input at least 3 dark frames, 3 frames with the flat lamp on are recommended. Additionally a badpixel mask from kmo_dark is required.
The badpixel mask contains 0 for bad pixels and 1 for good ones.
The structure of the resulting xcal and ycal frames is quite complex since the arrangement of the IFUs isn't just linear on the detector. Basically the integer part of the calibration data shows the offset of each pixels centre in mas (Milli arcsec) from the field centre. The viewing of an IFU is 2800 mas (14pix*0.2arcsec/pix). So the values in these two frames will vary between +/-1500 (One would expect 1400, but since the slitlets aren't expected to be exactly vertical, the values can even go up to around 1500).
Additionally in the calibration data in y-direction the decimal part of the data designates the IFU to which the slitlet corresponds to (for each detector from 1 to 8).
Because of the irregular arrangement of the IFUs not all x-direction
calibration data is found in xcal and similarly not all y-direction
calibration data is located in ycal. For certain IFUs they are switched
and/or flipped in x- or y-direction: For IFUs 1,2,3,4,13,14,15,16: x- and y- data is switched For IFUs 17,18,19,20: y-data is flipped For IFUs 21,22,23,24: x-data is flipped For IFUs 5,6,7,8,9,10,11,12: x- and y- data is switched and
x- and y- data is flipped
Furthermore frames can be provided for several rotator angles. In this case the resulting calibration frames for each detector are repeatedly saved as extension for every angle.
Advanced features: ------------------ To create the badpixel mask the edges of all slitlets are fitted to a polynomial. Since it can happen that some of these fits (3 detectors 8 IFUs * 14slitlets * 2 edges (left and right edge of slitlet)= 672 edges) fail, the fit parameters are themselves fitted again to detect any outliers.
By default, the parameters of all left and all right edges are grouped individually and then fitted using chebyshev polynomials. The advantage of a chebyshev polynomial is, that it consists in fact of a series of orthogonal polynomials. This implies that the parameters of the polynomials are independent. This fact predestines the use of chebyshev polynomials for our case. So each individual parameter can be examined independently.
The reason why the left and right edges are fitted individually is that there is a systematic pattern specific to these groups. The reason for this pattern is probably to be found in the optical path the light is traversing.
BASIC PARAMETERS--badpix_thresh The threshold level to mark pixels as bad on the dark subtracted frames [%] --surrounding_pixels The amount of bad pixels to surround a specific pixel, to let it be marked bad as well.
Following methods of frame combination are available:
* 'ksigma' (Default)
An iterative sigma clipping. For each position all pixels in the
spectrum are examined. If they deviate significantly, they will be
rejected according to the conditions:
val > mean + stdev * cpos_rej
val < mean - stdev * cneg_rej
where --cpos_rej, --cneg_rej and --citer are the configuration
parameters. In the first iteration median and percentile level are used.
At each pixel position the median is calculated.
At each pixel position the average is calculated.
At each pixel position the sum is calculated.
The specified number of min and max pixel values will be rejected.
--cmax and --cmin apply to this method.
ADVANCED PARAMETERS--cpos_rej --cneg_rej --citer see --cmethod='ksigma'
--cmax --cmin see --cmethod='min_max'
--suppress_extension If set to TRUE, the arbitrary filename extensions are supressed. If multiple products with the same category are produced, they will be numered consecutively starting from 0.
DO CATG Type Explanation Required #Frames
------- ----- ----------- -------- -------
FLAT_ON RAW Flatlamp-on exposures Y 1-n
(at least 3 frames recommended)
FLAT_OFF RAW Flatlamp-off exposures Y 1-n
(at least 3 frames recommended)
BADPIXEL_DARK B2D Bad pixel mask Y 1
DO CATG Type Explanation
------- ----- -----------
MASTER_FLAT F2D Normalised flat field
(6 extensions: alternating data & noise
BADPIXEL_FLAT B2D Updated bad pixel mask (3 Extensions)
XCAL F2D Calibration frame 1 (3 Extensions)
YCAL F2D Calibration frame 2 (3 Extensions)
FLAT_EDGE F2L Frame containing parameters of fitted
slitlets of all IFUs of all detectors
- --badpix_thresh <long>
- The threshold level to mark bad pixels [%]. (long; default: 35). The full name of this option for the EsoRex configuration file is kmos.kmos_flat.badpix_thresh [default = 35].
- --surrounding_pixels <long>
- The nb of bad surrounding pix to mark a pixel bad (long; default: 5). The full name of this option for the EsoRex configuration file is kmos.kmos_flat.surrounding_pixels [default = 5].
- --suppress_extension <bool>
- Suppress arbitrary filename extension (bool; default: False). The full name of this option for the EsoRex configuration file is kmos.kmos_flat.suppress_extension [default = False].
- --cmethod <str>
- Apply "average", "median", "sum", "min_max." or "ksigma". (str; default: 'ksigma'). The full name of this option for the EsoRex configuration file is kmos.kmos_flat.cmethod [default = ksigma].
- --cpos_rej <float>
- The positive rejection threshold for kappa-sigma-clipping (sigma). (float; default: 3.0). The full name of this option for the EsoRex configuration file is kmos.kmos_flat.cpos_rej [default = 3.0].
- --cneg_rej <float>
- The negative rejection threshold for kappa-sigma-clipping (sigma). (float; default: 3.0). The full name of this option for the EsoRex configuration file is kmos.kmos_flat.cneg_rej [default = 3.0].
- --citer <long>
- The number of iterations for kappa-sigma-clipping. (long; default: 3). The full name of this option for the EsoRex configuration file is kmos.kmos_flat.citer [default = 3].
- --cmax <long>
- The number of maximum pixel values to clip with min/max-clipping. (long; default: 1). The full name of this option for the EsoRex configuration file is kmos.kmos_flat.cmax [default = 1].
- --cmin <long>
- The number of minimum pixel values to clip with min/max-clipping. (long; default: 1). The full name of this option for the EsoRex configuration file is kmos.kmos_flat.cmin [default = 1].
- --det <long>
- Only reduce the specified detector (long; default: 0). The full name of this option for the EsoRex configuration file is kmos.kmos_flat.detector [default = 0].
- --angle <float>
Only reduce the specified angle (float; default: 370.0). The full name of this option for the EsoRex configuration
file is kmos.kmos_flat.angle [default = 370.0].
Note that it is possible to create a configuration file containing these options, along with suitable default values. Please refer to the details provided by the 'esorex --help' command.
AUTHORAlex Agudo Berbel, Yves Jung <[email protected]>
BUG REPORTSPlease report any problems to [email protected] Alternatively, you may send a report to the ESO User Support Department <[email protected]>.
LICENSEThis file is part of the CRIRES 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