numcodecs_wasm_fixed_offset_scale

Classes:

  • FixedOffsetScale

    Fixed offset-scale codec which calculates \(c = \frac{x - o}{s}\) on

FixedOffsetScale

FixedOffsetScale(offset, scale, _version='1.0.0')

Fixed offset-scale codec which calculates \(c = \frac{x - o}{s}\) on encoding and \(d = (c \cdot s) + o\) on decoding.

  • Setting \(o = \text{mean}(x)\) and \(s = \text{std}(x)\) normalizes that data.
  • Setting \(o = \text{min}(x)\) and \(s = \text{max}(x) - \text{min}(x)\) standardizes the data.

The codec only supports floating point numbers.

Parameters:
  • offset (...) –

    The offset of the data.

  • scale (...) –

    The scale of the data.

  • _version (..., default: = "1.0.0" ) –

    The codec's encoding format version. Do not provide this parameter explicitly.

Methods:

  • decode

    Decode the data in buf.

  • encode

    Encode the data in buf.

  • from_config

    Instantiate the codec from a configuration dict.

  • get_config

    Returns the configuration of the codec.

codec_id class-attribute instance-attribute

codec_id = 'fixed-offset-scale.rs'

decode

decode(buf, out=None)

Decode the data in buf.

Parameters:
  • buf (Buffer) –

    Encoded data. May be any object supporting the new-style buffer protocol.

  • out (Buffer, default: None ) –

    Writeable buffer to store decoded data. N.B. if provided, this buffer must be exactly the right size to store the decoded data.

Returns:
  • dec( Buffer ) –

    Decoded data. May be any object supporting the new-style buffer protocol.

encode

encode(buf)

Encode the data in buf.

Parameters:
  • buf (Buffer) –

    Data to be encoded. May be any object supporting the new-style buffer protocol.

Returns:
  • enc( Buffer ) –

    Encoded data. May be any object supporting the new-style buffer protocol.

from_config classmethod

from_config(config)

Instantiate the codec from a configuration dict.

Parameters:
  • config (dict) –

    Configuration of the codec.

Returns:
  • codec( Self ) –

    Instantiated codec.

get_config

get_config()

Returns the configuration of the codec.

numcodecs.registry.get_codec(config) can be used to reconstruct this codec from the returned config.

Returns:
  • config( dict ) –

    Configuration of the codec.