Subject: Re: HELP! FTS format and IDL input

From: [email-masked] (Don Wells)
Date: Wed, 13 Apr 1994 04:07:34 GMT

In article <[email-masked]>
    [email-masked] (Gregory Bearman) writes:
    ".. I am looking for information on the first 2880 bytes of the
    FTS format so I can extract the header information from my files.
    I need to be able to read it, not just skip over it to get to the
    data file itself.."

These must be FITS [Flexible Image Transport System] files.  FITS
headers are ASCII text, 80 characters per line, 36 lines per 2880 byte
logical record. If you are an Emacs user, take a look at a FITS
header; it is in keyword=value style, and for a simple FITS file you
can probably guess the meanings of the keywords. Beware of the
assumption that the headers of FITS files are always a single
2880-byte logical record; FITS headers can be arbitrarily long, and
your code must read until it sees the 'END' keyword.  If you have
Mosaic, look at URL

                http://fits.cv.nrao.edu/

In particular, the definitive answers to your questions are in the file

     file://fits.cv.nrao.edu/fits/documents/standards/fits_standard.ps

Finally, you can post queries to newsgroup sci.astro.fits, the place
where the worldwide FITS user community meets to talk about FITS.
--
  Donald C. Wells         Associate Scientist         [email-masked]
                    http://fits.cv.nrao.edu/~dwells
  National Radio Astronomy Observatory                +1-804-296-0277
  520 Edgemont Road,   Charlottesville, Virginia       22903-2475 USA

---

From: [email-masked] (Brian R Hunt)
Date: 12 Apr 1994 21:24:15 -0700

Gregory Bearman ([email-masked]) wrote:
: I am looking for information on the first 2880 bytes of the FTS format so I 
: can extract the header information from my files.  I need to be able to read 
: it, not just skip over it to get to the data file itself.

This info is from "Graphics File Formats" by Kay and Levine; ISBN 
0-8306-3059-7:

FITS files is blocked in 2880 byte records.  The file starts with header 
records each of which is 36 80 byte ASCII card images (2880 bytes!).  
Note that there can be more than one header record of 36 card images.  
Each card consists of a key word starting in column 1.  Keywords consist 
of uppercase letters, digits, underscores and hyphens.  If the card 
assigns a value to the keyword, column nine contains an equal sign. i.e. 
all keywords are nine characters or less.  Character values are enclosed 
in single quotes ''.  Strings must  be atleast 8 characters long 
excluding the quotes, padded with blanks if needed.  Numeric values are 
right justified with the last character in column 30.  For complex 
values, the imaginary part of the number is right justified with the last 
character in column 50.  Floating point values must contain a decimal 
point.  a signed exponent can be included following a D or E.

There are four mandatory keywords:
SIMPLE  =                       T / indicates file conforms to FITS format
BITPIX  =                      16 / FITS bits per pixel
NAXIS   =                       2 / number of axes (x, y in this case)
NAXIS1  =                     512 / indicats a 512 x 512 image
NAXIS2  =                     512 /
.
.
END   

There a lot of other optional keywords and some that are specially 
defined depending on the source.  

commments may be included after a / character in column 10 or after the 
value.  END must appear on a card by itself. If there are not 36 cards in 
the header (or modulo 36) then the rest of the 2880 must be filled with 
blanks.  

Data records, each 2880 bytes follow the header record.  The image data 
is padded with zeros to fill out the last 2880 byte record.

There is a NASA/OSSA Office of Standards and Technology reference in the 
book:  Implementation of the Flexible Image Transport System.  Draft 
Standard NOST 100-0.3b. Greenbelt, MD.  GSFC.  November 6, 1991.  
Probably has the formal definition in it.  

I haven't implemented FITS software based on the book, but I've used 
their other format descriptions and they worked ok.

Good luck!

Brian Hunt
Half Moon Bay, CA