- Form:EXTRACT spec image SP=s1,s2 BK=b1,b2 BK=b3,b4 [SKY=s]
[VAR=v] [SUB]
-
- [SORDER=sord] [PORDER=pord][RONOISE=r]
[EPERDN=eperdn]
-
- spec
- is the buffer to contain the resulting spectrum,
- image
- is the image from which the spectrum is created,
- SP=s1,s2
- specifies the range of spectrum rows,
- BK=b1,b2
- specifies the background rows (several background
regions may be specified),
- SKY=s
- places the sky spectrum (at the position of the
middle of the spectrum) into buffer s,
- VAR=v
- places the estimated variance of the extracted
spectrum into buffer v,
- SUB
- subtracts the fitted sky from the original image,
- SORDER=sord
- specifies the order of polynomial to be fit to the
sky columns (default=2, parabolic fit),
- PORDER=pord
- specifies the order of polynomial to be fit to the
PSF profile (default=2, parabolic),
- RONOISE=r
- changes the value used for the read-out noise of the
detector in electrons (default=7),
- EPERDN=eperdn
- changes the inverse gain (in electrons per DN)
used for the detector (default=2.5 electrons/DN).
EXTRACT is an "optimal extraction" routine for extracting the spectra of
1-dimensional sources (point-sources) from 2-D spectral images. It is
based on the algorithm described by Keith Horne (``An Optimal Extraction
Algorithm for CCD Spectroscopy'', 1986, PASP, 98, 609). In brief, each
pixel in the spectral extraction is weighted according to the fraction of
the flux which is expected in that pixel assuming a uniform spatial
profile. The weighting scheme is optimized to retrieve the maximum
signal-to-noise without biasing the resulting fluxes.
EXTRACT operates much like MASH, and should result in better
signal-to-noise in those cases where the noise in the spectrum is dominated
by the background (either from the sky or from the detector read-out
noise).
WARNING: It is inappropriate to use EXTRACT for moderate or bright objects
in which the noise is dominated by the Poisson statistics of the object
itself. In such cases the extraction routine may discard so many points
from the spatial profile fits it does that parts of the spectrum can become
meaningless. It is also inappropriate to use EXTRACT for objects whose
spectra are dominated by bright, unresolved emission lines (as EXTRACT
might reject them as being ``cosmic rays''), and for extended sources. For
bright sources, emission-line objects, and extended sources, use MASH or
SPECTROID as appropriate.
The steps which EXTRACT goes through are as follows:
- 1.
- The detector characteristics are specified. These are the readout
noise in electrons (which can be changed using the keyword RONOISE=
from its default value of 7) and the inverse gain in electrons per DN
(using EPERDN= to change this from the default of 2.5). Usually the
user will not wish to change these values, as the defaults are
appropriate for the T.I. CCDs at Lick.
- 2.
- The background rows are fitted with polynomials of order "pord."
(Use the keyword SORDER= to change this from its default value of 2.)
The expected uncertainties in this fit are then calculated (using the
read-out noise and the gain) and any points more than 4-sigma from the
fit are ignored and the fit recalculated. This fit iteration is
performed until no new points are ignored or until 5 iterations have
been done.
- 3.
- The object profile is then parameterized and fit with a polynomial
of order 2 (unless the PORDER= keyword has been used). Again, the fit
is iterated a maximum of 8 times, using a rejection threshold of
4-sigma.
- 4.
- Using the resulting parameterization the weights are calculated for
each pixel and the spectrum extracted. An automatic point rejection
is performed at this stage to remove bad pixels on the spectrum rows
themselves. A more conservative 5-sigma rejection level is used and
only one point (the one with the largest difference) is removed at
each iteration. A maximum of five iterations is allowed (hence up to
five points may be removed at each wavelength). The resulting
spectrum is placed into the specified buffer.
- 5.
- If the SKY= and/or VAR= keywords have been specified then the
appropriate buffers are loaded with the requested spectra. If the SUB
keyword has been specified then the fitted background rows are
subtracted from the original image.
Note that the uncertainties at all stages are estimated using the assumed
detector characteristics. When the data are of sufficient quality this
means that the uncertainties in the fits will be so small that the
inability of the fit parameterizations (both sky and profile) to accurately
model the data will be detectable. The program will then start rejecting
large numbers of points because the model assumed is not quite appropriate.
In this case the MASH command should be used, as the data are probably of
such high signal-to-noise that the optimal extraction routine will not gain
anything over a simple summation. The interested user is referred to
Keith's article for more details.
Examples:
- EXTRACT 10 1 SP=134,138 BK=120,130 BK=142,152
- extracts a
spectrum from rows 134-138 in image 1 and places the result in
buffer 10. Rows 120-130 and 142-152 are used as the background
rows.
- EXTRACT 14 4 SP=100,104 BK=90,114 SUB SKY=34 VAR=24
SORDER=3
- extracts a spectrum from rows 100-104 of image 4.
Note that in this case the BK= specifications straddle the spectrum
rows (this will be handled correctly, as it is in MASH). The sky is
fit with cubic polynomials (SORDER=3) and is the fit is subtracted
from the image 4. The object spectrum is placed into buffer 14, the
sky spectrum into 34, and the variance of the object spectrum into
buffer 24.