Deprecation of Random Groups

William Pence pence at tetra.gsfc.nasa.gov
Fri May 1 16:43:27 EDT 1998


Bill Cotton wrote:
>    From a purely technical point of view there is little to be gained
> from switching from a Random Groups format to binary tables; the
> difference is merely the file headers - the actual bit patterns could
> be unchanged.

That's true, and in fact the CFITSIO library
(http://heasarc.gsfc.nasa.gov/fitsio) internally interpretes random
groups as binary tables:  each group is a separate row in the virtual
table, with the group parameters in column 1 and the data array in
column 2 (in general both columns are vectors).  While CFITSIO does
contain  specialized routines for reading and writing group parameters
and grouped arrays, these just call the more general CFITSIO routines
which read and write data in binary table columns.  CFITSIO also treats
primary arrays and image extensions as binary tables in the same way,
but in these cases the 1st column (containing the group parameters) has
a vector repeat count = 0, and there is only one row in the virtual
table.  So really all FIT HDUs are binary tables as far as CFITSIO is
concerned.

Thus, it is possible for software that is based on CFITSIO to read and
write grouped data as though they were binary tables, even without
changing the current format of the files (e.g., to read the 4th group
parameter in the 2nd group, call the CFITSIO binary table reading
routine to read the 4th pixel element of column 1 in the 2nd row of the
virtual binary table).

-Bill Pence





More information about the fitsbits mailing list