Rice1#
- class astropy.io.fits.hdu.compressed._codecs.Rice1(*, blocksize: int, bytepix: int, tilesize: int)[source]#
Bases:
Codec
The FITS RICE1 compression and decompression algorithm.
The Rice algorithm [1] is simple and very fast It requires only enough memory to hold a single block of 16 or 32 pixels at a time. It codes the pixels in small blocks and so is able to adapt very quickly to changes in the input image statistics (e.g., Rice has no problem handling cosmic rays, bright stars, saturated pixels, etc.).
- Parameters:
- blocksize
The blocksize to use, each tile is coded into blocks a number of pixels wide. The default value in FITS headers is 32 pixels per block.
- bytepix
The number of 8-bit buffer in each original integer pixel value.
References
[1]Rice, R. F., Yeh, P.-S., and Miller, W. H. 1993, in Proc. of the 9th AIAA Computing in Aerospace Conf., AIAA-93-4541-CP, American Institute of Aeronautics and Astronautics [https://doi.org/10.2514/6.1993-4541]
Attributes Summary
Methods Summary
decode
(buf)Decompress buffer using the RICE_1 algorithm.
encode
(buf)Compress the data in the buffer using the RICE_1 algorithm.
Attributes Documentation
- codec_id = 'FITS_RICE1'#
Methods Documentation
- decode(buf)[source]#
Decompress buffer using the RICE_1 algorithm.
- Parameters:
- buf
bytes
or array_like The buffer to decompress.
- buf
- Returns:
- buf
np.ndarray
The decompressed buffer.
- buf
- encode(buf)[source]#
Compress the data in the buffer using the RICE_1 algorithm.
- Parameters:
- buf
bytes
or array_like The buffer to compress.
- buf
- Returns:
bytes
The compressed bytes.