Space Telescope Science Institute
STIS Data Handbook 2011
Table of Contents Previous Next Index Print

STIS Data Handbook > Chapter 5: STIS Data Analysis > 5.1 Data Reduction and Analysis Applications

Data Reduction and Analysis Applications
Most of the software tools for operating on STIS FITS files are contained in three STSDAS packages:
hst_calib.stis: Contains STIS specific tasks to calibrate and interpret data, including calstis and its components (basic2d, ocrreject, wavecal, x1d, x2d). Many of these tasks are described in Chapter 3. A complete listing is presented in Section 5.1.1.
toolbox.imgtools.mstools: Contains image manipulation tasks created especially for STIS and NICMOS image set (imset) data. These tasks exploit the error and data quality arrays in their operations (e.g., msarith, mscombine, msstatistics, mssplit, and msjoin). They are fully described in Section 3.4.3 of the Introduction to the HST Data Handbooks. We will not discuss them here.
toolbox.ttools: Contains tasks to read and operate on FITS tables, which is the format used for STIS spectral extractions, TIME-TAG data, and most STIS reference files. These tasks and their syntax are described in Section 2.2.2 of the Introduction to the HST Data Handbooks. We give specific examples of their use here in Section 5.1.2.
In addition to the above packages, most basic image manipulation software (e.g., display, daophot, imexamine, contour) and spectral analysis software (e.g., splot, tables, specfit, igi) available in PyRAF/IRAF/STSDAS can be used on STIS data, either directly through the PyRAF or IRAF FITS interface or by converting data to another format. Chapter 3 of the Introduction to the HST Data Handbooks includes information about how to display STIS images and extracted spectra, as well as how and when to convert data formats, and a description of spectral analysis tasks. We present a brief summary of spectral display and analysis tasks in Section 5.1.3.
Finally, applications have been developed to process dithered or otherwise unaligned images (MultiDrizzle) and slitless spectral data (MULTISPEC). These are discussed in Section 5.1.4 and Section 5.1.5, respectively.
In Chapter 3, we gave detailed discussions of the use of the data reduction pipeline calstis, the calstis component tasks, and auxiliary tasks that were developed to create customized reference files and to facilitate the combination of unassociated images. All of these tasks are contained in the STSDAS package hst_calib.stis. Other tasks useful for reducing and analyzing STIS data are contained in this package as well. A complete listing and brief description of these tasks is given in Table 5.1. All of these tasks can be run in PyRAF. Most can be run in IRAF, but a few, which are indicated, can be run only in PyRAF. Consult the on-line help for each task for more information. Some of these tasks will be discussed in greater detail in the remainder of this chapter.
Table 5.1: STIS-Specific Tasks

Must be run in PyRAF.

The routine stisnoise was implemented to deal with the increase in pattern noise with the shift of STIS operations to Side 2 electronics in July 2001. The routine mktrace was created to correct the orientation of spectral traces for application to a given image when it was discovered that the traces have gradually rotated over time. (The average rotation rates have been incorporated into the trace reference files for the L gratings and for the most commonly used M modes: G750M (CENWAVEs 6581, 6768, 8561). See Section 3.5.7.) The routine wx2d is being offered as an alternative to the bilinear interpolation performed by x2d. It produces an image that is iteratively subsampled in the cross-dispersion direction, then rectified in that dimension and summed back into pixels. The final image can then be processed by x1d or x2d for photometric calibration.
STIS spectral extractions, TIME-TAG data, and most STIS reference files are stored in FITS tables. (See Section 2.3.2 for a description of the structure of the table extension files for spectral extractions and TIME-TAG data.) Tasks designed to handle this format must be used to examine and extract information from the tables. Here we give specific examples of the use of routines in ttools to help you get started. A sample output is given after each command.
Find out what information is given in the columns of a FITS table (the parameters listed here are discussed in depth in Section 5.4) using the tlcol task:
cl>tlcol filename_x1d.fits
SPORDER S %11d ""
NELEM S %11d ""
WAVELENGTH D[1024] %25.16g Angstroms
GROSS R[1024] %15.7g Counts/s
BACKGROUND R[1024] %15.7g Counts/s
NET R[1024] %15.7g Counts/s
FLUX R[1024] %15.7g erg/s/cm**2/Angstrom
ERROR R[1024] %15.7g erg/s/cm**2/Angstrom
DQ S[1024] %11d ""
A2CENTER R %15.7g pixel
EXTRSIZE R %15.7g pixel
MAXSRCH S %11d pixel
BK1SIZE R %15.7g pixel
BK2SIZE R %15.7g pixel
BK1OFFST R %15.7g pixel
BK2OFFST R %15.7g pixel
EXTRLOCY R[1024] %15.7g pixel
OFFSET R %15.7g pixel
Use tread to look at the contents of the table:
cl> tread filename_x1d.fits
Column 1 2 3
Label __SPORDER__ ___NELEM___ _______WAVELENGTH________
1 1 1024 5246.150562643081
Note that the number of columns displayed is limited by the width of the window that you are working in. To see more columns, you can start PyRAF or IRAF in a wider window or populate the task parameter columns in tread with some of the column names reported by tlcol:
cl> tread filename_x1d.fits \
Column 1 2 3
Label ____BK1SIZE____ ____BK2SIZE____ ___BK1OFFST____
1 5. 5. -300.
The tlcol output indicates that some of the columns contain arrays of 1024 elements rather than a single value. For those columns, tread displays the value of the first element in the array. e.g., the initial wavelength in this _x1d extraction is 5246.15 Angstroms. To plot an entire array, or plot one array against another, you can use a routine that operates on the table data directly:
You may want to change the parameter values in the supporting parameter sets axispar, dvpar, and pltpar to adjust the plotting. Alternatively, you may find it easier to work with FITS images. To make FITS image files of the arrays:
cl> tximage "filename_x1d.fits[1][c:WAVELENGTH]" filename_x1d_wave
cl> tximage "filename_x1d.fits[1][c:FLUX]" filename_x1d_flux
The images can then be displayed or operated on with standard FITS image handling routines; e.g.:
IDL> filename_x1d_wave=readfits(’filename_x1d_wave.fits’)
IDL> filename_x1d_flux=readfits(’filename_x1d_flux.fits’)
IDL> plot,filename_x1d_wave,filename_x1d_flux
Reference file FITS tables generally have many rows, with each row characterizing a specific operating mode, location on the detector, value of a parameter to be used in the reduction, etc.:
cl> tread oref$q541740qo_pct.fits
Column 1 2 3 4 5
1 -1 52X0.05 3 8 5812.
2 -1 52X0.05 5 8 5812.
3 -1 52X0.05 7 8 5812.
4 -1 52X0.05 9 8 5812.
5 -1 52X0.05 11 8 5812.
6 -1 52X0.05 15 8 5812.
7 -1 52X0.05 21 8 5812.
8 -1 52X0.05 200 8 5812.
9 -1 52X0.05 600 8 5812.
To make a FITS image of the THROUGHPUT array for each of these nine rows:
cl> tximage "oref$q541740qo_pct.fits[1] \
[c:THROUGHPUT][r:row=(1:9)]" q541740qo_pct_tp
This produces the output files q541740qo_pct_tp_r0001.fits through q541740qo_pct_tp_r0009.fits.
Table 5.2 lists some of the more useful PyRAF/IRAF/STSDAS applications for displaying and analyzing STIS spectral data.
Table 5.2: Spectral Analysis Tasks
Some of the tasks are intended for browsing data or producing publication quality plots: the igi and sgraph tasks are described in Chapter 3 of the Introduction to the HST Data Handbooks. The echplot task is useful for browsing STIS extracted spectra. You can plot single spectral orders, overplot multiple orders on a single plot, or plot up to four orders in separate panels on the same page. For example, we overplot the orders contained in rows 2 through 4 and 6 on one page:
Note that the plot_style parameter governs whether the spectral orders are plotted one per page, overplotted, or plotted one per panel, for parameter values of “s”, “m”, or “p” respectively. The brightness unit is calibrated FLUX by default, though other quantities (e.g., NET counts) can be specified using the flux_col parameter.
Specfit is a powerful spectral fitting routine that provides the user with many options for modelling emission and absorption features, continuum, and extinction. The fitting parameters can be linked to each other (e.g., fixed wavelength ratio or fixed flux ratio for two emission lines) and constrained. Different algorithms can be selected to first explore chi-square space, then rapidly achieve convergence in the deepest minimum. The application is fully described in a help file.
MultiDrizzle is a Python script that automates the detection of cosmic rays and the combination of dithered images. It can be run directly from Python or in the dither package in PyRAF, the Python-based interface to IRAF. A User’s Guide is provided at
MultiDrizzle has been adapted to STIS imaging as well as to ACS, NICMOS, and WFPC2 imaging. It can be used to combine STIS CRSPLIT or REPEATOBS image sets as well as dithered images and images made with the same aperture and optical elements but with different target centering or orientation. It uses a cosmic ray rejection algorithm which gives superior results to calstis for CRSPLIT and REPEATOBS exposures, especially for images of unresolved targets with high signal-to-noise. The recommended parameters for cosmic ray rejection and other details specific to applying MultiDrizzle to STIS imaging data are given at:
An IDL package called MULTISPEC, described in STIS ISR 2005-02, is available to analyze slitless spectroscopic data. MULTISPEC is designed to extract multiple point-source spectra from crowded fields. Currently, the package has calibration files for STIS-NUV objective prism and FUV G140L data. It can also operate in an uncalibrated mode where only counts/pixel are extracted. In the future, calibration files for other STIS and ACS slitless spectroscopic data will be added. More information is available at:
The MULTISPEC manual is also posted on the STIS Web site at the following URL:

Table of Contents Previous Next Index Print