next up previous contents index
Next: Once FITS Always FITS Up: BINTABLE Mode Previous: Known keywords   Contents   Index

Known columns and data storage

Most of the keywords described above can be used as column names. The value contained in the column prevails on the value contained in the Keyword. This can be useful if you need to store spectra with different lengths in your table: You can use a column named MAXIS1 containing the number of channels for each spectrum of the table (the trailing bytes requiered to fill the DATA column will be ignored then).

Here is the list of authorized column names which can also be keywords: DATAMAX, DATAMIN, MAXISi, CRVALi, CRPIXi, CDELTi, BEAMEFF, FORWEFF or ETAFSS, GAINIMAG, MH2O, PRESSURE, TOUTSIDE, AZIMUTH, ELEVATIO, DATE-OBS or DATE_OBS, DATE-RED or DATE_RED or DATE, SCAN or SCAN-NUM or SCAN_NUM, SUBSCAN, LST, UT or UTC, TAU-ATM or TAU_ATM, TELESCOP, OBSTIME or EXPOSURE, TSYS, EPOCH or EQUINOX, OBJECT, IMAGFREQ, LINE, RESTFREQ, VELOCITY, VELDEF, VELO-LSR or VLSR, VELO-OBS or VELO-TOP, VELO-HEL, VELO-EAR or VELO-GEO, DELTAV or DELTAVEL.

The following names are exclusively used for columns because their value (your data) can not be factorized

MATRIX or SPECTRUM or SERIES or DATA
The spectra intensities. Unit: [K]. This is the only mandatory column. Indeed, why would we make a FITS file without any spectrum? This column must also be unique, i.e. only one data column per binary table. The number of elements of this column, specified in TFORM, depends on the way you want to store your data (Fixed or Variable Length Arrays). More explanations are available below
WAVE
Frequency of each channel. Unit: [Hz]. This column is optional. If it is present, the spectra is considered as ``irregularly sampled'': each channel has its own frequency and the frequency axis description; In other words, the RESTFREQ, CDELTi, CRVALi) keyword are not used at all even when present. MAXISi is still used, since it gives the number of channels. If this column is absent, then the frequency axis will be described in the usual way.
Both the SPECTRUM and WAVE columns must have the same number of elements to obtain a meaningful result. Those columns may either be filled with
Fixed Length Arrays
This may be the easiest way to store the data but it may waste a lot of space if you have spectra with different number of channels. The steps are:
  1. Description of the data column.
    1. First, chose a precision: E for single precision floating point number (4 bytes), D for double precision floating point number (8 bytes).
    2. Second, browse your collection of spectra to find the one with the highest number of channels (for example, 1793).
    3. Now you can give TFORMi the value 1793E:
        TTYPE17 = 'SPECTRUM'
        TFORM17 = '1793E   '
      
  2. Description of the number-of-channel column. If your collection of spectra contains spectra with different sizes, then you must specify the number of channels of each spectrum. To do that, you have to use a column MAXISi. i corresponds to the number of your frequency/wavelength/velocity axis: usually 1.
      TTYPE1  = 'MAXIS1  '
      TFORM1  = '1J      '
    
    The values stored in this column will override the value given to the keyword MAXIS1 at the beginning of the bintable header. If all your spectra have the same number of channels, then you don't need a MAXISi column. But make sure the MAXISi keyword at the beginning of the bintable header has the correct value, which is the number of channels of your spectra.
  3. Description of the reference channel. You may like to chose the middle of your spectra to be the reference for frequencies. If you have spectra with different sizes, then the reference channels may be different for each spectrum. To override the value of the CRPIX1 keyword, you must use a CRPIX1 column.
      TTYPE18 = 'CRPIX1  '
      TFORM18 = '1E      '
    
    If your reference channel is always the first one, you can forget about this column and give the value 1 to the CRPIX1 keyword.
  4. Filling the olumns. When it comes to fill the column with the data, make sure you are always storing 1793 (for example) elements. If you are to store a spectrum with only 512 channels, then store those 512 elements and pad with 1281 zeroes (single or double precision zeroes, not bytes). You can see here the waste of space when you have a significant amount of spectra much smaller that the widest one.
Variable Length Arrays
To save space and avoid filling half of your data columns with padding zeroes, you can use the Variable Length Array format described in the FITS standard (Definition of the Flexible Image Transport System, version 2.1b, section 8.3.5).

The idea is not to store the data directly in the bintable records, but in the heap area located after the bintable. In the SPECTRUM or WAVE column, you will find an Array Descriptor which basically consists in a pointer to a location in this heap area (an offset), and a number of elements to read. By doing this, no padding is required any longer. The FITS standart defines two kinds of Array Descriptors: P (two 32bits unsigned integers values) and Q (two 64 bits unsigned integers values). CLASS only handles P.

You will not need a MAXIS1 column in this case, since the number of channels is written in the SPECTUM column. You may still need a CRPIX1 column to define your reference channels.


next up previous contents index
Next: Once FITS Always FITS Up: BINTABLE Mode Previous: Known keywords   Contents   Index
Gildas manager 2024-03-29