[AstroPy] pyfits query: how to include a bit mask?

Phil Hodge hodge at stsci.edu
Tue Oct 11 08:37:24 EDT 2005


Russell,

> If I add an extension then it will have to be at least 16 bits/pixel, 
> right? The two masks I want to add are only 1 bit/pixel each (I could 
> combine them into one, but they'd just have to be separated out again 
> at the other end).


No, a FITS image can be eight bits (unsigned) per pixel, BITPIX = 8.
You could use a zero value to mean the pixel is good, 1 to mean "is
saturated," and 2 to mean "ignore this pixel," for example.  Since
those are distinct bits in the pixel, they are easily separated, e.g.
(dq & 1) is 1 if the pixel is saturated, and (dq & 2) is true if the
pixel should be ignored.  You would then be using 1/4 of the data
volume in the data quality image.

Phil



More information about the AstroPy mailing list