STScI Logo
STScI Logo
HST
Banner
FAQ
STScI

Part I: Introduction to Reducing the HST Data

TOC PREV NEXT INDEX PDF

3.5 Displaying HST Spectra


This section describes how to plot the most common HST spectra (STIS, GHRS, and FOS) in IRAF/STSDAS for a quick first look, and how to generate hardcopies of plots. Because the STIS data format differs from that of FOS and GHRS, we will discuss STIS data separately.

We will not discuss ACS grism or prism data, and NICMOS grism data in any great length here, as the tools for extracting, displaying and analyzing spectra from these instrument modes are discussed in detail in the instrument chapters (Part II) of their respective instrument's Data Handbooks, in particular the sections on aXe (for ACS grism/prism data) and Nicmoslook (for NICMOS grism data).

3.5.1 Specview

First, however, we would like to draw the reader's attention to a very useful tool, called Specview1, which can be used to display and analyze spectra from most HST instrument configurations in their native archival format, as well as data from a variety of other spectral instruments. It is a Java application for 1D interactive spectral visualization and analysis.

Specview was written at STScI in Java (Busko 1999) and is distributed in standalone application, and applet, formats. The application version requires that either the Java Development Kit (JDK) or Java Runtime Environment (JRE) be installed in your system and accessible from your path. Specview is also distributed as bundled software in the StarView astronomical database browser and analysis tool from http://starview.stsci.edu. If you have StarView version 7.1 or above already installed, you automatically got Specview as StarView's spectral preview tool.

Specview is capable of overplotting spectra from different instruments, measuring, modelling, and fitting spectral features, spectral line identification, and it allows somewhat elaborate plot annotation. More information about Specview, together with screen shots, demos, and the software for download are available at:


http://www.stsci.edu/resources/software_hardware/specview

3.5.2 STIS Spectra

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

Plotting STIS Imaging Spectra

You can use sgraph in the graphics.stplot package of STSDAS to plot STIS long-slit spectral images 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.3.1) 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.

Plotting STIS Tabular Spectra

To plot STIS spectra in BINTABLE extensions, you first need to understand how STIS spectra are stored as binary arrays in FITS table cells. Section 2.1.2 discusses this format and describes the selectors syntax used to specify these data arrays. Each row of a STIS tabular spectrum contains a separate spectral order (first-order spectra will have one row, while echelle spectra will have many rows), and each column contains data of a certain type, such as wavelength or flux. To specify a particular array, you must first type the file name, then the extension containing the BINTABLE, followed by the column selector, and finally the row selector. For example, to select the WAVELENGTH array corresponding to spectral order 80 of the echelle spectrum in extension 4 (EXTNAME=SCI, EXTVER=2) of stis.fits, you would specify the file as either:

stis.fits[4][c:WAVELENGTH][r:sporder=80]

or

stis.fits[sci,2][c:WAVELENGTH][r:sporder=80]


 

The sgraph task and the igi plotting package, discussed below, both understand the selectors syntax. In particular, if you wanted to plot flux vs. 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 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.5.3 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.2.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.

Sgraph 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 separate parameters, rather than enclosed in the standard square brackets.

3.5.4 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 from the cl window:

  1. Type =gcur in the cl command window.
  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.

From a Pyraf window, making hardcopies is simpler: just select print from the menu at the top of the graphics window.

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> sgraph o43balbnm_x2d.fits[1][*,100:1000] device=psi_land

st> gflush

/tmp/pskxxx


 

The above commands would write a plot 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.4 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.4: Sample igi Plot .
 

If you are working in the Python/PyRaf environment, the plotting library matplotlib is available. It uses most of the MATLAB syntax.

1Specview is a product of the Space Telescope Science Institute, which is operated by AURA for NASA.

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

Copyright  | Help  | Printable Page