Space Telescope Science Institute
Intro to HST Data Handbooks 8.0 May 2011
help@stsci.edu
Table of Contents Previous Next Index Print


Introduction to the HST Data Handbooks > Chapter 3: Analyzing HST Data > 3.5 Displaying HST Spectra

3.5
Displaying HST Spectra
This section describes how to plot the most common HST spectra (COS, FOS, GHRS, and STIS) in IRAF/STSDAS for a quick first look.
We will not discuss ACS, NICMOS, or WFC3 grism or prism data. The tools for extracting, displaying and analyzing spectra from these instrument modes are discussed in the instrument sections in Part II (see sections on aXe for ACS and WFC3, and NICMOSlook for NICMOS).
3.5.1
Specview is a very useful tool for displaying and analyzing 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 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
Both COS and STIS data files retrieved from the HDA can contain spectra in two different forms: as spectral images in FITS IMAGE extensions or as extracted spectra in FITS BINTABLE extensions.
Plotting COS and STIS Imaging Spectra
You can use sgraph in the graphics.stplot package of STSDAS to plot spectral images by specifying the image section that contains the spectrum. For example, to plot the entire x-range of the calibrated two-dimensional STIS spectrum in the first extension of the file o43ba1bnm_x2d.fits, averaging rows 100 through 1000, you would type:
Similarly, to plot the calibrated two-dimensional COS spectrum in the first extension of the file l61h54cxr_flt_a.fits, averaging rows 451 through 480, you would type:
Displaying a 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 COS and STIS Tabular Spectra
To plot COS or STIS spectra in BINTABLE extensions, you first need to understand how the spectra are stored as binary arrays in FITS table cells. Section 2.2.2 discusses this format and describes the selectors syntax used to specify these data arrays. 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.
COS Row Selector Examples
COS tabular spectra contain two or three rows corresponding to either the FUV segments of the NUV stripes. For example, to select the WAVELENGTH array corresponding to segment A of the FUV spectrum in extension 1 of cos_fuv.fits, you would specify the file as either:
To select the WAVELENGTH array corresponding to stripe C of the NUV spectrum in extension 1 of cos_nuv.fits, you would specify the file as either:
STIS Row Selector Examples
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:
Plotting Tasks
The sgraph task and the igi plotting package, discussed below, both understand the row selectors syntax. In particular, if you wanted to plot flux vs. wavelength in STIS echelle order 80, you could type
Similarly, to plot flux vs. wavelength in COS segment FUVA, you could type
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:
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
Before working 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 sub-integration. 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:
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:
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
Note that grspec expects group numbers to be listed as separate parameters, rather than enclosed in the standard square brackets.
3.5.4
This section shows how to generate hard copies of plots directly and describes igi, the Interactive Graphics Interpreter available in STSDAS. If you are working in the Python/PyRAF environment, the plotting library matplotlib is available. It uses most of the MATLAB syntax.
Direct Hardcopies
To print a quick copy of the displayed plot from the cl window:
1.
Type =gcur in the cl command window.
2.
3.
4.
Type q to exit graphics mode.
5.
From a PyRAF window, making hard copies 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. This parameter is generally defined in the login.cl file.
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:
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.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

Table of Contents Previous Next Index Print