PackBits¶
-
class
numcodecs.packbits.
PackBits
¶ Codec to pack elements of a boolean array into bits in a uint8 array.
Notes
The first element of the encoded array stores the number of bits that were padded to complete the final byte.
Examples
>>> import numcodecs as codecs >>> import numpy as np >>> codec = codecs.PackBits() >>> x = np.array([True, False, False, True], dtype=bool) >>> y = codec.encode(x) >>> y array([ 4, 144], dtype=uint8) >>> z = codec.decode(y) >>> z array([ True, False, False, True], dtype=bool)
-
codec_id
= 'packbits'¶
-