The muse_wavecal recipe



Detect arc emission lines and determine the wavelength solution for each slice.


This recipe detects arc emission lines and fits a wavelength solution to each slice of the instrument. The wavelength calibration table contains polynomials defining the wavelength solution of the slices on the CCD. Processing trims the raw data and records the overscan statistics, subtracts the bias (taking account of the overscan, if –overscan is not “none”) and converts them from adu to count. Optionally, the dark can be subtracted and the data can be divided by the flat-field, but this is not recommended. The data is then combined using input parameters, into separate images for each lamp. To compute the wavelength solution, arc lines are detected at the center of each slice (using threshold detection on a S/N image) and subsequently assigned wavelengths, using pattern matching to identify lines from the input line catalog. Each line is then traced to the edges of the slice, using Gaussian centering in each CCD column. The Gaussians not only yield center, but also centering error, and line properties (e.g. FWHM). Deviant fits are detected using polynomial fits to each arc line (using the xorder parameter) and rejected. These analysis and measuring steps are carried out separately on images exposed by the different arc lamps, reducing the amount of blending, that can otherwise influence line identification and Gaussian centering. The final two-dimensional fit uses all positions (of all lamps), their wavelengths, and the given polynomial orders to compute the final wavelength solution for each slice, iteratively rejecting outliers. This final fit can be either unweighted (fitweighting=”uniform”, for fastest processing) or weighted (other values of fitweighting, for higher accuracy).



Create an object for the recipe muse_wavecal.

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



IFU to handle. If set to 0, all IFUs are processed serially. If set to -1, all IFUs are processed in parallel. (int; default: 0) [default=0].


If this is “none”, stop when detecting discrepant overscan levels (see ovscsigma), for “offset” it assumes that the mean overscan level represents the real offset in the bias levels of the exposures involved, and adjusts the data accordingly; for “vpoly”, a polynomial is fit to the vertical overscan and subtracted from the whole quadrant. (str; default: ‘vpoly’) [default=”vpoly”].


This influences how values are rejected when computing overscan statistics. Either no rejection at all (“none”), rejection using the DCR algorithm (“dcr”), or rejection using an iterative constant fit (“fit”). (str; default: ‘dcr’) [default=”dcr”].


If the deviation of mean overscan levels between a raw input image and the reference image is higher than |ovscsigma x stdev|, stop the processing. If overscan=”vpoly”, this is used as sigma rejection level for the iterative polynomial fit (the level comparison is then done afterwards with |100 x stdev| to guard against incompatible settings). Has no effect for overscan=”offset”. (float; default: 30.0) [default=30.0].


The number of pixels of the overscan adjacent to the data section of the CCD that are ignored when computing statistics or fits. (int; default: 3) [default=3].


Type of lampwise image combination to use. (str; default: ‘sigclip’) [default=”sigclip”].


Identify and measure the arc emission lines on images separately for each lamp setup. (bool; default: True) [default=True].


Sigma level used to detect arc emission lines above the median background level in the S/N image of the central column of each slice (float; default: 1.0) [default=1.0].


The allowed range of resolutions for pattern matching (of detected arc lines to line list) in fractions relative to the expected value (float; default: 0.05) [default=0.05].


Tolerance for pattern matching (of detected arc lines to line list) (float; default: 0.1) [default=0.1].


Order of the polynomial for the horizontal curvature within each slice (int; default: 2) [default=2].


Order of the polynomial used to fit the dispersion relation (int; default: 6) [default=6].


Sigma level for iterative rejection of deviant fits for each arc line within each slice, a negative value means to use the default (2.5). (float; default: -1.0) [default=-1.0].


Create a table containing residuals of the fits to the data of all arc lines. This is useful to assess the quality of the wavelength solution in detail. (bool; default: False) [default=False].


Sigma level for iterative rejection of deviant datapoints during the final polynomial wavelength solution within each slice, a negative value means to use the default (3.0). (float; default: -1.0) [default=-1.0].


Type of weighting to use in the final polynomial wavelength solution fit, using centroiding error estimate and/or scatter of each single line as estimates of its accuracy. (str; default: ‘cerrscatter’) [default=”cerrscatter”].


Save (bool; default: False) [default=False].


Resample the input arc images onto 2D images for a visual check using tracing and wavelength calibration solutions. Note that the image produced will show small wiggles even when the calibration was successful! (bool; default: False) [default=False].


Create a wavelength map of the input images (bool; default: False) [default=False].


Merge output products from different IFUs into a common file. (bool; default: False) [default=False].

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

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

muse_wavecal.param.nifu = 0
muse_wavecal.param.overscan = "vpoly"
muse_wavecal.param.ovscreject = "dcr"
muse_wavecal.param.ovscsigma = 30.0
muse_wavecal.param.ovscignore = 3
muse_wavecal.param.combine = "sigclip"
muse_wavecal.param.lampwise = True
muse_wavecal.param.sigma = 1.0
muse_wavecal.param.dres = 0.05
muse_wavecal.param.tolerance = 0.1
muse_wavecal.param.xorder = 2
muse_wavecal.param.yorder = 6
muse_wavecal.param.linesigma = -1.0
muse_wavecal.param.residuals = False
muse_wavecal.param.fitsigma = -1.0
muse_wavecal.param.fitweighting = "cerrscatter"
muse_wavecal.param.saveimages = False
muse_wavecal.param.resample = False
muse_wavecal.param.wavemap = False
muse_wavecal.param.merge = False

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

import cpl
muse_wavecal = cpl.Recipe("muse_wavecal")
res = muse_wavecal( ..., param = {"nifu":0, "overscan":"vpoly"})

See also

cpl.Recipe for more information about the recipe object.

Bug reports

Please report any problems to Peter Weilbacher. Alternatively, you may send a report to the ESO User Support Department.