next up previous contents
Next: 3.2.2 Writing General FITS Up: 3.2 FITS Files Previous: 3.2 FITS Files

3.2.1 Reading General FITS Files

  There are several possible file structures for FITS files. In order to read a FITS file, you need to know something about its structure. You need to know whether the file contains a ``primary array'' and/or various ``extensions''. To display information about a given file, you may use IUEFHRD:


FILENAME Full file name of file to examine. If the extension is not included, .FIT is assumed.
PARMS Vector including information about the file. The elements of this vector contain:
  0 Number of records in primary header (H).
  1 Number of data records in primary array.
  2 Number of records in first extension header (EH1).
  3 Number of data records in first extension.
  4 Number of records in second extension header (EH2).
  5 Number of data records in second extension.
  The size of PARMS will vary with the number of extensions. Currently, files with up to 49 extensions can be read (although only the first 10 extension headers can be extracted).
H Primary header.
lab IUE Vicar label, if found in primary header (null if not found).
eh1, eh2,...,eh10 First through tenth extension headers, if found.
silent If this keyword is set, no information will be printed on the screen.
full If this keyword is set, and an IUE Vicar label is found in the primary header, it will not be removed from the header (although it will still be returned in the LAB parameter).

If you don't set the SILENT keyword, information about the file will be printed on the screen. Once you know something about the format of the file, you can read it with IFITSRD:

IFITSRD,'FILENAME',ROW,H,eh,p1,...,p20,erec=erec,/silent, $

FILENAME Full name of file to be read. If the extension is not given .FIT is assumed.
ROW This depends on the format of the file you wish to read:
  >0 Row number(s) to read from binary table extension.
  =0 Read the image extension.
  <0 Read primary array.
H Primary header.
eh Extension header (null if none).
p1,...,p20 Fields to be read. If ROW=0, P1 will be the data read from an image extension. If ROW<0, p1 will be the primary array. If ROW>0, then p1,p2, etc. will each contain the data from a single field of the binary table (up to 20 parameters can be specified). The binary table fields can be scalars, vectors, or multi-dimensional arrays.
erec Starting data record of desired extension. Not usually needed for IUE data.
silent If this keyword is set, no information will be printed on the screen.
efld Normally, fields are read sequentially starting with the first one (up to 20). You may specify which fields to read explicitly with this keyword. For example, to read fields 3, 9, and 47 set efld=[3,9,47]. (Note if /struc is specified, all fields are read and efld is ignored.)
nvla An optional input/output keyword array used when reading Binary table FITS files containing variable length arrays. IFITSRD will normally pad variable length arrays with zeroes according to the value of maxlen extracted from the binary table. The NVLA keyword stores the actual number of elements in each variable length array.
struc When specified, all the fields in a binary table are stored as an IDL structure in parameter P1. The value of the TTYPEn keywords are used as tag names. There is no limit to the number of fields extracted and when multiple rows are extracted (i.e., when ROW is a vector), the values are stored as an array of structures. (Note the EFLD keyword is ignored when /struc is specified.)

IFITSRD is a general FITS reader. It can read the various NEWSIPS data files. However, to make things simpler for users, there are separate procedures to read these files, as described above. For example, the MXLO and MXHI files contain fluxes with padded zeroes, a starting wavelength and increment instead of a wavelength vector, and possibly data for different spectral orders or apertures in separate rows. The program READMX for example, reads the NEWSIPS MXLO and MXHI files and outputs fluxes and wavelengths much like IUESPEC does with IUESIPS files. The other three programs for reading IUE FITS files are READSI, READLI, and READRI (for reading the SI, LI, and RI data, respectively).

next up previous contents
Next: 3.2.2 Writing General FITS Up: 3.2 FITS Files Previous: 3.2 FITS Files