Subject: Re: Data structure in FITS (Was: Re: Thoughts

From: cflatter at nrao.edu (Chris Flatters)
Date: Mon, 22 Jun 1992 17:57:35 GMT

In article 22JUN199212071356 at stars.gsfc.nasa.gov, thompson at stars.gsfc.nasa.gov (William Thompson, code 682.1, x2040) writes:
>In article <1992Jun22.141424.3147 at nsisrv.gsfc.nasa.gov>,
>warnock at Hypatia.gsfc.nasa.gov (Archie Warnock) writes...
>
>>In article <1992Jun19.215656.25564 at nrao.edu>, cflatter at nrao.edu (Chris
>>Flatters) writes:
>>|> For example suppose that we have a binary tree of integers.  In C
>>|> we might declare the following struct to hold tree nodes.
>>|> 
>>|> struct TreeNode
>>|>     {
>>|>     int      value;	/* Value */
>>|>     TreeNode *left;     /* Pointer to left subtree or null pointer */
>>|>     TreeNode *right;    /* Pointer to right subtree or null pointer */
>>|>     };
>>|> 
>>|> We could store a binary tree of integers in a single FITS binary table
>>|> with the following header.
>>|> 
>>|> XTENSION='BINTABLE'
>>|> BITPIX  =                     8 / Binary data
>>|> NAXIS   =                     2 
>>|> NAXIS1  =                    12 / 3 integers at 4 bytes each
>>|> NAXIS2  =                     ? / The number of nodes in the tree
>>|> PCOUNT  =                     0
>>|> GCOUNT  =                     1
>>|> TFIELDS =                     3
>>|> EXTNAME = 'BTREE   '            / For example
>>|> EXTVER  =                     1
>>|> TFORM1  = '1J      '
>>|> TTYPE1  = 'VALUE           '
>>|> TUNIT1  = '        '
>>|> TFORM2  = '1J      '
>>|> TTYPE2  = 'LEFT SUBTREE    '
>>|> TUNIT2  = '        '
>>|> TFORM3  = '1J      '
>>|> TTYPE3  = 'RIGHT SUBTREE   '
>>|> TUNIT3  = '        '
>>|> END
>> 
>>OK, so far I'm with you.  Have we instituted some sort of control
>>authority to handle the values of EXTNAME so applications can recognize
>>the data structures there?  Should we?
>
>I believe that this is a misuse of the EXTNAME keyword.  My understanding of
>EXTNAME is that it should identify what data is stored in the table, not the
>structure used for storing the data.  Certainly, that is how I planned to use
>it for storing SOHO/CDS data: the EXTNAME record would contain the unique
>identification of the observation, which would then be linked to the master
>catalog.

This is correct.  The data structure in a FITS binary table is defined by
the TFORM/TTYPE keywords.  

>
>Binary tables have a tremendous capability of extending the way they can be
>used.  The above is one example.  Others may wish to follow the relational
>model.

The example is consistent with the use of Codd's relational model.  In
general FITS binary tables are not true R-tables since there is no
restriction against duplicated rows.  The simplest way to treat an
arbitrary FITS binary table as an R-table is to use the row number as a
`phantom' column in the R-table.  The row number then become the
primary key.

	Chris Flatters
	cflatter at nrao.edu