4.4 Important procedures and functions of the pipeline
4.4.10 REDUCE procedure hamspec.pro
The procedure hamspec.pro is used for the extraction of the spectrum. In Fig. 4.9, the extracted spectrum of the relative order 6 out the flat field (blaze) is shows. The syntax and a description of its parameters are given in Table 4.12. For the spectrum extraction, the procedurehamspec.pro opens the procedure getspec.pro (Sect. 4.4.10.1). To extract a spectrum, the extraction methods non-optimal and optimal extraction are available.
The non-optimal extraction is used if the keyword’’THAR’’is set at the procedure ham-spec.pro. The procedure getspec.pro opens the procedure getarc.pro, (Sect. 4.4.10.2) for the non-optimal extraction method.
The optimal extraction is the more accurate method to extract the spectrum in compari-son to the non-optimal extraction. The concept of the optimal extraction was introduced by Horne (1986). At the optimal extraction, the spatial profile of the order is used to find outliers in the spectrum. The REDUCE package uses a form of optimal extraction which was developed by Piskunov (Piskunov and Valenti 2002). The difference between the methods of Horne and Piskunov is the way to determine the spatial profile. Horne uses a polynomial fit to determine the spatial profile for each wavelength (Horne 1986).
The method by Piskunov uses the spatial profile for each wavelength, which is determined with an empirical mean spatial profile, see Sect. 4.4.10.4. In the optimal extraction, the procedure getspec.pro opens the procedure mkslitf.pro (Sect. 4.4.10.3). This procedure opens the procedureslit func.pro (Sect. 4.4.10.4).
In the following sections, descriptions of these procedures are given.
4.4.10.1 REDUCE procedure getspec.pro
With this procedure, the method of extraction is selected and the corresponding procedure is opened. The procedure extracts the single order from the image and passes it to the sub-procedure.
The spectra of the single order is returned to the procedure hamspec.pro.
4.4.10.2 REDUCE procedure getarc.pro
The proceduregetarc.proadds the pixel values inside the extraction width for each column and the result is the spectrum. This method is not so accurate because one obtains outliers in the spectrum.
4.4.10.3 REDUCE procedure mkslit.pro
The order is split into several parts. These parts are called swath width. The number of columns is given in the parameter ’’SWATH WIDTH’’. In the swath width, the PSF is assumed to be constant. The single parts are passed to the sub-procedure slit func.pro (Sect. 4.4.10.4) and here, the extraction is performed. After the extraction, the separate
4.4 Important procedures and functions of the pipeline 53
hamspec , im, head, orc, dxwd, dsxwd, obase, spec
, ThAr=thar, LONG=long, SIG=sunc, COLRANGE=colrange , SF SMOOTH=sf smooth, SP SMOOTH=sp smooth
, OSAMPLE=osample, SWATH WIDTH=swath width , PLOT=iplot, MASK=mask, ORDER RANGE=order range , TELLURIC=telluric, FILENAME=filename
, BLAZE CONT=blaze cont, SLIT TILT FILE=slit tilt file
Parameter Description Optional Default
im the image
head the header of the image
orc the location of the order as coefficients of a polynomial fit
dxwd the extraction width
dsxwd error of dxwd, but it is unused obase order base, it is unused
spec the output spectra
ThAr keyword for the ThAr spectra yes optimal
no optimal extraction extraction
LONG keyword for long slit spectra yes
SIG noise of the spectra yes
COLRANGE the first and last column for each order yes
SF SMOOTH smoothing across dispersion yes 1.
SP SMOOTH smoothing in dispersion direction yes 0.
OSAMPLE the step size of the slit function yes 14.
to reconstruct a sub-pixel grid
SWATH WIDTH the number of columns where yes a constant PSF is assumed
PLOT keyword to plot yes
MASK to use the mask file yes
ORDER RANGE the range of orders yes all
to extract
TELLURIC offset to order centre yes
FILENAME print, the name in the plot yes
BLAZE CONT keyword to fix the blaze if yes
discontinuities appear for high-curvature orders.
SLIT TILT FILE keyword to use a 2D yes
slit function
Table 4.12: The syntax, the input and output parameters of the hamspec.pro
parts of the order are merged to a total spectrum of the order and returned to the get-spec.pro.
The Fig. 4.21 shows a control plot of the spectrum extraction, which is produced, if the keyword ’’PLOT’’ is set in the procedure hamspec.pro. The upper plots in Fig. 4.21 represent the slit function (dotted line, in the original plot solid line) and the data points
Figure 4.21: Control plot of the extraction produced by the procedure mkslit.pro, in the upper plots the slit function and in the lower plots the residuals between the data and the spectrum multiplied with the slit function
(asterisk, in the original plot dots), which were used for creating the slit function. The title shows the order and the column of the extraction. The lower plots show the residuals be-tween the data and the spectrum multiplied with the slit function. The line represents the 1σ error plus the noise and the scatter. The x-axes in the plots are the extraction width.
In the middle between the upper and lower plot is the file name of the corresponding image.
4.4.10.4 REDUCE procedure slit func.pro
This procedure performs the extraction and also labels bad pixels. The extraction is conducted in two steps.
In the first step, the total sum of each row in an order is determined and these values are smoothed with a median fit. Afterwards, this array is divided by the sum of all pixel values. This is called spatial profile or slit function, the profile across the order. The pixel values are weighted with the slit function and these values are added for each column.
Then, this spectrum is smoothed. Now outliers are found and defined. A deviation (dev) are determine with the equation:
dev = sP
(mask (imm−immreconstruct)2)
Pmask (4.6)
4.4 Important procedures and functions of the pipeline 55
The imm is the original image part and immreconstruct is the corresponding reconstructed part. The reconstruction is performed with the spectrum multiplied by the slit function.
The mask is corresponding part of mask file. The deviation is multiplied by three and compared with the difference between the pixel value and the spectrum values multiplied with the slit function. If the difference is greater than this threshold, then the correspond-ing pixels are marked.
In the second step, the slit function is re-determined. The supporting points of the slit function are oversampled so that one gets a new smoothed slit function with more sup-porting points. For this, the Tikhonov1 regularisation is used.
The Tikhonov regularisation is a linear regularisation method which measures the differ-ence between the adjacent pixels (Press et al. 1992; Wolter 2004). The vector notation is (Press et al. 1992):
(ATA+λH)~u=AT~b (4.7)
where A represents a n×m data matrix, ~u a set of parameters and ~b is a vector of observational data. These are the same elements used for the minimisation with the least square method. The matrix H (4.8) is a m×m matrix and it is the first order of the Tikhonov regularisation function (Press et al. 1992; Wolter 2004).
H=
1 −1 0 0 0 0 · · · 0
−1 2 −1 0 0 0 · · · 0 0 −1 2 −1 0 0 · · · 0
... . .. ...
0 · · · 0 0 −1 2 −1 0 0 · · · 0 0 0 −1 2 −1 0 · · · 0 0 0 0 −1 1
(4.8)
The parameterλis a regularisation parameter. The Eq. (4.7) can be solved (Press et al.
1992):
~u=
1
ATA+λHATA
A−1~b (4.9)
The oversampling factor for the slit function is defined by the parameter’’OSAMPLE’’. The parameters ’’SF SMOOTH’’ and ’’SP SMOOTH’’ define the smoothing in cross dispersion direction and in dispersion direction respectively.
This process stops at one of the following points: at the maximal number of iterations or a cutoff value. The maximum number of iteration is 8 and the cutoff value is 1.0·10−5. This value is calculated:
max|spectrumi−spectrumi−1 |
max spectrumi (4.10)
The index i is the number of the iteration. With the second iteration, outliers are located and the positions of the outliers are fixed in the mask array. This new mask array is used in the next iteration for the identification of bad pixels.
The result is returned to the REDUCE proceduremkslitf.pro.
1A.N.Tikhonov, Russian mathematician 1906-1993
spec merging cont norm , wave, spec, blaze, head, wavem, specm
, specm norm, PLOT=iplot, DEBUG=debug, ERR=err
Parameter Description Optional Default
wave the wavelength
spec the blaze normalised spectrum
blaze the blaze array
head the image header
wavem the merged wavelength array specm the merged blaze normalised
spectrum
specm norm the normalised merged spectrum
PLOT to get a informational plots yes
DEBUG print information to debug yes
ERR output of a error message yes
Table 4.13: The syntax, the input and output parameters of the procedure spec merging cont norm.pro