compute

numcodecs_safeguards.compute

Helper classes for configuring the compute behaviour of the SafeguardedCodec.

Classes:

  • Compute

    Compute configuration with options that may affect the compression

Compute dataclass

Compute(
    *,
    unstable_iterative: bool = False,
    unstable_lossless_corrections: bool = False,
)

Compute configuration with options that may affect the compression ratio and time cost of computing the safeguards corrections.

While these options can change the particular corrections that are produced, the resulting corrections always satisfy the safety requirements.

Some configuration options are unstable, i.e. they should not be relied upon in production code since they might be removed or changed without a breaking major version bump.

Methods:

unstable_iterative class-attribute instance-attribute

unstable_iterative: bool = False

Unstable option to use an iterative algorithm that can reduce the number of corrections that need to be applied, which can improve the compression ratio at the cost of requiring additional time to compute the corrections.

unstable_lossless_corrections class-attribute instance-attribute

unstable_lossless_corrections: bool = False

Unstable option to compute lossless corrections that reproduce the original data exactly.

If lossless corrections are used without iterative corrections, all data elements will be corrected (whether or not they need corrections).

get_config

get_config() -> dict[str, JSON]

Returns the compute configuration.

Returns:

from_config classmethod

from_config(config: dict[str, JSON]) -> Self

Instantiate the compute configuration from a dict.

Parameters:
Returns:
  • safeguards( Self ) –

    Instantiated compute configuration.