Tiled Compression#


This module is in development (so marked as private), anything may change in future releases. This documentation is provided to aid in further development of this submodule and related functionality.

This module implements the compression and decompression algorithms, and associated functionality for FITS Tiled Image Compression. The goal of this submodule is to expose a useful Python API, which different functionality can be built on for reading these files.

The functionality is roughly split up into the following sections:

  1. Low level compression and decompression functions implemented in cfitsio (for all algorithms other than the GZIP ones, which use the Python stdlib).

  2. The quantize and dequantize functions from cfitsio.

  3. A Python C-API module which wraps all the compression and quantize cfitsio functions.

  4. numcodecs style Codec classes for each compression algorithms.

  5. compress_image_data and decompress_image_data_section functions which are called from CompImageHDU.

astropy.io.fits.hdu.compressed._tiled_compression Module#

This module contains low level helper functions for compressing and decompressing buffer for the Tiled Table Compression algorithms as specified in the FITS 4 standard.


compress_image_data(image_data, ...)

Compress the data in a CompImageHDU.


Decompress the data in a CompImageHDU.

astropy.io.fits.hdu.compressed._codecs Module#

This module contains the FITS compression algorithms in numcodecs style Codecs.



The FITS GZIP 1 compression and decompression algorithm.

Gzip2(*, itemsize)

The FITS GZIP2 compression and decompression algorithm.

Rice1(*, blocksize, bytepix, tilesize)

The FITS RICE1 compression and decompression algorithm.

PLIO1(*, tilesize)

The FITS PLIO1 compression and decompression algorithm.

HCompress1(*, scale, smooth, bytepix, nx, ny)

The FITS HCompress compression and decompression algorithm.


A dummy compression/decompression algorithm that stores the data as-is.

Class Inheritance Diagram#

Inheritance diagram of astropy.io.fits.hdu.compressed._codecs.Gzip1, astropy.io.fits.hdu.compressed._codecs.Gzip2, astropy.io.fits.hdu.compressed._codecs.Rice1, astropy.io.fits.hdu.compressed._codecs.PLIO1, astropy.io.fits.hdu.compressed._codecs.HCompress1, astropy.io.fits.hdu.compressed._codecs.NoCompress

astropy.io.fits.hdu.compressed._quantization Module#

This file contains the code for Quantizing / Dequantizing floats.


Quantize(*, row, dither_method, ...)

Quantization of floating-point data following the FITS standard.

Class Inheritance Diagram#

Inheritance diagram of astropy.io.fits.hdu.compressed._quantization.Quantize