IRAF Newsletter -- Number 14 -- April 1998

[ Previous ] [ Next ] [ Table of Contents ] [ Search this issue ]


Changes to the RFITS and WFITS Tasks

Better support for unsigned short integer data has been added to rfits and wfits . The task wfits will by default transform unsigned short IRAF images into FITS images with BITPIX = 16, BSCALE = 1.0, and BZERO = 32768.0. The rfits task will by default transform FITS images with BITPIX = 16, BSCALE = 1.0, and BZERO = 32768.0 back into unsigned short IRAF images.

With the addition of the FITS kernel to IRAF V2.11, support for reading and writing image data to multi-extension format (MEF) FITS files has been added to the rfits and wfits tasks. Previous versions of rfits and wfits supported old-style single image FITS files only. The new rfits can unpack FITS image extensions into individual IRAF images, and the new wfits can pack individual IRAF images into a single multi-extension FITS file, as shown in the examples below.

In these examples tape files are numbered starting at one. In a MEF FITS file, the primary header unit (PHU) is FITS unit zero, and the first extension is FITS unit 1. By convention IRAF prefers to use the PHU of a multi-extension FITS file only for global header information relating to the entire file, so the first data unit in a MEF FITS file is at index one (there is no guarantee however that all MEF FITS files will adhere to this convention). The PHU of a MEF FITS file may be read as an image regardless of whether it contains pixel data. If there is no pixel data it is an image with NAXIS=0, with an image header and no data.

1. Read all image data from all FITS files on tape into individual IRAF images.

2. Read all image data from FITS files 1-8 and 10-20 on tape into individual IRAF images.

3. Read image extensions 0-3 from FITS files 1-8 and image extensions 4-7 from FITS files 10-20 on tape into individual IRAF images. Note the use of the ranges syntax to specify both the tape file list which is one-indexed and the FITS "unit" list which is zero-indexed.

4. Read all the image data from a list of FITS files on disk.

5. Read the zeroth FITS unit (i.e., the PHU, which may or may not contain image data) from a list of FITS files on disk.

6. Read the PHU and image extensions 2-4 and 6 from a list of FITS files on disk.

7. Write a list of IRAF images to individual FITS files on tape or disk.

8. Write a list of images to a single FITS file on tape or disk.

The new rfits and wfits tasks and the FITS image kernel can be used to unpack multi-extension FITS image data into individual FITS images, or pack individual FITS images into multi-extension FITS files, as shown in the following examples. The equivalent imcopy commands which use the FITS image kernel exclusively are shown for comparison.

9. Read the third and fourth image extension from a multi-extension FITS file into an individual FITS image. Adding ".fits" to the output image name ensures the creation of a FITS image.

10. Write a list of FITS images on disk into a single multi-extension FITS file. To maintain compatibility with the FITS image kernel, wfits appends the value of the "fextn" parameter to the output FITS file name.

To maintain compatibility with the FITS image kernel, support for global header keyword inheritance has been added to rfits , and minimal global header support has been added to wfits . The new rfits will automatically merge the keywords in the primary header of a multi-extension FITS file with the keywords in each image extension header provided that, the primary header has NAXIS = 0, the image extension header has INHERIT = T, and the primary header keywords are not duplicated in the image extension header. Wfits will by default prepend a minimal global header to any output multi-extension FITS files.

Lindsey Davis

[ Previous ] [Next ] [ Table of Contents ] [ Search this issue ]

IRAF Group, National Optical Astronomy Observatories, P.O. Box 26732, Tucson, AZ 85726, Phone: (520) 318-8160, FAX: (520) 318-8360, Email iraf@noao.edu

Posted: 07May1998