In addition to the simple ``one FITS file per Spectrum'' mode, CLASS supports the Binary Table extension, in reading and writing. CLASS reads and processes all the Binary Table extension of the FITS file. The FITS keywords for the Binary Table format are similar to those of the simple Spectrum mode, but a complete set of spectra can be handled in a single binary table.
Keywords which would change from one spectrum to the next are handled as Binary columns of the table, with the TTYPEi FITS keyword holding the name of the corresponding simple FITS keyword. Reading such FITS files, CLASS will support any value for the TTYPEi keywords. If a column and a keyword have the same name, the column prevails. If several columns have the same name (try to avoid this), the last one prevails.
The spectra are handled in a SPECTRUM column.
Here is an example with a tiny primary Header Data Unit and a Binary Table extension header.
SIMPLE = T BITPIX = 8 NAXIS = 0 EXTEND = T BLOCKED = T ORIGIN = 'My observatory' CREATOR = 'Me ' END ... XTENSION= 'BINTABLE' BITPIX = 8 / Always 8. NAXIS = 2 / Always 2: tables have 2 dimensions. NAXIS1 = 7275 / Number of bytes per row. NAXIS2 = 4 / Number of rows. PCOUNT = 0 / Usually 0. GCOUNT = 1 / Always 1. TFIELDS = 18 / Number of columns. EXTNAME = 'MATRIX ' / Just a name, not important. EXTVER = 1 / Always 1. MAXIS = 4 / Number of dimensions in the data. MAXIS1 = 1793 / Dummy number of channels (see TTYPE1). MAXIS2 = 1 / MAXIS3 = 1 / MAXIS4 = 1 / CTYPE1 = 'FREQ ' / Dim1: freq => MAXIS1 = Nb channels. CRVAL1 = 0.0000000000000E+00 / Frequency offset, always 0. CDELT1 = 0.1000000000000E+07 / Frequency resolution [Hz]. CRPIX1 = 0.2565000000000E+03 / Dummy reference channel (see TTYPE18). CTYPE2 = 'RA ' CRVAL2 = 0.0000000000000E+00 CDELT2 = 0.0000000000000E+00 CRPIX2 = 0.0000000000000E+00 CTYPE3 = 'DEC ' CRVAL3 = 0.0000000000000E+00 CDELT3 = 0.0000000000000E+00 CRPIX3 = 0.0000000000000E+00 CTYPE4 = 'STOKES ' CRVAL4 = 0.0000000000000E+00 CDELT4 = 0.0000000000000E+00 CRPIX4 = 0.0000000000000E+00 SUBSCAN = 1 / Subscan number. Often 1. LINE = 'CS(5-4) ' / Name of your line, up to 12 chars. OBJECT = 'JUPITER ' / Name of your source, up to 12 chars. RESTFREQ= 0.2449356430000E+12 / Rest (signal) frequency at ref chan. VELO-HEL= 0.0000000000000E+00 / Velocity at ref. chan [m.s-1]. VELDEF = 'RADI-HEL' / Type of velocity. GAINIMAG= 0.9999999776483E-02 / Ratio Image/Signal. BEAMEFF = 0.8600000143051E+00 / Beam efficiency. FORWEFF = 0.8600000143051E+00 / Forward efficiency. EPOCH = 0.1950000000000E+04 / Epoch of coordinates. DATE-RED= '15/07/97' / Date of reduction. TTYPE1 = 'MAXIS1 ' / Number of channels for this spectrum. TFORM1 = '1J ' / [integer] TTYPE2 = 'SCAN ' / Scan number. TFORM2 = '1J ' / [integer] TTYPE3 = 'TELESCOP' / Name of your backend. TFORM3 = '12A ' / [Up to 12 characters] TTYPE4 = 'TSYS ' / System temperature. TFORM4 = '1E ' / [K] TTYPE5 = 'IMAGFREQ' / Image freq at ref channel. TFORM5 = '1E ' / [Hz] TTYPE5 = 'DELTAV ' / Velocity resolution. TFORM6 = '1E ' / [m.s-1] TTYPE7 = 'TAU-ATM ' / Atmospheric opacity. TFORM7 = '1E ' / [neper] TTYPE8 = 'MH2O ' / Water vapor content. TFORM8 = '1E ' / [mm] TTYPE9 = 'TOUTSIDE' / Atm temperature near the antenna. TFORM9 = '1E ' / [K] TTYPE10 = 'PRESSURE' / Atm pressure on the antenna. TFORM10 = '1E ' / [hPa] TTYPE11 = 'ELEVATIO' / Elevation. TFORM11 = '1E ' / [deg] TTYPE12 = 'AZIMUTH ' / Azimuth. TFORM12 = '1E ' / [deg] TTYPE13 = 'DATE-OBS' / Observing date. TFORM13 = '23A ' / 'dd/mm/yy' for ex. See below. TTYPE14 = 'UT ' / Universal time at start. TFORM14 = '1D ' / [s] TTYPE15 = 'LST ' / Sideral time at start. TFORM15 = '1D ' / [s] TTYPE16 = 'OBSTIME ' / Integration duration. TFORM16 = '1E ' / [s] TTYPE17 = 'SPECTRUM' / Your data. TFORM17 = '1793E ' / [K] TTYPE18 = 'CRPIX1 ' / Reference channel for this spectrum. TFORM18 = '1E ' / [real] END