NOTE: Most of the High Level Science Products are unavailable while unscheduled maintenance is being performed. They will be incrementally restored over the course of this week. We apologize for any inconvenience.
Reading BEFS FITS files in IDL
In the binary table extensions containing our first- and second-order spectra, the data are written as a series of 12 22,000-point vectors. The wavelength vector is first, followed by calibrated flux in photon units, followed by calibrated flux in energy units, etc. (Because the computer must calculate the location of only the first element of each vector, it can read the files much faster than if the table were written as 22,000 rows, each twelve entries across.)
Here are a few examples of reading the BEFS FITS arrays into IDL variables:
1. IFITSRD.pro: is a general FITS reader written by the IUE project.
IDL> ifitsrd,'BEFS1002.SPD1',1,mheader,exheader,wave,fphoton, flux,err
The above command will store wavelengths in the IDL variable "wave",
calibrated fluxes in "flux", and the error estimates
(defined as the "sigma of flux" / "flux") in "err".
The primary header is stored as a string array called mheader, and the
extension header is exheader.
This program has the virtue of writing binary table fields directly
into individual IDL variables in one command.
Ifitsrd (unless commanded off by keyword '/silent')
will also print out the names of the
table columns, such as:
While this is a good routine for reading single table extension files, the most widely distributed version of ifitsrd can be a little awkward for reading the second extension containing the 2nd-order fluxes (fluxes adapted from the EUVE) which a small fraction of the BEFS database contain in the *.SPD1 (FUV) files. To read this second extension, one must know the record number in which the second extension data begins. The record number can be determined by first reading the header array using the routine IUEFHRD, and using the parms output vector to calculate the record number. The commands to read the 2nd order data would be:
(Note the 2nd order fluxes are only given in units of counts)
The latest version of ifitsrd includes a keyword enum for specifying the
number of the extension to read, so reading the data as above would be
It should be pointed out that the above examples require the user to know
the order in which the data entries are stored in the binary table. An
alternative way, (also used by MRDFITS below) is to store all the fields
in an IDL structure (see below). To read all the data from
the first binary table as a structure called dst with ifitsrd:
IDL> fxbopen, unit, 'BEFS1002.SPD1', 'SPECTRUM', header IDL> fxbread, unit, wave, 'WAVELENGTH' IDL> fxbread, unit, flux, 'FLUX_PHOT' IDL> fxbread, unit, error, 'FRAC_ERR' IDL> fxbclose, unit IDL> error = error * flux IDL> print, header
To extract the corresponding second-order spectrum, type:
IDL> fxbopen, unit, 'BEFS1002.SPD1', '2NDORDER', header IDL> fxbread, unit, wave2, 'WAVELENGTH' IDL> fxbread, unit, counts2, '2ND_COUNTS' IDL> fxbclose, unit
3. MRDFITS.pro can read both extensions, this time without foreknowledge of the table row names:
IDL> a1 = mrdfits('BEFS1020.SPD1',1,h1)
The resulting arrays a1 and a2 are structures. To determine the structure
names, type help,/struc,a1. For a tutorial in IDL structures,
using IDL structures >. More examples of reading FITS files
using IDL are given in the
Analysis of Copernicus Scans (Exs. 1 & 2 only),
How to read
Copernicus files, and in
How to read