[AstroPy] Creating Rice compressed fits files
Thu Jun 11 10:39:29 CDT 2009
To create a compressed image HDU from scratch, simply construct a CompImageHDU object from an uncompressed image data array and its associated image header. From there, the HDU can be treated just like any image HDU.
For example if you have an uncompressed HDU with the name uncompHDU you could do the following:
>>> compHDU = pyfits.CompImageHDU(uncompHDU.data, uncompHDU.Header)
Then you can write it out to a file with:
The help on CompImageHDU will give you lots of gory details about the CompImageHDU initializer including some options that effect the compression. Note that RICE is the default compression method used.
I hope this helps,
More information about the AstroPy