safeguards

compression_safeguards.safeguards

Implementations for the provided Safeguards.

Modules:

  • abc

    Abstract base class for the safeguards.

  • combinators

    Implementations for the provided safeguard combinators.

  • eb

    Error bounds that can be guaranteed by various safeguards.

  • pointwise

    Implementations for the provided PointwiseSafeguards.

  • qois

    Safeguarding Quantities of Interest

  • stencil

    Implementations for the provided StencilSafeguards.

Classes:

SafeguardKind

Bases: Enum

flowchart LR compression_safeguards.safeguards.SafeguardKind[SafeguardKind] click compression_safeguards.safeguards.SafeguardKind href "" "compression_safeguards.safeguards.SafeguardKind"

Enumeration of all supported safeguards:

Methods:

lossless class-attribute instance-attribute

lossless = LosslessSafeguard

All elements must be reconstructed exactly, i.e. losslessly.

same class-attribute instance-attribute

Enforce that a special value is exactly preserved.

sign class-attribute instance-attribute

Enforce that the sign (-1, 0, +1) of each element is preserved.

eb class-attribute instance-attribute

Enforce a pointwise error bound.

qoi_eb_pw class-attribute instance-attribute

Enforce an error bound on a pointwise derived quantity of interest.

qoi_eb_stencil class-attribute instance-attribute

Enforce an error bound on a derived quantity of interest over a data neighbourhood.

all class-attribute instance-attribute

Enforce that all of the inner safeguards' guarantees are met.

any class-attribute instance-attribute

Enforce that any one of the inner safeguards' guarantees are met.

assume_safe class-attribute instance-attribute

assume_safe = AssumeAlwaysSafeguard

All elements are assumed to always be safe.

select class-attribute instance-attribute

select = SelectSafeguard

Select, pointwise, which safeguard's guarantees to enforce.

from_config staticmethod

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

Instantiate a safeguard from a configuration dict.

The config must contain the safeguard's kind.

Parameters:
  • config (dict[str, JSON]) –

    Configuration of the safeguard.

Returns:
  • safeguard( Safeguard ) –

    Instantiated safeguard.

Raises:
  • ValueError

    if the config does not contain the safeguard kind or the kind is unknown.

  • TypeCheckError

    if the safeguard kind is not a string.

  • ...

    if instantiating the safeguard raises an exception.