The second part of every Basic FITS file is the binary data array itself. This section of the FITS file contains the image data described in the header. In Basic FITS, the binary data array consists of a single array of data. The first array value appears immediately following the end of the header; that is, the first byte of the data array occurs at byte 2881 in the FITS file.
A FITS binary data array is interpreted to be a byte stream; that is, bytes are read in the order that they occur in the file. The array values appear in sequence such that the array index varies most rapidly along NAXIS1, the array index along N AX IS 2 varies next most rapidly, and so on.
Consider an image in which pixel values are stored by reading sample by sample across and line by line down as words are read from a page, so that N AX IS1 is the number of samples in a line and NAXIS2 is the number of lines. The data are written into the binary array in the same order that someone would type them if he had to type the data on a sheet of paper.
The data in the array are stored as bytes in a format that is not necessarily the same as produced by today's software and hardware. The programmer is responsible for writing the data in the format specified by the Basic FITS standard.
If the range of pixel values to be stored in the FITS file does not match the range of integer values available, the program should scale and offset the data, and place the BZERO and BSCALE keywords in the file header.
8-bit Integer Data. Eight-bit integer data must be represented by unsigned binary integers contained in one byte. The integer is equal to the ASCII value of the byte. The range of values in 8-bit integer data is from 0 (00 hex) to 255 (FF hex).
16-bit Integer Data. Sixteen-bit integers must be twos-complement signed binary integers contained in two bytes, with the most significant byte first; that is, what programmers call "big-endian" numbers. Valid array values run from -32768 to +32767 decimal (8 000 to 7FFF hexadecimal).
Unsigned Integer BZERO = -32768.0 BSCALE = 1.0
Signed Integer BZERO = 0.0 BSCALE = 1.0
FITS Data Bytes (Hexadecimal)
Was this article helpful?