The uves_cal_tflat recipe

uves_cal_tflat

Synopsis

Reduces a TFLAT frame

Description

This recipe reduces a TFLAT_xxx frame (xxx = BLUE,RED). This is achieved by 1) combining all provided TFLAT frames to a MASTER_TFLAT frame, then 2) doing a normal science reduction on the first input TFLAT frame Input frames are raw TFLAT_xxx frames, and: order table(s) for each chip, ORDER_TABLE_xxxx (where xxxx=BLUE, REDL, REDU), line table(s) for each chip, LINE_TABLE_xxxx, a master bias frame, MASTER_BIAS_xxxx, a master flat, MASTER_FLAT_xxxx,

Constructor

cpl.Recipe("uves_cal_tflat")

Create an object for the recipe uves_cal_tflat.

import cpl
uves_cal_tflat = cpl.Recipe("uves_cal_tflat")

Parameters

uves_cal_tflat.param.backsub.mmethod

Background measuring method. If equal to ‘median’ the background is sampled using the median of a subwindow. If ‘minimum’, the subwindow minimum value is used. If ‘no’, no background subtraction is done. (str; default: ‘median’) [default=”median”].

uves_cal_tflat.param.backsub.npoints

This is the number of columns in interorder space used to sample the background. (int; default: 82) [default=82].

uves_cal_tflat.param.backsub.radiusy

The height (in pixels) of the background sampling window is (2*radiusy + 1). This parameter is not corrected for binning. (int; default: 2) [default=2].

uves_cal_tflat.param.backsub.sdegree

Degree of interpolating splines. Currently only degree = 1 is supported (int; default: 1) [default=1].

uves_cal_tflat.param.backsub.smoothx

If spline interpolation is used to measure the background, the x-radius of the post-smoothing window is (smoothx * image_width). Here, ‘image_width’ is the image width after binning. If negative, the default values are used: (25.0/4096) for blue flat-field frames, (50.0/4096) for red flat-field frames, (300.0/4096) for blue science frames and (300.0/4096) for red science frames. (float; default: -1.0) [default=-1.0].

uves_cal_tflat.param.backsub.smoothy

If spline interpolation is used to measure the background, the y-radius of the post-smoothing window is (smoothy * image_height). Here, ‘image_height’ is the image height after binning. If negative, the default values are used: (100.0/2048) for blue flat-field frames, (300.0/2048) for red flat-field frames, (200.0/2048) for blue science frames and (500.0/2048) for red science frames. (float; default: -1.0) [default=-1.0].

uves_cal_tflat.param.clean_traps

Clean detector traps. If TRUE detector traps are interpolated.The bad pixels are replaced by the average of thenearest good pixels in the same column, or simply marked as bad. The positions of bad pixels are hard-coded (as function of UVES chip). (bool; default: False) [default=False].

uves_cal_tflat.param.debug

Whether or not to save intermediate results to local directory (bool; default: False) [default=False].

uves_cal_tflat.param.norm_method

Method used to build master frame (str; default: ‘explevel’) [default=”explevel”].

uves_cal_tflat.param.plotter

Any plots produced by the recipe are redirected to the command specified by this parameter. The plotting command must contain the substring ‘gnuplot’ and must be able to parse gnuplot syntax on its standard input. Valid examples of such a command may include ‘gnuplot -persist’ and ‘cat > mygnuplot$$.gp’. A finer control of the plotting options can be obtained by writing an executable script, e.g. my_gnuplot.pl, that executes gnuplot after setting the desired gnuplot options (e.g. set terminal pslatex color). To turn off plotting, set this parameter to ‘no’ (str; default: ‘no’) [default=”no”].

uves_cal_tflat.param.process_chip

For RED arm data process the redl, redu, or both chip(s) (str; default: ‘both’) [default=”both”].

uves_cal_tflat.param.reduce.backsub.mmethod

Background measuring method. If equal to ‘median’ the background is sampled using the median of a subwindow. If ‘minimum’, the subwindow minimum value is used. If ‘no’, no background subtraction is done. (str; default: ‘median’) [default=”median”].

uves_cal_tflat.param.reduce.backsub.npoints

This is the number of columns in interorder space used to sample the background. (int; default: 82) [default=82].

uves_cal_tflat.param.reduce.backsub.radiusy

The height (in pixels) of the background sampling window is (2*radiusy + 1). This parameter is not corrected for binning. (int; default: 2) [default=2].

uves_cal_tflat.param.reduce.backsub.sdegree

Degree of interpolating splines. Currently only degree = 1 is supported (int; default: 1) [default=1].

uves_cal_tflat.param.reduce.backsub.smoothx

If spline interpolation is used to measure the background, the x-radius of the post-smoothing window is (smoothx * image_width). Here, ‘image_width’ is the image width after binning. If negative, the default values are used: (25.0/4096) for blue flat-field frames, (50.0/4096) for red flat-field frames, (300.0/4096) for blue science frames and (300.0/4096) for red science frames. (float; default: -1.0) [default=-1.0].

uves_cal_tflat.param.reduce.backsub.smoothy

If spline interpolation is used to measure the background, the y-radius of the post-smoothing window is (smoothy * image_height). Here, ‘image_height’ is the image height after binning. If negative, the default values are used: (100.0/2048) for blue flat-field frames, (300.0/2048) for red flat-field frames, (200.0/2048) for blue science frames and (500.0/2048) for red science frames. (float; default: -1.0) [default=-1.0].

uves_cal_tflat.param.reduce.extract.best

(optimal extraction only) If false (fastest), the spectrum is extracted only once. If true (best), the spectrum is extracted twice, the second time using improved variance estimates based on the first iteration. Better variance estimates slightly improve the obtained signal to noise but at the cost of increased execution time (bool; default: True) [default=True].

uves_cal_tflat.param.reduce.extract.chunk

In optimal extraction mode, the chunk size (in pixels) used for fitting the analytical profile (a fit of the analytical profile to single bins would suffer from low statistics). (int; default: 32) [default=32].

uves_cal_tflat.param.reduce.extract.kappa

In optimal extraction mode, this is the threshold for bad (i.e. hot/cold) pixel rejection. If a pixel deviates more than kappa*sigma (where sigma is the uncertainty of the pixel flux) from the inferred spatial profile, its weight is set to zero. Range: [-1,100]. If this parameter is negative, no rejection is performed. (float; default: 10.0) [default=10.0].

uves_cal_tflat.param.reduce.extract.method

Extraction method. (2d/optimal not supported by uves_cal_wavecal, weighted supported only by uves_cal_wavecal, 2d not supported by uves_cal_response) (str; default: ‘average’) [default=”average”].

uves_cal_tflat.param.reduce.extract.oversample

The oversampling factor used for the virtual resampling algorithm. If negative, the value 5 is used for S/N <=200, and the value 10 is used if the estimated S/N is > 200 (int; default: -1) [default=-1].

uves_cal_tflat.param.reduce.extract.profile

In optimal extraction mode, the kind of profile to use. ‘gauss’ gives a Gaussian profile, ‘moffat’ gives a Moffat profile with beta=4 and a possible linear sky contribution. ‘virtual’ uses a virtual resampling algorithm (i.e. measures and uses the actual object profile). ‘constant’ assumes a constant spatial profile and allows optimal extraction of wavelength calibration frames. ‘auto’ will automatically select the best method based on the estimated S/N of the object. For low S/N, ‘moffat’ or ‘gauss’ are recommended (for robustness). For high S/N, ‘virtual’ is recommended (for accuracy). In the case of virtual resampling, a precise determination of the order positions is required; therefore the order-definition is repeated using the (assumed non-low S/N) science frame (str; default: ‘auto’) [default=”auto”].

uves_cal_tflat.param.reduce.extract.skymethod

In optimal extraction mode, the sky subtraction method to use. ‘median’ estimates the sky as the median of pixels along the slit (ignoring pixels close to the object), whereas ‘optimal’ does a chi square minimization along the slit to obtain the best combined object and sky levels. The optimal method gives the most accurate sky determination but is also a bit slower than the median method (str; default: ‘optimal’) [default=”optimal”].

uves_cal_tflat.param.reduce.ffmethod

Flat-fielding method. If set to ‘pixel’, flat-fielding is done in pixel-pixel space (before extraction); if set to ‘extract’, flat- fielding is performed in pixel-order space (i.e. after extraction). If set to ‘no’, no flat-field correction is done, in which case reduce.rebin.scale should be set to true to ensure flux conservation (both for response and science data) (str; default: ‘extract’) [default=”extract”].

uves_cal_tflat.param.reduce.merge

Order merging method. If ‘optimal’, the flux in the overlapping region is set to the (optimally computed, using the uncertainties) average of single order spectra. If ‘sum’, the flux in the overlapping region is computed as the sum of the single order spectra. If ‘noappend’ the spectrum is simply rebinned but not merged.If flat-fielding is done, method ‘optimal’ is recommended, otherwise ‘sum’. (str; default: ‘optimal’) [default=”optimal”].

uves_cal_tflat.param.reduce.merge_delt1

Order merging left hand (short wavelength) cut. To reduce the amount of order overlapping regions we allow to cut short and long wavelength ranges. This may reduce the ripple possibly introduced by the order merging. Suggested values are: 10 (W<=390), 12 (390<W<=437, 520<W<=564), 14 (437<W<=520, 564<W) (float; default: 0.0) [default=0.0].

uves_cal_tflat.param.reduce.merge_delt2

Order merging right hand (long wavelength) cut. To reduce the amount of order overlapping regions we allow to cut short and long wavelength ranges. This may reduce the ripple possibly introduced by the order merging. Suggested values is 4 (float; default: 0.0) [default=0.0].

uves_cal_tflat.param.reduce.objoffset

Offset (in pixels) of extraction slit with respect to center of order. For optimal extraction the full slit is offset. For linear/average extraction, reduce.objoffset is ignored if reduce.objslit [default -1.0] is negative. In this case the offset is automatically determined by measuring the actual object position. (float; default: 0.0) [default=0.0].

uves_cal_tflat.param.reduce.objslit

Object window size (in pixels), ignored for optimal extraction. The value must be smaller than the total slit length. If negative, the default value (half of full slit length) is used. The upper and lower sky windows are defined as the part of the full slit (if any) outside the object window. The center of the object window is determined by the offset parameter. (float; default: -1.0) [default=-1.0].

uves_cal_tflat.param.reduce.rebin.scale

Whether or not to multiply by the factor dx/dlambda (pixels per wavelength) during the rebinning to conserve the flux. This option is disabled as default because applying the flat field correction already ensures flux conservation. Therefore this parameter should be TRUE (for response and science data) only if reduce.ffmethd = no. (bool; default: False) [default=False].

uves_cal_tflat.param.reduce.rebin.wavestep

The bin size used for BLUE/REDL data (in w.l.u.) in wavelength space. If negative, a step size of 2/3 * ( average pixel size ) is used. (float; default: -1.0) [default=-1.0].

uves_cal_tflat.param.reduce.rebin.wavestep_redu

The bin size used for REDU data (in w.l.u.) in wavelength space. If negative, a step size of 2/3 * ( average pixel size ) is used. (float; default: -1.0) [default=-1.0].

uves_cal_tflat.param.reduce.skysub

Do sky-subtraction (only applicable to linear and average extractions)? (bool; default: False) [default=False].

uves_cal_tflat.param.reduce.slitlength

Extraction slit length (in pixels). If negative, the value inferred from the raw frame header is used (float; default: -1.0) [default=-1.0].

uves_cal_tflat.param.reduce.tiltcorr

If enabled (recommended), the provided dispersion solutions obtained at different slit positions are interpolated linearly at the actually measured position of the object/sky. Line tilt correction is currently not supported for 2d extraction, in which case the dispersion solution obtained at the middle of the slit is always used. (bool; default: True) [default=True].

The following code snippet shows the default settings for the available parameters.

import cpl
uves_cal_tflat = cpl.Recipe("uves_cal_tflat")

uves_cal_tflat.param.backsub.mmethod = "median"
uves_cal_tflat.param.backsub.npoints = 82
uves_cal_tflat.param.backsub.radiusy = 2
uves_cal_tflat.param.backsub.sdegree = 1
uves_cal_tflat.param.backsub.smoothx = -1.0
uves_cal_tflat.param.backsub.smoothy = -1.0
uves_cal_tflat.param.clean_traps = False
uves_cal_tflat.param.debug = False
uves_cal_tflat.param.norm_method = "explevel"
uves_cal_tflat.param.plotter = "no"
uves_cal_tflat.param.process_chip = "both"
uves_cal_tflat.param.reduce.backsub.mmethod = "median"
uves_cal_tflat.param.reduce.backsub.npoints = 82
uves_cal_tflat.param.reduce.backsub.radiusy = 2
uves_cal_tflat.param.reduce.backsub.sdegree = 1
uves_cal_tflat.param.reduce.backsub.smoothx = -1.0
uves_cal_tflat.param.reduce.backsub.smoothy = -1.0
uves_cal_tflat.param.reduce.extract.best = True
uves_cal_tflat.param.reduce.extract.chunk = 32
uves_cal_tflat.param.reduce.extract.kappa = 10.0
uves_cal_tflat.param.reduce.extract.method = "average"
uves_cal_tflat.param.reduce.extract.oversample = -1
uves_cal_tflat.param.reduce.extract.profile = "auto"
uves_cal_tflat.param.reduce.extract.skymethod = "optimal"
uves_cal_tflat.param.reduce.ffmethod = "extract"
uves_cal_tflat.param.reduce.merge = "optimal"
uves_cal_tflat.param.reduce.merge_delt1 = 0.0
uves_cal_tflat.param.reduce.merge_delt2 = 0.0
uves_cal_tflat.param.reduce.objoffset = 0.0
uves_cal_tflat.param.reduce.objslit = -1.0
uves_cal_tflat.param.reduce.rebin.scale = False
uves_cal_tflat.param.reduce.rebin.wavestep = -1.0
uves_cal_tflat.param.reduce.rebin.wavestep_redu = -1.0
uves_cal_tflat.param.reduce.skysub = False
uves_cal_tflat.param.reduce.slitlength = -1.0
uves_cal_tflat.param.reduce.tiltcorr = True

You may also set or overwrite some or all parameters by the recipe parameter param, as shown in the following example:

import cpl
uves_cal_tflat = cpl.Recipe("uves_cal_tflat")
[...]
res = uves_cal_tflat( ..., param = {"backsub.mmethod":"median", "backsub.npoints":82})

See also

cpl.Recipe for more information about the recipe object.

Bug reports

Please report any problems to Jonas M. Larsen. Alternatively, you may send a report to the ESO User Support Department.