![]() |
Institut für Astronomie und AstrophysikAbteilung AstronomieSand 1, D-72076 Tübingen, Germany |
![]() |
FITS_OPEN
Opens a FITS (Flexible Image Transport System) data file.
FITS_OPEN, filename, fcb
filename : name of the FITS file to open, scalar string
FITS_OPEN can also open gzip compressed (.gz) file *for
reading only*, although there is a performance penalty
fcb : (FITS Control Block) a IDL structure containing information
concerning the file. It is an input to FITS_READ, FITS_WRITE
and FITS_CLOSE
/APPEND: Set to append to an existing file.
/HPRINT - print headers with routine HPRINT as they are read.
(useful for debugging a strange file)
/NO_ABORT: Set to return to calling program instead of a RETALL
when an I/O error is encountered. If set, the routine will
return a non-null string (containing the error message) in the
keyword MESSAGE. (For backward compatibility, the obsolete
system variable !ERR is also set to -1 in case of an error.)
If /NO_ABORT not set, then FITS_OPEN will print the message and
issue a RETALL
/UPDATE Set this keyword to open an existing file for update
/WRITE: Set this keyword to open a new file for writing.
MESSAGE = value: Output error message. If the FITS file was opened
successfully, then message = ''.
The output FCB should be passed to the other FITS routines (FITS_OPEN,
FITS_READ, FITS_HELP, and FITS_WRITE). It has the following structure
when FITS_OPEN is called without /WRITE or /APPEND keywords set.
FCB.FILENAME - name of the input file
.UNIT - unit number the file is opened to
.NEXTEND - number of extensions in the file.
.XTENSION - string array giving the extension type for each
extension.
.EXTNAME - string array giving the extension name for each
extension. (null string if not defined the extension)
.EXTVER - vector of extension version numbers (0 if not
defined)
.EXTLEVEL - vector of extension levels (0 if not defined)
.GCOUNT - vector with the number of groups in each extension.
.PCOUNT - vector with parameter count for each group
.BITPIX - BITPIX for each extension with values
8 byte data
16 short word integers
32 long word integers
-32 IEEE floating point
-64 IEEE double precision floating point
.NAXIS - number of axes for each extension. (0 for null data
units)
.AXIS - 2-D array where axis(*,N) gives the size of each axes
for extension N
.START_HEADER - vector giving the starting byte in the file
where each extension header begins
.START_DATA - vector giving the starting byte in the file
where the data for each extension begins
.HMAIN - keyword parameters (less standard required FITS
keywords) for the primary data unit.
.OPEN_FOR_WRITE - flag (0= open for read, 1=open for write,
2=open for update)
.LAST_EXTENSION - last extension number read.
.RANDOM_GROUPS - 1 if the PDU is random groups format,
0 otherwise
.NBYTES - total number of (uncompressed) bytes in the FITS file
When FITS open is called with the /WRITE or /APPEND option, FCB
contains:
FCB.FILENAME - name of the input file
.UNIT - unit number the file is opened to
.NEXTEND - number of extensions in the file.
.OPEN_FOR_WRITE - flag (1=open for write, 2=open for append
3=open for update)
Open a FITS file for reading:
FITS_OPEN,'myfile.fits',fcb
Open a new FITS file for output:
FITS_OPEN,'newfile.fits',fcb,/write
HPRINT, SXDELPAR, SXPAR()
Written by: D. Lindler August, 1995
July, 1996 NICMOS Modified to allow open for overwrite
to allow primary header to be modified
DJL Oct. 15, 1996 corrected to properly extend AXIS when more
than 100 extensions present
Converted to IDL V5.0 W. Landsman September 1997
Use Message = '' rather than !ERR =1 as preferred signal of normal
operation W. Landsman November 2000
Lindler, Dec, 2001, Modified to use 64 bit words for storing byte
positions within the file to allow support for very large
files
Work with gzip compressed files W. Landsman January 2003
Fix gzip compress for V5.4 and earlier W.Landsman/M.Fitzgerald Dec 2003
Assume since V5.3 (STRSPLIT, OPENR,/COMPRESS) W. Landsman Feb 2004
Treat FTZ extension as gzip compressed W. Landsman Sep 2004
[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]