Next: Data-flow for the ESO Imaging Survey (EIS)
Up: Dataflow and Scheduling
Previous: On the Need for Input Data Control in Pipeline Reductions
Table of Contents -- Index -- PS reprint -- PDF reprint

Astronomical Data Analysis Software and Systems VII
ASP Conference Series, Vol. 145, 1998
Editors: R. Albrecht, R. N. Hook and H. A. Bushouse

Pipeline Calibration for STIS

P. E. Hodge, S. J. Hulbert, D. Lindler1, I. Busko, J. C. Hsu, S. Baum, M. McGrath, P. Goudfrooij, R. Shaw, R. Katsanis, S. Keener2 and R. Bohlin
Space Telescope Science Institute, 3700 San Martin Dr, Baltimore, MD, 21218
1Advanced Computer Concepts, Inc. 2University of Illinois, Urbana-Champaign, Urbana, IL 61801



The CALSTIS program for calibration of Space Telescope Imaging Spectrograph data in the OPUS pipeline differs in several significant ways from calibration for earlier HST instruments, such as the use of FITS format, computation of error estimates, and association of related exposures. Several steps are now done in the pipeline that previously had to be done off-line by the user, such as cosmic ray rejection and extraction of 1-D spectra. Although the program is linked with IRAF for image and table I/O, it is written in ANSI C rather than SPP, which should make the code more accessible. FITS extension I/O makes use of the new IRAF FITS kernel for images and the HEASARC FITSIO package for tables.


1. Introduction

The Space Telescope Imaging Spectrograph (STIS) is a complex instrument containing both CCD and MAMA detectors. STIS can observe in both spectroscopic and imaging modes, using either first order or echelle gratings, and taking data in either accumulate or time-tag mode. STIS has many apertures, some filtered, including large apertures for imaging as well as long and short slits for spectroscopy. On-board processing options include binning and restricting the image to a subset of the full detector.

CALSTIS is the program that performs the ``pipeline'' calibration of STIS data, the processing that can be done non-interactively and with table-driven parameters.

See the STIS Instrument Science Reports (ISRs) and HST Data Handbook for further information. These can be reached via the URL

2. Discussion

The previous pipeline calibration tasks read and write so-called GEIS image format, known in IRAF as Space Telescope Format (STF). The new programs, on the other hand, use FITS format. Global keywords are written to the primary header, and the images are written as IMAGE extensions. The primary data unit is null, i.e. is not present. Three IMAGE extensions are used for a STIS image, the science data, corresponding error estimates, and data quality flags; this is called an ``image set,'' or imset. Reference images (e.g. flat fields) use the same format, while reference tables are in FITS BINTABLE extensions. Multiple exposures at the same pointing (e.g. cosmic-ray splits or repeat observations) are stored in the same file, one image set per exposure.

Previous pipeline routines were tasks under the IRAF CL and were written in either SPP or FORTRAN. The new routines are host level programs written in ANSI C, although they are still linked with IRAF for I/O. The I/O interface makes use of HSTIO and CVOS, written by Allen Farris. HSTIO is the higher level interface for images; this can be used to read or write an entire image set in one call. HSTIO is independent of IRAF at the interface level, although the current implementation calls CVOS routines. CVOS is a C-callable interface to the standard IRAF subroutines, in particular for image and table I/O. Image I/O uses the IRAF FITS image kernel written by Nelson Zarate. Table I/O uses the HEASARC FITSIO package written by Bill Pence. For both images and tables, an input or output file with filename extension ``.fits'' will automatically be treated as a FITS file.

There are several major components to CALSTIS: cosmic-ray rejection for CCD data, basic 2-D reduction (bias, dark, flat, etc.), wavecal processing, 2-D spectral rectification, and 1-D spectral extraction. These can be run either combined into a single executable or as several individual executables (eight, actually). The former is the pipeline version, but both options are available off-line. When running the single executable (cs0.e), the calibration switches are read from the input primary header, as with previous calibration pipeline routines. The individual executables, however, take the calibration switches from the command line; the default is to perform all relevant steps.

Although the CALSTIS executables are host level programs, CL scripts have been provided in the STIS package for running CALSTIS from IRAF, for the convenience of IRAF users. calstis is the single executable, the pipeline version; basic2d does basic 2-D reduction; ocrreject is the cosmic-ray rejection task; wavecal does wavecal processing; x2d does 2-D rectification; and x1d does 1-D spectral extraction. These scripts have parameters for input and output file names, for options, and-except for the calstis task itself-for the calibration switches. They construct a command line string beginning with ``!'' (to escape from IRAF to Unix), and they invoke the program using the syntax: print (cmdline) | cl.

3. Further Details

Processing starts with populating the data quality array from a reference table and assigning initial values for the error estimates based on pixel values, gain, and read noise.

For CCD data, the bias level from the overscan will be subtracted and the overscan regions removed. If the file contains multiple exposures, the separate exposures will then be combined to reject cosmic rays. The algorithm is very similar to the one used in the crrej task in the wfpc package. Parameters controlling the cosmic ray rejection are read from a reference table; the row in that table is selected based on exposure time and number of exposures. The individual exposures must have been taken at the same pointing.

The usual bias, dark, and flat field corrections are then applied. MAMA data are corrected for nonlinearity. For CCD data, code is in place for shutter shading and analog-to-digital correction, but these steps are not performed because they do not appear to be required.

For medium or high resolution spectroscopic MAMA data, the reference files need to be convolved to account for Doppler shift, because a correction for spacecraft motion during the exposure is applied on-board. That is, whenever a photon is detected, the on-board software reads the detector coordinates of the event, adjusts the pixel number in the dispersion direction by the amount of the Doppler shift at that moment, then the image buffer is incremented at the adjusted location. During calibration, therefore, the data quality initialization table and the dark and flat field reference images need to be shifted by the same amount before being applied. This amounts to a convolution by the various Doppler shifts throughout the exposure.

For spectroscopic data, a wavecal (line lamp) observation is used for determining the location of the spectrum on the detector. The location is needed for accurate assignment of wavelengths, and for position information in the case of long-slit data. Flat fielding and 2-D rectification are first applied to the wavecal, and cosmic rays (in CCD data) are rejected by looking for outliers in the cross dispersion direction. The offset in the dispersion direction between the expected location of the spectrum and the actual location is found by cross correlating the observed spectrum with a template. In the cross dispersion direction, the offset is found either by finding edges or by cross correlation, depending on the length of the slit. The long slits have two occulting bars, and it is the edges of these bars that are used for finding the location. Edges are found by convolving with [-1, 0, +1]. The location is found to subpixel level by fitting a quadratic to the three pixels nearest the maximum (or minimum, depending on the edge).

2-D rectification is performed for long-slit data; it can can also be done for imaging mode but currently is not. For each pixel in the output rectified image, the corresponding point is found in the input distorted image, and bilinear interpolation is used on the four nearest pixels to determine the value to assign to the output. No correction for flux conservation is applied, as this is accounted for in the flat field. Mapping from an output pixel back into the input image makes use of the dispersion relation and 1-D trace. The dispersion relation gives the pixel number as a function of wavelength and spectral order number. The 1-D trace is the displacement in the cross dispersion direction at each pixel in the dispersion direction. Both of these can vary along the slit, so the dispersion coefficients and the 1-D trace are linearly interpolated for each image line. Corrections are applied to account for image offset, binning, and subarray. For imaging mode, the mapping is a 2-D polynomial (Chebyshev) representing the optical distortion, and the IRAF gsurfit package is used to evaluate the function.

Extraction of 1-D spectra is performed in the pipeline for echelle data, and it can be performed for long-slit data. When running the off-line x1d task, the target location on the slit can be specified. When running the pipeline version, however, the brightest object on the slit is assumed to be the target, and the extraction will be centered on that object. The same corrections for image offset are applied for 1-D extraction that were done in 2-D rectification. The location of the spectrum is then refined by cross correlating the data with the 1-D trace. At each pixel in the dispersion direction, the data are summed over some range of pixels for the on-source region and background regions. The displacement of these extraction regions in the cross dispersion direction is taken from the same 1-D trace used in 2-D rectification. No resampling is done in the dispersion direction; the associated wavelengths are therefore nonlinear, and they are computed using the dispersion relation. The output is written as a FITS BINTABLE extension, with one row per spectral order. For long-slit data, then, there will be just one row, while there can be 50 rows for echelle data.

© Copyright 1998 Astronomical Society of the Pacific, 390 Ashton Avenue, San Francisco, California 94112, USA

Next: Data-flow for the ESO Imaging Survey (EIS)
Up: Dataflow and Scheduling
Previous: On the Need for Input Data Control in Pipeline Reductions
Table of Contents -- Index -- PS reprint -- PDF reprint