[AIT logo]

Institut für Astronomie und Astrophysik

Abteilung Astronomie

Sand 1, D-72076 Tübingen, Germany
[Uni logo]



Table of Contents




Introduction

The routines in this directory are for reading and writing (disk) FITS binary table extensions. Access to FITS files is direct, rather than passing through intermediate file structures (such as SDAS/Geis). Some routines for reading and writing primary FITS files, and for reading and writing FITS tapes, are included to support writing binary tables. The various routines are:

Primary FITS files -- writing

These routines are for writing primary FITS headers. Primary data arrays can also be written, but are not required. The sequence to be used is to first create the header (FXHMAKE), add any additional desired keywords (FXADDPAR) and write the primary header and optional data array (FXWRITE).

Primary FITS files -- reading

These routines are for reading primary FITS header and data units, and for extracting information from the FITS header. Other routines from the Astronomy User's Library (e.g. READFITS) could also be used to read the primary header and data arrays from FITS files.
	FXREAD		Read primary FITS file
	FXPAR		Extract values from a FITS header

Binary tables -- writing

These routines are used write FITS binary table extensions. The sequence to be used is to create the header (FXBHMAKE), define the table columns (FXBADDCOL), open the file and write the header (FXBCREATE), write the binary table data (FXBWRITE), then close the table (FXBFINISH). See the LaTeX file "fits_bintable.tex" for an example of writing and reading a binary table.

One thing that sometimes confuses first time users is that the logical unit variable UNIT is an output parameter of FXBCREATE, not an input parameter. One does not specify the logical unit number for the file; instead FXBCREATE assigns one via a call to GET_LUN. The returned value is then used by the other routines. A similar situation exists in regard to the column number argument to FXBADDCOL. Column numbers are assigned in the order in which FXBADDCOL is called. See the LaTeX file "fits_bintable.tex" for more information.

Binary tables -- reading

These routines are used for reading FITS binary table extensions. The sequence to be used is to open the table (FXBOPEN), read data from the table (FXBREAD), and close the table (FXBCLOSE). Other routines allow the user to parse and examine information from the binary table header.
	FXBOPEN		Open FITS binary table extension for reading.
	FXBREAD		Read data from FITS binary table.
	FXBCLOSE	Close FITS binary table.
	FXBTDIM		Parse keywords from binary tables with a TDIM-like
			format.
	FXBHELP		Show information about the binary table columns.
	FXBFIND		Find column keywords in header.
	FXBCOLNUM	Returns the column number of a specified column.
	FXBHEADER	Returns the header of an opened FITS binary table.
	FXBISOPEN	Returns whether or not a FITS binary table is open.
	FXBSTATE	Returns the state of a FITS binary table.
	FXBDIMEN	Returns the dimensions of a binary table column.
The same comment above about FXBCREATE and UNIT also applies to FXBOPEN.

Multidimensional Array Facility

These routines support the Multidimensional Array Facility described in the binary tables extension proposal. This convention uses keywords TDIMn of the format TDIMn = '(dim1,dim2,...)' to define the dimensions associated with column "n". Support for this convention is automatic - FXBADDCOL inserts TDIMn keywords into the header, and FXBOPEN interprets any found in the header-- unless the /NO_TDIM keyword is used. Values of TDIMn can also be overridden with the DIMENSIONS keyword in the FXBREAD routine.

In addition to the keywords described in the binary tables extension proposal, several additional keywords are supported by FXBADDCOL with the /VARIABLE keyword. Other than that, support for variable-length arrays is automatic. Some operations, such as reading entire columns, and the multidimensional array facility described above, are not allowed with variable-length arrays.

Ordinarily, the default THEAP value (NAXIS1*NAXIS2) is used to write the variable-length arrays. However, a different THEAP value can be used by using FXADDPAR to insert the desired value into the binary table header before calling FXBCREATE.

IEEE Not-a-Number (NaN) Special Values

Data dropout in FITS binary table arrays are signalled in one of two ways. Dropouts in integer arrays are signalled with values specified by TNULLn keywords. However, dropouts in floating point arrays (including single or double precision, and real or complex) are signalled with standard IEEE NaN (not-a-number) special values. The routine FXBREAD will optionally translate these NaN numbers into a user-specified value, given by the NANVALUE keyword. Conversely, the same keyword, when used with the FXWRITE or FXBWRITE routines, will write out NaN for any points in the array with that value.

At present, there is no support for IEEE +/- Infinity and -0 special values. However, it would be a simple matter to add support similar to IEEE NaN.

Bit, Logical, and Double-precision Complex Arrays

Prior to V4.0, IDL did not support a data type corresponding to double- precision complex (type "M" in FITS binary tables). Users with earlier versions of IDL can still use these routines to read and write double complex data types as ordinary double-precision arrays with an extra first dimension of two. Support for this is automatic when reading binary tables. Columns can be defined as type "M" when writing binary tables if the /DCOMPLEX keyword is passed to FXBADDCOL, and the data array is complex with the first dimension being of size two. Users with IDL versions since V4.0 can simply use the double complex datatype.

Bit arrays (type "X" in FITS binary tables) are treated in IDL as byte arrays with approximately 1/8 the number of elements. Support for this is automatic when reading binary tables. Columns can be defined as type "X" when writing binary tables if the BIT keyword is passed to FXBADDCOL giving the number of bits, and the data array is of type byte. Dimension information is ignored for bit arrays, since the dimensions apply to the bits, and not to the bytes that IDL processes.

Logical arrays (type "L" in FITS binary tables) are treated in IDL as byte arrays. Support for this is automatic when reading binary tables. Columns can be defined as type "L" when writing binary tables if the /LOGICAL keyword is passed to FXBADDCOL, and the data array is of type byte.

Virtual Columns

It is possible to treat keywords in binary table headers as if they were columns in the table, with the same value replicated for every row. This virtual column convention allows the user to have a unified view in a table regardless of whether the information is stored in a table column and thus capable of varying from row to row, or stored in the header and thus the same for every row.

To use the virtual column convention, the user must call FXBREAD with the /VIRTUAL keyword, and must also reference the desired information by name rather than by column number. FXBREAD will then look first for a column with that name. If it doesn't find one, it then looks for a keyword with that name in the header.


Questions should be directed to William T. Thompson


Index of Subroutines

FXADDPAR Add or modify a parameter in a FITS header array.
FXBADDCOL Adds a column to a binary table extension.
FXBCLOSE Close a FITS binary table extension opened for read.
FXBCOLNUM() Returns a binary table column number.
FXBCREATE Open a new binary table at the end of a FITS file.
FXBDIMEN() Returns the dimensions for a column in a FITS binary table. Explanation : This procedure returns the dimensions associated with a column in a binary table opened for read with the command FXBOPEN. Use : Result = FXBDIMEN(UNIT,COL) Inputs : UNIT = Logical unit number returned by FXBOPEN routine. Must be a scalar integer. COL = Column in the binary table to read data from, either as a character string containing a column label (TTYPE), or as a numerical column index starting from column one. Opt. Inputs : None. Outputs : The result of the function is an array containing the dimensions for the specified column in the FITS binary table that UNIT points to. Opt. Outputs: None. Keywords : ERRMSG = If defined and passed, then any error messages will be returned to the user in this parameter rather than depending on the MESSAGE routine in IDL. If no errors are encountered, then a null string is returned. In order to use this feature, ERRMSG must be defined first, e.g. ERRMSG = '' Result = FXBDIMEN( ERRMSG=ERRMSG, ... ) IF ERRMSG NE '' THEN ... Calls : FXBCOLNUM, FXBFINDLUN Common : Uses common block FXBINTABLE--see "fxbintable.pro" for more information. Restrictions: None. Side effects: The dimensions will be returned whether or not the table is still open or not. If UNIT does not point to a binary table, then 0 is returned. If UNIT is an undefined variable, then 0 is returned. Category : Data Handling, I/O, FITS, Generic. Prev. Hist. : None. Written : William Thompson, GSFC, 4 March 1994. Modified : Version 1, William Thompson, GSFC, 4 March 1994. Version 2, William Thompson, GSFC, 21 June 1994 Added ERRMSG keyword. Version 3, William Thompson, GSFC, 23 June 1994 Modified so that ERRMSG is not touched if not defined. Version : Version 3, 23 June 1994 Converted to IDL V5.0 W. Landsman September 1997
FXBFIND Find column keywords in a FITS binary table header.
FXBFINDLUN() Find logical unit number UNIT in FXBINTABLE common block.
FXBFINISH Close a FITS binary table extension file opened for write.
FXBGROW Increase the number of rows in a binary table.
FXBHEADER() Returns the header of an open FITS binary table. Explanation : This procedure returns the FITS extension header of a FITS binary table opened for read with the command FXBOPEN. Use : Result = FXBHEADER(UNIT) Inputs : UNIT = Logical unit number returned by FXBOPEN routine. Must be a scalar integer. Opt. Inputs : None. Outputs : The result of the function is a string array containing the header for the FITS binary table that UNIT points to. Opt. Outputs: None. Keywords : None. Calls : FXBFINDLUN Common : Uses common block FXBINTABLE--see "fxbintable.pro" for more information. Restrictions: None. Side effects: The string array returned always has as many elements as the largest header read by FXBOPEN. Any extra elements beyond the true header are blank or null strings. The header will be returned whether or not the table is still open or not. If UNIT does not point to a binary table, then a string array of nulls is returned. If UNIT is an undefined variable, then the null string is returned. Category : Data Handling, I/O, FITS, Generic. Prev. Hist. : None. Written : William Thompson, GSFC, 1 July 1993. Modified : Version 1, William Thompson, GSFC, 1 July 1993. Version : Version 1, 1 July 1993. Converted to IDL V5.0 W. Landsman September 1997
FXBHELP Prints short description of columns in a FITS binary table.
FXBHMAKE Create basic FITS binary table extension (BINTABLE) header.
FXBINTABLE Common block FXBINTABLE used by "FXB" routines.
FXBISOPEN() Returns true if UNIT points to an open FITS binary table. Explanation : This procedure checks to see if the logical unit number given by the variable UNIT corresponds to a FITS binary table opened for read with the command FXBOPEN, and which has not yet been closed with FXBCLOSE. Use : Result = FXBISOPEN(UNIT) If FXBISOPEN(UNIT) THEN ... Inputs : UNIT = Logical unit number returned by FXBOPEN routine. Must be a scalar integer. Opt. Inputs : None. Outputs : The result of the function is either True (1) or False (0), depending on whether UNIT points to an open binary table or not. Opt. Outputs: None. Keywords : None. Calls : FXBFINDLUN Common : Uses common block FXBINTABLE--see "fxbintable.pro" for more information. Restrictions: None. Side effects: If UNIT is an undefined variable, then False (0) is returned. If UNIT points to a FITS binary table file that is opened for write, then False (0) is returned. Category : Data Handling, I/O, FITS, Generic. Prev. Hist. : None. Written : William Thompson, GSFC, 1 July 1993. Modified : Version 1, William Thompson, GSFC, 1 July 1993. Version : Version 1, 1 July 1993. Converted to IDL V5.0 W. Landsman September 1997
FXBOPEN Open binary table extension in a disk FITS file for reading or updating
FXBPARSE Parse the binary table extension header.
FXBREAD Read a data array from a disk FITS binary table file.
FXBREADM Read multiple columns/rows from a disk FITS binary table file.
FXBSTATE() Returns the state of a FITS binary table. Explanation : This procedure returns the state of a FITS binary table that was either opened for read with the command FXBOPEN, or for write with the command FXBCREATE. Use : Result = FXBSTATE(UNIT) Inputs : UNIT = Logical unit number returned by FXBOPEN routine. Must be a scalar integer. Opt. Inputs : None. Outputs : The result of the function is the state of the FITS binary table that UNIT points to. This can be one of three values: 0 = Closed 1 = Open for read 2 = Open for write Opt. Outputs: None. Keywords : None. Calls : FXBFINDLUN Common : Uses common block FXBINTABLE--see "fxbintable.pro" for more information. Restrictions: None. Side effects: If UNIT is an undefined variable, then 0 (closed) is returned. Category : Data Handling, I/O, FITS, Generic. Prev. Hist. : None. Written : William Thompson, GSFC, 1 July 1993. Modified : Version 1, William Thompson, GSFC, 1 July 1993. Version : Version 1, 1 July 1993. Converted to IDL V5.0 W. Landsman September 1997
FXBTDIM() Parse TDIM-like kwywords.
FXBTFORM Returns information about FITS binary table columns.
FXBWRITE Write a binary data array to a disk FITS binary table file.
FXBWRITM Write multiple columns/rows to a disk FITS binary table file.
FXFINDEND Find the end of a FITS file.
FXHCLEAN Removes required keywords from FITS header.
FXHMAKE Create a basic FITS header array.
FXHMODIFY Modify a FITS header in a file on disk.
FXHREAD Reads a FITS header from an opened disk file.
FXPAR() Obtain the value of a parameter in a FITS header.
FXPARPOS() Finds position to insert record into FITS header.
FXREAD Read basic FITS files.
FXWRITE Write a disk FITS file.

Last modified by pro2html on 2008 November 09 at 04:12 UTC

[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]

Jörn Wilms (wilms@astro.uni-tuebingen.de)
Updated automatically