In the previous steps nothing has been done to the data; instead, models of the data have been produced. We have:
At this point we are ready to extract the spectrum. The procedure can be very simple, at each sample point along the dispersion direction we sum the signal from all the pixels selected as object; we then subtract a value based upon the pixels in the background channels. The same extraction is applied to both the target and reference star images (if any), as well as to the arc images.
The procedure outlined above is known as a `simple' or `linear' extraction. In many cases such an extraction is adequate; however, this method does not make the most of the data available. A profile curve can be fitted to the spectrum in the spatial direction. At the centre of the profile the signal is greatest; on the outside, the signal falls off to the background level. If we sum these pixels in an unweighted manner we are ignoring the fact that the central pixels have a better signal-to-noise ratio as compared to those at the outside. To overcome this problem we use the so-called `optimal' extraction scheme.
Optimal extraction is suitable for CCD data when we know the readout noise and gain of the CCD camera. The CCD readout noise is needed to calculate pixel weights. The gain is used to convert the data in the input images, which are in the `arbitrary' units from the camera ADC, to units of recorded photons. Once we have the data in these units, we can apply an error-based weighting to the summation of data in each sample along the dispersion direction.
Optimal extraction assumes that a good model for the noise sources in our data is available; this is a fair assumption as the noise sources in a CCD camera system are well understood (well, at least at the sort of level we are interested in anyway). The main noise `sources' are: the camera electronics, the CCD output node, and the shot noise of the electronic charge stored in a pixel (which represents the light signal). There are other sources - see Horne and Marsh for more details of the theory of optimal extraction.
In cases where the CCD parameters are not available, a profile-weighted extraction might be used. This weights the summation of the object pixels based upon their relative brightnesses. This should give a better signal-to-noise ratio than the simple extraction.
Which extraction scheme you select will depend on the nature of - and what you want from - your data. For bright, high signal-to-noise data there is little to be gained by going for an optimal extraction (little may be lost by doing one though...). Optimal-extraction algorithms require that the spatial profile of the object is a smooth function of wavelength. This means that optimal extraction is unlikely to be useful if spatial resolution is required and/or the spatial profile of the object varies rapidly with wavelength, as for objects with spatially-extended emission-line regions. For suitable data, optimal extraction also acts as a cosmic-ray filter: any pixel which deviates strongly from the profile model is likely to be contaminated, and can be rejected.
Simple Spectroscopy Reductions