The flames_cal_orderpos recipe

flames_cal_orderpos

Synopsis

Defines uves-echelle-simultaneous calibration fibre order positions

Description

The recipe defines the simultaneus calibration fibre order positions in a fibre-echelle image. The orders are initially detected by means of a Hough transformation, the orders are then traced, and the positions are finally fitted with a global polynomial.

Expected input frames are simultaneous calibration fibre flat fields, FIB_ORDEF_RED and optionally for each chip a DRS setup table, DRS_TABLE_(REDL|REDU), for backward compatibility, and optionally a guess order table

FIB_ORD_GUE_(REDL|REDU) and a master bias, MASTER_BIAS_(REDL|REDU).

The recipe processes only the first raw frame found.

Output are two order tables FIB_ORD_TAB_(REDL|REDU) contaning the columns:

X                : Position along x
Order            : Relative order number
Y                : Order line centroid location
Yfit             : The fitted order location
dY               : Uncertainty of Y
dYfit_Square     : Variance of Yfit
Residual         : Y - Yfit
Residual_Square  : Residual^2
OrderRMS         : Root mean squared residual of initial
                   one-dimensional linear fit of order

The bivariate fit polynomial itself is stored in table extension no. 2. The 3rd table extension contains a table that defines the active fibre traces and their positions (for support of FLAMES/UVES) and 2 images frames FIB_ORDEF_(REDL|REDU)

Constructor

cpl.Recipe("flames_cal_orderpos")

Create an object for the recipe flames_cal_orderpos.

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

Parameters

flames_cal_orderpos.param.backsubdegx

Degree (in x) of polynomial used to estimate the background (mode=poly). (int; default: 2) [default=2].

flames_cal_orderpos.param.backsubdegy

Degree (in y) of polynomial used to estimate the background (mode=poly). (int; default: 2) [default=2].

flames_cal_orderpos.param.backsubgrid

Number of grid points (in x- and y-direction) used to estimate the background (mode=poly). (int; default: 50) [default=50].

flames_cal_orderpos.param.backsubkappa

The value of kappa in the one-sided kappa-sigma clipping used to estimate the background (mode=poly). (float; default: 4.0) [default=4.0].

flames_cal_orderpos.param.backsubradiusy

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].

flames_cal_orderpos.param.debug

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

flames_cal_orderpos.param.defpol1

The degree of the bivarite fit (cross dispersion direction). If negative, the degree is optimized to give the best fit (int; default: -1) [default=-1].

flames_cal_orderpos.param.defpol2

The degree of the bivarite fit (order number). If negative, the degree is optimized to give the best fit (int; default: -1) [default=-1].

flames_cal_orderpos.param.kappa

Used for kappa-sigma clipping of the final polynomial fit. If negative, no clipping is done (float; default: 4.0) [default=4.0].

flames_cal_orderpos.param.maxgap

If the order line drops below detection threshold, the order tracing algorithm will try to jump a gap of maximum size ‘maxgap’ multiplied by the image width (float; default: 0.2) [default=0.2].

flames_cal_orderpos.param.maxrms

When fitting the orders with straight lines, this is the maximum allowed RMS relative to the median RMS of all orders (float; default: 100.0) [default=100.0].

flames_cal_orderpos.param.maxslope

Maximum possible line slope (float; default: 0.2) [default=0.2].

flames_cal_orderpos.param.minslope

Minimum possible line slope. This should be the ‘physical’ slope on the chip, i.e. not taking binning factors into account, which is handled by the recipe (float; default: 0.0) [default=0.0].

flames_cal_orderpos.param.minthresh

The minimum threshold value is (min + minthres*(max - min)). Here ‘min’ and ‘max’ are the lowest and highest pixel values in the central bin of the order (float; default: 0.2) [default=0.2].

flames_cal_orderpos.param.mmethod

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

flames_cal_orderpos.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”].

flames_cal_orderpos.param.process_chip

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

flames_cal_orderpos.param.pthres

In automatic mode, or if the number of orders to detect is read from a guess table, the detection of new lines stops when the intensity of a candidate line drops to less than ‘pthres’ times the intensity of the previous detection. (float; default: 0.2) [default=0.2].

flames_cal_orderpos.param.radx

Half X size of median filtering window (int; default: 2) [default=2].

flames_cal_orderpos.param.rady

Half Y size of median filtering window (int; default: 1) [default=1].

flames_cal_orderpos.param.samplewidth

Separation of sample traces (used by Hough transform) in input image (int; default: 50) [default=50].

flames_cal_orderpos.param.sloperes

Resolution (width in pixels) of Hough space (int; default: 120) [default=120].

flames_cal_orderpos.param.tracestep

The step size used when tracing the orders (int; default: 10) [default=10].

flames_cal_orderpos.param.use_guess_tab

If a Guess order table is provided this parameter set how it is used:0: No usage, 1: use it to set lower/upper Y raws where order are searched 2: the order table try to fully match the guess (int; default: 1) [default=1].

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

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

flames_cal_orderpos.param.backsubdegx = 2
flames_cal_orderpos.param.backsubdegy = 2
flames_cal_orderpos.param.backsubgrid = 50
flames_cal_orderpos.param.backsubkappa = 4.0
flames_cal_orderpos.param.backsubradiusy = 2
flames_cal_orderpos.param.debug = False
flames_cal_orderpos.param.defpol1 = -1
flames_cal_orderpos.param.defpol2 = -1
flames_cal_orderpos.param.kappa = 4.0
flames_cal_orderpos.param.maxgap = 0.2
flames_cal_orderpos.param.maxrms = 100.0
flames_cal_orderpos.param.maxslope = 0.2
flames_cal_orderpos.param.minslope = 0.0
flames_cal_orderpos.param.minthresh = 0.2
flames_cal_orderpos.param.mmethod = "median"
flames_cal_orderpos.param.plotter = "no"
flames_cal_orderpos.param.process_chip = "both"
flames_cal_orderpos.param.pthres = 0.2
flames_cal_orderpos.param.radx = 2
flames_cal_orderpos.param.rady = 1
flames_cal_orderpos.param.samplewidth = 50
flames_cal_orderpos.param.sloperes = 120
flames_cal_orderpos.param.tracestep = 10
flames_cal_orderpos.param.use_guess_tab = 1

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

import cpl
flames_cal_orderpos = cpl.Recipe("flames_cal_orderpos")
[...]
res = flames_cal_orderpos( ..., param = {"backsubdegx":2, "backsubdegy":2})

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.