STScI

HST Data Handbook for WFPC2

TOC PREV NEXT INDEX PDF

3.4 Displaying HST Spectra


This section shows how to plot your HST spectra for a quick first look and how to generate hardcopies of your plots. Because the STIS data format differs from that of FOS and GHRS, we will discuss STIS data separately.

3.4.1 FOS and GHRS Spectra

Before you work with FOS and GHRS data within STSDAS, you will want to convert the FITS files you received from the Archive into GEIS format (see section 2.3.1 for instructions). After conversion, the.c1h file will hold the calibrated flux values for each pixel, the .c0h file will hold the corresponding wavelengths, and the .c2h file will hold the propagated statistical errors.

Each group of an FOS or GHRS GEIS file contains the results of a separate subintegration. FOS readouts taken in ACCUM mode are cumulative, so the last group contains the results of the entire integration. In contrast, GHRS readouts and FOS readouts in RAPID mode are independent. If you want to see the results of an entire GHRS FP-SPLIT integration, you will need to align and coadd the spectra in the groups of the GHRS file. You can also combine all the groups in an FOS or GHRS data file, without wavelength alignment, using the rcombine task in the hst_calib.ctools package. See online help for details.

The STSDAS task sgraph (in the graphics.stplot package) can plot the contents of a single GEIS group. For example, if you want to see group 19 of the calibrated FOS spectrum with rootname y3bl0104t you can type
st> sgraph y3bl0104t.c1h[19]

 

Given an input flux image (.c1h), the task fwplot (in the hst_calib.ctools package) will look for the corresponding wavelength (.c0h) file and plot flux versus wavelength. If requested, it will also look for the error (.c2h) file and plot the error bars. To see a plot of the same spectrum as above, but with a wavelength scale and error bars, type
st> fwplot y3bl0104t.c1h[19] plterr+

 

If you ever need to plot the contents of multiple groups offset from one another on the same graph, you can use the grspec task in the graphics.stplot package. For example, to plot groups 1, 10, and 19 of a given flux file, you can type
st> grspec y3bl0104t.c1h 1,10,19

 

Note that grspec expects group numbers to be listed as a separate parameter, rather than enclosed in the standard square brackets.

3.4.2 STIS Spectra

STIS data files retrieved from the Archive can contain spectra in two different forms: as long-slit spectral images in FITS IMAGE extensions or as extracted echelle spectra in FITS BINTABLE extensions.

You can use sgraph to plot STIS long-slit spectra by specifying the image section that contains the spectrum. For example, to plot the entire x range of the calibrated two-dimensional spectrum in the first extension of the file o43ba1bnm_x2d.fits, averaging rows 100 through 1000, you would type
st> sgraph o43ba1bnm_x2d.fits[1][*,100:1000]

 

Displaying the long-slit spectral image using the display task (see section 3.2.1 in the HST Introduction) allows you to see the range of your spectrum in x and y pixel space, so you can choose a suitable image section for plotting.

To plot STIS spectra in BINTABLE extensions, you first need to understand how STIS spectra are stored as binary arrays in FITS table cells. chapter 2 (section 2.2.2) discusses this format and describes the selectors syntax used to specify these data arrays. Each row of a STIS echelle table contains a separate spectral order, and each column contains data of a certain type, such as WAVELENGTH data or FLUX data. To specify a particular array, you must first type the file name, then the extension containing the BINTABLE, then the column selector, then the row selector. For example, to select the WAVELENGTH array corresponding to spectral order 80 of the echelle spectrum in extension 4 of stis.fits, you would specify the file as:
stis.fits[4][c:WAVELENGTH][r:sporder=80]

 

The sgraph task and the igi plotting package, to be discussed below, both understand the selectors syntax. In particular, if you wanted to plot the flux versus wavelength in STIS echelle order 80, you could type:
st> sgraph "stis.fits[4][r:sporder=80] WAVELENGTH FLUX"

 

Remember to include the quotation marks. Otherwise, sgraph will complain about too many positional arguments. Note also that sgraph understands only row selector syntax; columns are chosen by name.

The STIS-specific echplot task is particularly useful for browsing STIS echelle spectra. It 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, to overplot the orders contained in rows two through four and row six on a single page:
cl> echplot "stis_x1d.fits[1][r:row=(2:4,6)]" output.igi \
>>> plot_style=m

 

Note that the plot_style parameter governs how the spectral orders are plotted. The plot_style values s, m, and p plot one order per page, several orders on a single plot, and one order per panel, respectively. The default brightness unit is calibrated FLUX, although you can specify other quantities (e.g., NET counts) using the flux_col parameter. See the online help for details.

3.4.3 Producing Hardcopy

This section shows how to generate hardcopies of plots directly and describes igi, the Interactive Graphics Interpreter available in STSDAS.

Direct Hardcopies

To print a quick copy of the displayed plot:

  1. Type =gcur in the command window (where your CL prompt is located).
  2. Move the cursor to any location in the graphics window.
  3. Press to write the plot to the graphics buffer.
  4. Type q to exit graphics mode.
  5. At the cl prompt, type gflush.

Plots will be printed on the printer defined by the IRAF environment variable stdplot. Type show stdplot to see the current default printer; use set stdplot = printer_name to set the default printer.

The PostScript kernel psikern allows you to create PostScript files of your IRAF/STSDAS plots. For example, setting the device parameter in a plotting task equal to psi_port or psi_land invokes psikern and directs your plot to either a portrait-mode or a landscape mode PostScript file. For example:
st> fwplot y3bl0104t.c1h[19] device=psi_land
st> gflush
/tmp/pskxxxx

 

The above commands would write a plot of flux vs. wavelength in landscape-mode into a temporary PostScript file, named /tmp/pskxxxx by a UNIX system. See the online help for more about psikern, including plotting in color and incorporating PostScript fonts into your plots.

igi

As your plotting needs grow more sophisticated-and especially as you try preparing presentations or publication-quality plots-you should investigate the Interactive Graphics Interpreter, or igi. This task, in the STSDAS stplot package, can be used with images as well as two- and three-dimensional tables and can draw axes, error bars, labels, and a variety of other features on plots. Different line weights, font styles, and feature shapes are available, enabling you to create complex plots. Figure 3.5 shows a sample plot created in igi, however, because igi is a complete graphics environment in itself, it is well beyond the scope of this document. You can learn more about igi in the IGI Reference Manual, available through the STSDAS Web pages.

Figure 3.5: Sample igi Plot .
 

Space Telescope Science Institute
http://www.stsci.edu
Voice: (410) 338-1082
help@stsci.edu
TOC PREV NEXT INDEX PDF