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

Maurizio Panniello maurizio at iac.es
Tue Oct 11 09:25:14 CDT 2005

An idea can be to store the masks as png files (you can use PIL library 
or directly with ImageMagik )
Png compress very well uniform patterns so if your mask have large 
uniform zone can reach very high
compression factors.
When you have trasfered the png files (included in fits as data if you 
want) you can than retransform these in fits format and join with your 
data for analisis.

Joe Harrington wrote:

>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...
>AstroPy mailing list
>AstroPy at scipy.net

More information about the AstroPy mailing list