Subject: FITS binary tables

From: thompson at stars.gsfc.nasa.gov (William Thompson, code 682.1, x2040)
Date: 10 Feb 92 17:20:00 GMT

I am currently engaged in writing IDL-based I/O software for FITS binary
tables.  I want to get some clarification on one point.  I'm not entirely clear
about how bit arrays (denoted as 'X' in the TFORM keyword) are treated.  Does
the repeat parameter give the number of bits, or the number of bytes contained
within the bit array?  I.e., if

	TFORM1 = '100X    '

then does this column contain 100 bits (rounded off to 13 bytes) or 800 bits
within 100 bytes?

On another topic, I've run into some problems with complex arrays in both
primary FITS data units, and in binary tables, and I thought I'd air the
techniques I'm using to get around them, to see if anybody had a different way
to handle it.

In standard FITS files, the BITPIX keyword has no way of marking an array as
complex.  Therefore, I decided to write complex arrays as floating point, with
the first dimension (NAXIS1) being 2, and the remaining dimensions being the
dimensions of the array.  The comment attached to the NAXIS1 header record says
that these are the real and imaginary parts of a complex number.

No such problem occurs in FITS binary tables.  However, IDL does not currently
support a data type corresponding to 'M' (double-precision complex).
Therefore, I am defining the reader software to treat such arrays as
double-precision, with twice as many elements, and formatted such that the
first dimension of the array is 2 (real and complex parts).  The writing
software will also be able to write double-precision arrays as type 'M' if the
user tells it to, and if the first dimension of the array is 2.

Does anyone envision any problems with that approach?

Bill Thompson

---

From: bcotton at gorilla.CV.NRAO.EDU (Bill Cotton)
Date: Thu, 13 Feb 1992 12:10:23 GMT

> then does this column contain 100 bits (rounded off to 13 bytes) or 800 bits
   The repeat count is the number of elements of the given type.
Your example, TFORM1= '100X    ', means an array of 100 bits occupying
13 bytes.  The trailing bits of the final byte are undefined.
-Bill Cotton