Space Telescope Science Institute
STIS Data Handbook 6.0 May 2011
help@stsci.edu
Table of Contents Previous Next Index Print


STIS Data Handbook > Chapter 5: STIS Data Analysis > 5.4 Working with Spectral Images

5.4
5.4.1
The calstis pipeline software produces a rectified two-dimensional spectral image when X2DCORR is set to PERFORM (see Section 3.4.25). The image is flux-calibrated (see Section 3.4.13). At each pixel i, this image contains the surface brightness per Angstrom, Bλi, in erg cm-2 sec-1 -1 arcsec-2. The image has a linear wavelength scale and uniform sampling in the spatial direction. Here we review how the image is calculated by the pipeline, and how to convert the data in this image to other quantities.
The flux detected by pixel i in a two-dimensional spectral image is:
in erg cm-2 sec-1, where:
Cλ is the wavelength dependent count rate, which is the ratio of the total counts to the exposure time. The exposure time is given in the EXPTIME header keyword.
g is the detector gain, which is unity for MAMA observations. For the CCD, this is the conversion from counts to electrons, the value for which is given in the header keyword ATODGAIN.
h is Planck’s constant.
c is the speed of light.
Rλ is the wavelength dependent integrated system throughput, given in the PHOTTAB for individual optical elements.
AHST is the area of the unobstructed HST mirror.
λ is the wavelength in Angstroms, which is converted to cm by the factor of 108 in the numerator.
fTDS is the correction for time-dependent sensitivity computed from the TDSTAB.
fT is the correction for temperature-dependent sensitivity.
The flux per Angstrom is:
in erg cm-2 sec-1 -1, where: d is the dispersion in /pixel, derived from the CD1_1 header keyword.
The surface brightness detected by that pixel is:
in erg cm-2 sec-1 arcsec-2, where:
ms is the plate scale in arcsec/pixel in the cross-dispersion direction (i.e., spatial direction). This corresponds to the CD2_2 header keyword value multiplied by 3600 arcsec/degree.
W is the slit width in arcsec.
The surface brightness per Angstrom, Bλi, given in the flux calibrated, rectified, two-dimensional spectral image (_sx2 or _x2d file) is thus:
in erg cm-2 sec-1 -1 arcsec-2. So, starting from the rectified two-dimensional spectral image (_sx2 or _x2d file), Fi, Fλi, and Bi can be computed from Bλi as:
Similarly, fluxes can be summed over regions in the _sx2 and _x2d files and used to compute the flux or surface brightness per Angstrom for the continuum, or flux or surface brightness of a spectral feature (after subtracting off the continuum). For a rectangular region in the spectral image spanning Nλ pixels in the dispersion direction (Nλ is proportional to Angstroms) and Ns pixels in the spatial direction (Nsms arcsec along the slit):
 
where F is in erg cm-2 sec-1, Fλ is in erg cm-2 sec-1 -1, B is in erg cm-2 sec-1 arcsec-2, and Bλ is in erg cm-2 sec-1 -1 arcsec-2.
No slit loss corrections have been made above. This is correct in the limiting case of spatially uniform surface brightness. For a point source, the flux can be corrected for slit loss by using the data header keyword DIFF2PT. This keyword is calculated as:
where W and ms are as above, Tap is the wavelength-averaged point source aperture throughput for the science aperture (which is determined from the reference table specified by the keyword APERTAB), and H is the wavelength-averaged correction for the extraction slit of height H to a slit of infinite height, which is obtained from the reference table specified by the keyword PCTAB. That is, to derive the flux from a point source, integrate the _x2d or _sx2 file over the default extraction slit height (from the PCTAB) and multiply the result by DIFF2PT. The default extraction slit height for first order modes is at present 11 pixels for the MAMAs and 7 pixels for the CCD. If the desired extraction slit height differs from the default, the PCTAB has a set of wavelength-dependent corrections for selected alternative apertures that must also be applied. See ISR STIS 98-01 for further details. Of course, point source observers are better advised to use the x1d task to extract a one-dimensional spectrum from their long slit first order data, which will then apply the wavelength-dependent aperture throughput and extraction height corrections and the GACTAB correction, as well as perform background subtraction. For the narrowest apertures and for some gratings and wavelength settings, the wavelength-dependent corrections can vary substantially across the detector.
In general we note that the cross dispersion profiles can be quite extended (particularly in the far-UV and in the near-IR). Fluxes derived for extended sources from the _x2d files, as above, assume that the sources are extended on scales that contain the bulk of the cross dispersion flux from a point source. Encircled energies for the first order modes can be found in ISR STIS 97-13.
See also Chapter 6 of the STIS Instrument Handbook for a more detailed discussion of units and conversions for different source types.
5.4.2
Two-dimensional spectral images have been wavelength calibrated and rectified to linear wavelength and spatial scales. Tasks such as splot can work directly on the _sx2 and _x2d files and can read the wavelength header information that is stored in the standard FITS CD matrix keywords. Alternatively you can use these keywords directly to determine the wavelength or distance along the slit at any pixel as:
λ(x) = CRVAL1 + (x - CRPIX1) CD1_1
s(y) = (y - CRPIX2) CD2_2
where λ(x) is the wavelength at any given x pixel, and s(y) is the distance along the slit from slit center for any given y pixel, in units of degrees.
5.4.3
Systematic errors are introduced into the rectification of spectral images by the use of inaccurate spectral traces and by interpolation of undersampled data. CTE errors in CCD _flt or _crj images are also propagated into the rectified image; i.e., in columns (wavelength regions) with low flux levels in the target and background, the observed flux of the target will be diminished and the target will appear to be centered slightly further away from the readout amplifier, the more so for targets more distant from the readout amplifier. For the case of a point source on a spatially uniform background, one can obtain a CTE-corrected extracted spectrum (Section 3.4.6). No CTE correction is made in the much more general (and much less tractable) case of rectifying and flux-calibrating a spectral image. However, CTE effects should generally be small for targets placed at the E1 pseudo-aperture positions, implemented in July 2000.
To improve rectification, one must first ensure that accurate traces are applied to the input image. The orientation of spectral traces on the STIS detectors has been found to rotate slowly over time for the L and M modes. The rotation rate is most consequential for the later observations made with the CCD. For exposures taken just before the suspension of operations in August 2004, the Y-range of the CCD traces differed from that of the reference file traces by about half a pixel. This is sufficient to introduce tilts and curvatures into row-by-row spectra taken from the rectified image, and to cause a discrepancy in the physical centers of rotation curves measured from widely separated spectral lines. New trace files were delivered with time-dependent orientations for the most commonly used first order modes, and the PyRAF task mktrace was developed to produce an improved trace reference file for any L or M mode image, as discussed in Section 3.5.7. If needed, new trace reference files should thus be retrieved from the archive or generated with mktrace.
The greatest problem in the rectification of STIS spectral images, especially CCD images, is that the point spread function (PSF) is undersampled along the slit. The bi-linear interpolation employed by calstis, and by its constituent script x2d, produces artifacts in the rows of spectra in the rectified image when a point source is present. For gratings with spectral traces that drop by several rows as they cross the detector, the artifacts take the form of periodic scallops in the flux which change phase from one row to the next. For gratings with a trace that is confined to a height of less than one pixel, the flux in each row is modulated by a broad irregular shape. See Figure 11.9 in Section 11.3.5 of the STIS Instrument Handbook.
Interpolation artifacts can be reduced in rows near the center of a point source by using the wavelet method of interpolation described by Barrett and Dressel (2006, The HST Calibration Workshop, 260). This method uses average interpolation (instead of point interpolation) and iterative refinement. The pixels in each column are repeatedly subdivided into pairs of subpixels, and the flux is distributed among the subpixels using polynomial fits to the flux profile. The subpixels are then reassembled into pixels centered on the trace, thus producing an image that has been rectified in the spatial dimension. (Quantization effects are removed by taking the appropriate fractions of subpixels at the edges of the new pixel boundaries.)
Wavelet interpolation has been implemented in the PyRAF task wx2d. The task takes an _flt, _sfl, or _crj image as input and produces an array that has been rectified in the spatial direction and, optionally, a corresponding array of wavelengths. (As for input to x2d, the input image should already have SHIFTA1 and SHIFTA2 populated by the task wavecal.) The user can select the order of the polynomial used to fit the flux profile, the number of subpixels to create, and the range of rows in the image to be processed. Convolution with a model PSF can be performed; this reduces the magnitude of the artifacts at the expense of resolution along the slit. The task optionally outputs the subpixeled image, with and/or without convolution. The interpolated image can be processed by x2d to linearize wavelengths and provide flux calibration. X2d automatically turns off interpolation along columns for a wx2d image, signified by WX2DCORR=’COMPLETE’.
5.4.4
A set of undithered flat-fielded spectral images can easily be combined in the usual ways (outlined below) if the images are well aligned. This will be the case if the optical path has not changed appreciably and if the target has not drifted due to errors in tracking or reacquisition. The optical path is generally very stable once the grating has been positioned, and a series of science exposures is usually taken without repositioning the grating. Nearly all spectral images have associated wavecals, which were taken with the same grating positioning. To determine shifts in the optical path, calstis or its constituent task wavecal measures the positioning of the wavecal image(s) on the detector and computes the values SHIFTA1 and SHIFTA2 (shifts from the nominal x, y positioning) as described in Section 3.4.23. You can use hselect to check if the changes in SHIFTA1 and SHIFTA2 are small for the series of _flt images that you want to combine.
To check for target drift, you should first check whether the exposures were made in single guide star mode, as discussed in Section 5.2.5. If so, the roll angle of the telescope will be less well controlled, and drift may be significant for long exposures or exposures with large time separations. Even if two guide stars are used, target drift can build up over many orbits to a significant fraction of the aperture width unless a new ACQ/PEAK was performed. To check for drift, you can use any method that compares the wavelength scale or position along the slit. For example, for MAMA exposures that include a point source, you can use tread to check the values of A2CENTER (Section 3.4.23) in the _x1d table extensions to look for drift along the slit in excess of the optical path shift measured by SHIFTA2. For CCD images, you can check whether ocrreject systematically rejected long strings of pixels along a row in a _flt image because a shift along the slit caused a mismatch in flux (Section 3.5.4). If there is a mismatch, you will need to measure the shift along the slit with a method that gives robust results for images that are undersampled in the spatial direction and that have not been cleaned of cosmic rays. e.g., you can run the PyRAF routine mktrace on the _flt images to look for differences in the reported central row. For either detector, you can use a spectral modelling routine (e.g., specfit, Section 5.1.3) to look for differences in the central wavelengths of spectral features in individual _x1d images or rows of _x2d images. A shift in wavelength can be converted to a shift in pixels using the dispersion relation.
If you find measurable misalignments of the individual exposures that you want to combine, you will need to decide how much misalignment is acceptable in your final data products. If the resulting degradation in spatial and spectral resolution is insignificant, you can combine the _flt images in the usual ways:
1.
Use calstis for associated images if the default parameters are acceptable.
2.
Use msarith or mstools for MAMA images.
3.
Use ocrreject for CCD images, relaxing the rejection parameters to accommodate the misalignment (Section 3.5.4).
If the misalignment of the _flt exposures is unacceptable, you can combine individual _x2d images instead. If the misalignment is due primarily to shifts in the optical path, you can simply average the default _x2d images, since those images have all been shifted to the nominal position. For example, generate an individual _x2d file for each CCD _flt imset, or split a MAMA _x2d file into imsets with mssplit. Run mscombine on the set of individual _x2d images, choosing parameters as needed, e.g., to reject cosmic rays. (See the help file for a full description of the parameters.) If there is substantial target drift, you will need to use hedit to adjust SHIFTA1 and SHIFTA2 in the _flt data extension headers (Section 2.3.1) to include the increments due to the drift. If the target has drifted too close to the edge of the slit in an exposure, the flux will not be properly corrected for slit losses, and you may choose to reject that exposure.
5.4.5
Dithering by a few pixels along Y (the spatial dimension in a spectroscopic image) is recommended to allow the removal of hot pixels when CCD images are combined.  Obtain at least three CR-SPLIT images at each dither position.  Run them through the first steps of the pipeline (basic2d and ocrreject; see Table 3.1) to produce one _crj image for each position.  These files are bias- and dark-subtracted and flat-fielded.  Use the IRAF tasks image.imcombine or ccdred.combine to shift, combine, and reject hot pixels from the _crj images.  The combined _crj image can then be reduced in the usual way by applying calstis or its components.  If the _crj images cannot be adequately aligned through simple shifts, their _x2d images may be combined as described in Section 5.4.4.
5.4.6
The x2d task can be used on echelle spectra. In this case, x2d will generate a single output fits file with a 2-D image set (imset) for each spectral order in the input _flt file. The entire input image cannot be 2-D rectified at once because the dispersion relation is different for each spectral order, so each order is corrected and written separately. The x2d task is not normally run by the STScI pipeline on echelle data, so the user does not get an _x2d file as a normal product in the data set. However, this task can be run by the user.
Several problems may arise in the 2-D rectification of long-slit echelle spectra with the x2d task. One problem is that, e.g., the 6X0.2 slit is so long that it overlaps several spectral orders, while the height of the output images is small enough that they cover only one spectral order per image. If the feature the user is interested in is, say, at 50 pixels from the center in the cross-dispersion direction, but the output _x2d images are only 71 pixels high, the features will miss the image (though they might appear in an image for a different spectral order). A work around for this problem is to edit the SDCTAB and change the values in the NPIX2 and CRPIX2 columns for the OPT_ELEM and CENWAVE that were used for the observation. More than one row may need to be changed, depending on which spectral orders (SPORDER) contain data for which a full slit width should be corrected. Set NPIX2 to a large enough value to cover as much of the slit as you need, and set CRPIX2 to (NPIX2 + 1) / 2 to center the spectrum.
For the 2-D rectification of long-slit echelle spectra there are two possible sources of tilt error. The first one is the "physical" tilt and is due to the fact that the slit is rotated by a small angle from its nominal orientation. The slits are mounted in the aperture wheel, and the nominal orientation is that the slit be perpendicular to the line from the center of the slit to the center of the aperture wheel. This physical tilt from the nominal orientation is stored in the ANGLE column in the aperture description table (APDESTAB) for the aperture in use. It is a fraction of a degree for most apertures. In addition to the physical tilt, there is an optical distortion, i.e. the slit image on the detector is curved and tilted. For first order data this "slit to detector" tilt appears to be quite small, but for echelle data it is much larger than the physical tilt and can be several degrees. It depends strongly on the particular echelle grating in use and varies across the detector. While this has not been thoroughly investigated, it looks as if the tilt of the slit images changes systematically across the image in the sense that the slit images have a center of rotation well off the detector, i.e., lines drawn from the rotation point to the center of the slit images are perpendicular to the slit images, and the slit images are quasi-circular arcs. If this model is correct, it should be possible to measure the tilts of the bright emission lines in calibration data and predict the behavior of the tilt as a function of the position on the detector. However, not enough calibration data are available in the archive to do this for all locations on all gratings.
Running x2d with default parameters takes into account only the physical tilt, not the optical distortion, for echelle data. For first order spectral data, the optical distortion is corrected for by the dispersion relation, which varies with the Y coordinate in the image. In the case of echelle data, the dispersion relation used in calstis and its components depends on spectral order but not on Y coordinate for a given order. Consequently, the spectral lines in the 2-D echelle output image will still be tilted with an angle that varies across the detector. One can use the following procedure to correct for the "slit to detector" tilt as well as the physical tilt of the slit in a long-slit echelle _x2d image. First, measure the tilt of strong lines in the wavecal in the neighborhood of the emission lines of interest in the science data (i.e., same spectral order and wavelength region). Enter the value of this tilt, expressed in degrees measured clockwise from the Y axis, into the parameter angle in the wavecal task parameter list and into the column ANGLE in the APDESTAB table in the row for that aperture. Run wavecal and then run x2d. Since a single value of the tilt is not representative of the entire image, regions with different tilts should be calibrated separately.

Table of Contents Previous Next Index Print