[AstroPy] pyfits query: how to include a bit mask?
jh at oobleck.astro.cornell.edu
Tue Oct 11 08:08:25 CDT 2005
Remember that FITS is the flexible image TRANSPORT system. Since your
problem is data size, you can convert the data as you like, encode as
FITS, store/transport, and re-convert into another FITS file. The
data are still self-documenting FITS even in their reduced state. I'm
not sure if this is any better than compressing the FITS images, but
it might be, for archival purposes.
Conversion ideas: pack the bits into bytes, use bitpix=8, and write
software that unpacks it on the fly. Or, since the flag image is
likely to have a lot of zeros, do run-length encoding (what's used for
faxes) on it and store it with any integer datatype you like. Then it
will store in practically no space.
Sounds like what FITS needs is a BITPIX=1 extension, and some
compression options. Sounds like what FITS needs is to be HDF...
More information about the AstroPy