Skip to main content
`Ctrl`+`K`

# Bitround

class numcodecs.bitround.BitRound(keepbits: int)

  Floating-point bit rounding codec

  Drops a specified number of bits from the floating point mantissa, leaving an array more amenable to compression. The number of bits to keep should be determined by an information analysis of the data to be compressed. The approach is based on the paper by Klöwer et al. 2021 (https://www.nature.com/articles/s43588-021-00156-2). See zarr-developers/numcodecs#298 for discussion and the original implementation in Julia referred to at milankl/BitInformation.jl

  Parameters:
    keepbits: int

      The number of bits of the mantissa to keep. The range allowed depends on the dtype input data. If keepbits is equal to the maximum allowed for the data type, this is equivalent to no transform.

  codec_id: str | None = 'bitround'

    Codec identifier.

  encode(buf)

    Create int array by rounding floating-point data

    The itemsize will be preserved, but the output should be much more compressible.

  decode(buf, out=None)

    Remake floats from ints

    As with `encode`, preserves itemsize.

  get_config()

    Return a dictionary holding configuration parameters for this codec. Must include an ‘id’ field with the codec identifier. All values must be compatible with JSON encoding.

  classmethod from_config(config)

    Instantiate codec from a configuration object.