any
compression_safeguards.safeguards.combinators.any
Logical any (or) combinator safeguard.
Classes:
-
AnySafeguard–The
AnySafeguardguarantees that, for each element, at least one of the
AnySafeguard
AnySafeguard(
*,
safeguards: Collection[
dict[str, JSON]
| PointwiseSafeguard
| StencilSafeguard
],
)
Bases: Safeguard
The AnySafeguard guarantees that, for each element, at least one of the
combined safeguards' guarantees is upheld.
At the moment, only pointwise and stencil safeguards and combinations thereof can be combined by this any-combinator. The combinator is a pointwise or a stencil safeguard, depending on the safeguards it combines.
| Parameters: |
|
|---|
| Raises: |
|
|---|
Methods:
-
check–Check if, for all elements, any of the combined safeguards succeed the
-
check_pointwise–Check for which elements at least one of the combined safeguards
-
compute_safe_intervals–Compute the union of the safe intervals of the combined safeguards,
-
compute_footprint–Compute the footprint of the
footarray, e.g. for expanding data -
compute_inverse_footprint–Compute the inverse footprint of the
footarray, e.g. for expanding -
get_config–Returns the configuration of the safeguard.
safeguards
property
safeguards: tuple[
PointwiseSafeguard | StencilSafeguard, ...
]
The set of safeguards that this any combinator has been configured to uphold.
late_bound
property
The set of late-bound parameters that this safeguard has.
Late-bound parameters are only bound when checking and applying the safeguard, in contrast to the normal early-bound parameters that are configured during safeguard initialisation.
Late-bound parameters can be used for parameters that depend on the specific data that is to be safeguarded.
check
check(
data: ndarray[S, dtype[T]],
approximation: ndarray[S, dtype[T]],
*,
late_bound: Bindings,
where: Literal[True] | ndarray[S, dtype[bool]] = True,
) -> bool
Check if, for all elements, any of the combined safeguards succeed the check.
| Parameters: |
|
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
check_pointwise
check_pointwise(
data: ndarray[S, dtype[T]],
approximation: ndarray[S, dtype[T]],
*,
late_bound: Bindings,
where: Literal[True] | ndarray[S, dtype[bool]] = True,
) -> ndarray[S, dtype[bool]]
Check for which elements at least one of the combined safeguards succeeds the check.
| Parameters: |
|
|---|
| Returns: |
|---|
| Raises: |
|
|---|
compute_safe_intervals
compute_safe_intervals(
data: ndarray[S, dtype[T]],
*,
late_bound: Bindings,
where: Literal[True] | ndarray[S, dtype[bool]] = True,
) -> IntervalUnion[T, int, int]
Compute the union of the safe intervals of the combined safeguards, i.e. where at least one is safe.
| Parameters: |
|
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
compute_footprint
compute_footprint(
foot: ndarray[S, dtype[bool]],
*,
late_bound: Bindings,
where: Literal[True] | ndarray[S, dtype[bool]] = True,
) -> ndarray[S, dtype[bool]]
Compute the footprint of the foot array, e.g. for expanding data
points into the pointwise checks that they contribute to.
| Parameters: |
|
|---|
| Returns: |
|---|
compute_inverse_footprint
compute_inverse_footprint(
foot: ndarray[S, dtype[bool]],
*,
late_bound: Bindings,
where: Literal[True] | ndarray[S, dtype[bool]] = True,
) -> ndarray[S, dtype[bool]]
Compute the inverse footprint of the foot array, e.g. for expanding
pointwise check fails into the points that could have contributed to
the failures.
| Parameters: |
|
|---|
| Returns: |
|---|