3.2 Structure of calstis

Calstis consists of a series of individual modules that:

  • Orchestrate the flow through the pipeline.
  • Perform the preliminary tasks of basic two-dimensional image reduction (e.g., overscan subtraction, bias subtraction).
  • Reject cosmic rays from CCD data.
  • Perform the remaining tasks of basic two-dimensional image reduction (e.g., dark subtraction, flat fielding).
  • Process the contemporaneously obtained wavecal data to obtain the zero point shifts in the spectral and spatial directions.
  • Perform spectroscopic wavelength and flux calibration.
  • Sum any REPEATOBS exposures.

Table 3.1 describes in more detail the individual modules in calstis and what they do. The stistools task that can be used to run a particular segment of the pipeline independently is also provided (see Section 3.5.2).

Table 3.1

stistools taskDescription of Processing ModulesModule1

Full Pipeline

calstis

“Wrapper” program calls each of the calstis tasks as needed, according to the switches set in the primary header of the input file. The calstis constituent tasks can instead be executed independently when recalibrating.

calstis0

Initial 2-D Image Reduction

basic2d

Fundamental steps of 2-D image reduction. This module is called to initialize the data quality array from the bad pixel table, to trim the overscan regions and subtract the bias level, and to subtract the bias image (before cosmic ray rejection for CCD data), then to subtract the dark image and perform flat fielding (after cosmic ray rejection). It assigns values to the error arrays and computes some simple statistics.

calstis1

ocrreject

Detect and remove cosmic rays in CCD data. This module identifies cosmic rays (by optionally flagging them in the input file) for multiple images taken at the same pointing. The input images are then co-added, resulting in an image with cosmic rays removed.

calstis2

Contemporaneous Wavecal Processing

wavecal

Determine MSM offset from wavecal. This step is used in conjunction with calstis7, calstis11, and calstis12. Its purpose is to find the offset of the spectrum from the expected location, owing to nonrepeatability of the mode select mechanism. The shift is written into the SCI extension header of the input wavecal image.

calstis4
 

Subtract science image from wavecal. For CCD wavecal observations taken with the HITM system prior to 1998-Nov-9, the detector is exposed to both the wavecal and the science target (after this date, the external shutter would be closed). This task reads both the wavecal and science files and subtracts the science data from the wavecal. Following this step, calstis4 can be used to determine the spectral shift.

calstis11

Write spectral shift value to science header. A series of science images (i.e., CR-SPLIT or REPEATOBS) and wavecals may have been taken, with the wavecals interspersed in time among the science images. For each image in the science file, this task linearly interpolates the wavecals to the time of the science image, and then writes the keyword values SHIFTA1, SHIFTA2 for the spectral and spatial shifts, respectively, to the science header.

calstis12

Spectroscopic Calibration, Extraction, and Rectification

x1d

1-D spectral extraction. This task is most appropriate for observations of a point source. A spectrum is extracted along a narrow band, summed over the cross-dispersion direction and background values subtracted to produce a 1-D array of fluxes for each spectral order. An array of wavelengths is generated, with each output spectrum written to a separate row of a FITS binary table, together with the arrays of the gross, net, and background count rates. One output table is generated for each image in a series of REPEATOBS data. For echelle observations, x1d and the echelle scattered light correction routine are called iteratively, to calculate the echelle background.

calstis6

x2d

2-D rectification. This task performs geometric correction for direct imaging or long slit spectroscopic data. For the latter, it produces a spectral image that is linear in both wavelength and spatial directions.

calstis7

Sum Images


 

Sum REPEATOBS data. This task adds together (pixel by pixel) multiple MAMA images, and combines them into one FITS file. This would not normally be used for CCD data because they would already have been combined for cosmic ray rejection.

calstis8

1 Referenced in the trailer file.

Below, we present a series of flow charts that provide a more complete overview of the processing of data through the calstis pipeline, starting with the fundamental steps of two-dimensional image reduction. Figure 3.1 shows the initial steps in the routes taken by CCD data and by MAMA data.

Figure 3.1: Initial 2-D Image Reduction (First Step in Subsequent Flowcharts)



The calibration beyond the initial 2-D image processing depends upon whether the data are obtained in imaging or spectroscopic mode. For imaging modes, for example, (Figure 3.2), the primary operations in calstis are geometric distortion correction and photometric calibration, and a summation of multiple MAMA exposures if NRPTEXP > 1. The output is a geometrically rectified image with suffix _x2d or _sx2, and header keywords that specify the photometric calibration. When geometric correction is not applied, the output will be flat-fielded data with suffix _crj, _flt, or _sfl.

 

Figure 3.2: Schematic of calstis for Secondary Image Processing



For spectroscopic exposures, calstis will process the associated wavelength calibration exposure (wavecal; Figure 3.3) to determine the zero point offsets (SHIFTA1, SHIFTA2) in the dispersion and cross-dispersion directions, thereby correcting for the lack of repeatability of the mode select mechanism (MSM) or for thermal drift. These keywords are written into the science header of the flat-fielded (MAMA or single exposure CCD) or cosmic ray rejected (CCD) image.


Figure 3.3: Schematic of calstis for Contemporaneous Wavecals



Two-dimensional spectral processing (Figure 3.4) produces a flux calibrated, rectified spectroscopic image with distance along the slit running linearly along the y-axis and dispersion running linearly along the x-axis.

One-dimensional spectral extraction produces a one-dimensional spectrum of flux versus wavelength (in the _x1d or _sx1 file), uninterpolated in wavelength space, but integrated across an extraction aperture in the spatial direction.Figure

 3.4: Schematic ofcalstisfor Spectroscopic Data