The uves_cal_wavecal recipe

uves_cal_wavecal

Synopsis

Performs the wavelength calibration

Description

The recipe performs a wavelength calibration for each extraction window.

Conceptually, each chip contains a number of order lines, each of which contains a number of fibre traces, each of which contains a number of extraction windows. For UVES data, there is only one trace per order and three extraction windows (sky, object, sky). For FLAMES/UVES data there are multiple traces per order but only one extraction window per trace.

The number of traces is defined in the order table while the geometry of the extraction windows is specified by recipe parameters (see below).

Expected input for this recipe is an arc lamp frame, ARC_LAMP_xxx or ECH_ARC_LAMP_xxx (where xxx=BLUE, RED), order table(s) for each chip, ORDER_TABLE_xxxx (where xxxx=BLUE, REDL, REDU), ‘guess’ line table(s) for each chip, LINE_TABLE_xxxx, a wavelength catalogue table, LINE_REFER_TABLE, and optionally a wavelength table of bright lines, LINE_INTMON_TABLE, used only for computing Quality Control parameters.

The output line table(s), LINE_TABLE_xxxx, contains the columns

X            : Horizontal position (from Gaussian fit) of detected line
dX           : Uncertainty (one sigma) of X
Ynew         : Vertical position of detected line
XWidth       : Width (in pixels) of detected line from Gaussian fit
Peak         : Intensity of detected line
Background   : Fitted background (ADU) of detected line
Slope        : Linear background slope (ADU/pixel) of detected line
               from Gaussian fit
Intensity    : Intensity of detected line scaled to unit exposure
               time. (This column only present if a LINE_INTMON_TABLE
               is provided.)
Order        : Absolute order number of detected line
Y            : Relative order number of detected line
               (it's not a very descriptive column name)
WaveC        : Wavelength of this line (computed using the resulting
               dispersion relation)
dLambdaC     : Uncertainty (one sigma) of 'WaveC'.
Pixel        : The width in w.l.u. of a pixel (computed locally).
Residual     : Residual (in w.l.u.) of this line
Residual_pix : Residual (in pixels) of this line
Lambda_candidate : Nearest line in catalogue
dLambda_cat_sq   : Squared distance to nearest catalogue line
dLambda_nn_sq    : Squared distance to nearest neighbour multiplied by ALPHA
Ident        : The wavelength associated with this emission line,
               or invalid if this line was not identified
dIdent       : Uncertainty of catalogue wavelength
Select       : 1 if the line was identified, 0 otherwise
NLinSol      : 1 if the line was identified and accepted for the
               polynomial fit, 0 otherwise
Intensity    : Intensity of detected line scaled to unit exposure
               time. (This column is present only if a LINE_INTMON_TABLE
               is provided.)

The 2nd table extension contains the dispersion relation (a 2d polynomial). The 3rd table extension contains the map from (pixel, pixel)-space to

physical order numbers (used internally by the calibration recipe;

another 2d polynomial).

If there is more than one extraction window, the results of each calibration is stored in subsequent table extensions of the same FITS file. For example, extensions 4, 5 and 6 would contain the resulting line table (and its two associated polynomials) for the second extraction window. The results for the calibration of the n’th extraction window is stored in extensions (3*n - 2) to 3*n.

Constructor

cpl.Recipe("uves_cal_wavecal")

Create an object for the recipe uves_cal_wavecal.

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

Parameters

uves_cal_wavecal.param.alpha

The parameter that controls the distance to the nearest neighbours (float; default: 0.1) [default=0.1].

uves_cal_wavecal.param.debug

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

uves_cal_wavecal.param.degree

Degrees of the global 2d dispersion polynomial. If a negative number is specified, the polynomial degrees are automatically selected by starting from (1, 1) and inreasing the degrees as long as the RMS residual decreases significantly (int; default: 4) [default=4].

uves_cal_wavecal.param.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_wavecal.param.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_wavecal.param.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_wavecal.param.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_wavecal.param.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_wavecal.param.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_wavecal.param.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_wavecal.param.kappa

Lines with residuals more then kappa stdev are rejected from the final fit (float; default: 4.0) [default=4.0].

uves_cal_wavecal.param.length

Length (in pixels) of each extraction window. This parameter is also equal to the seperation of adjacent window centers, causing the extraction windows to always be aligned. The parameter is automatically adjusted according to the binning of the input raw frame. If negative, the extraction window length is determined automatically to cover the full slit (float; default: -1.0) [default=-1.0].

uves_cal_wavecal.param.maxerror

This parameter controls the graceful exit of the identification loop. If the RMS of the global fit exceeds this value (pix) the iteration stops (float; default: 20.0) [default=20.0].

uves_cal_wavecal.param.maxlines

Maximum number of lines to detect. If zero, the default value (1600 for BLUE/REDL chip; 1400 for REDU chip) is used. (int; default: 0) [default=0].

uves_cal_wavecal.param.minlines

Minimum number of lines to detect. If zero, the default value (1100 for BLUE/REDL chips; 1000 for REDU chip) is used. (int; default: 0) [default=0].

uves_cal_wavecal.param.nwindows

Number of extraction windows per trace. The windows will be aligned (i.e. no overlap and no spacing between adjacent windows). Unless an offset is specified, the middle window(s) is centered on the trace (int; default: 3) [default=3].

uves_cal_wavecal.param.offset

A global offset (in pixels) of all extraction windows (float; default: 0.0) [default=0.0].

uves_cal_wavecal.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_wavecal.param.process_chip

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

uves_cal_wavecal.param.range

Width (pix) of search window is 2*range + 1. This parameter is automatically adjusted according to binning. (int; default: 8) [default=8].

uves_cal_wavecal.param.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_wavecal.param.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_wavecal.param.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_wavecal.param.shiftmax

The maximum shift (pix) in either direction compared to guess solution. This parameter is automatically corrected for binning (float; default: 10.0) [default=10.0].

uves_cal_wavecal.param.shiftstep

The step size (pix) used when searching for the optimum shift. This parameter is automatically corrected for binning (float; default: 0.1) [default=0.1].

uves_cal_wavecal.param.shifttoler

Tolerance (pix) when matching shifted lines. This parameter is not adjusted according to binning (float; default: 0.05) [default=0.05].

uves_cal_wavecal.param.tolerance

Tolerance of fit. If positive, the tolerance is in pixel units. If negative, abs(tolerance) is in wavelength units. Lines with residuals worse than the tolerance are excluded from the final fit. Unlike in previous versions, this parameter is not corrected for CCD binning. This rejection based on the absolute residual in pixel can be effectively disabled by setting the tolerance to a very large number (e.g. 9999). In that case outliers will be rejected using only kappa sigma clipping. (float; default: 0.6) [default=0.6].

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

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

uves_cal_wavecal.param.alpha = 0.1
uves_cal_wavecal.param.debug = False
uves_cal_wavecal.param.degree = 4
uves_cal_wavecal.param.extract.best = True
uves_cal_wavecal.param.extract.chunk = 32
uves_cal_wavecal.param.extract.kappa = 10.0
uves_cal_wavecal.param.extract.method = "average"
uves_cal_wavecal.param.extract.oversample = -1
uves_cal_wavecal.param.extract.profile = "auto"
uves_cal_wavecal.param.extract.skymethod = "optimal"
uves_cal_wavecal.param.kappa = 4.0
uves_cal_wavecal.param.length = -1.0
uves_cal_wavecal.param.maxerror = 20.0
uves_cal_wavecal.param.maxlines = 0
uves_cal_wavecal.param.minlines = 0
uves_cal_wavecal.param.nwindows = 3
uves_cal_wavecal.param.offset = 0.0
uves_cal_wavecal.param.plotter = "no"
uves_cal_wavecal.param.process_chip = "both"
uves_cal_wavecal.param.range = 8
uves_cal_wavecal.param.rebin.scale = False
uves_cal_wavecal.param.rebin.wavestep = -1.0
uves_cal_wavecal.param.rebin.wavestep_redu = -1.0
uves_cal_wavecal.param.shiftmax = 10.0
uves_cal_wavecal.param.shiftstep = 0.1
uves_cal_wavecal.param.shifttoler = 0.05
uves_cal_wavecal.param.tolerance = 0.6

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_wavecal = cpl.Recipe("uves_cal_wavecal")
[...]
res = uves_cal_wavecal( ..., param = {"alpha":0.1, "debug":False})

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.