select
compression_safeguards.safeguards.combinators.select
Logical selector (switch case) combinator safeguard.
Classes:
-
SelectSafeguard–The
SelectSafeguardguarantees that, for each element, the guarantees of
SelectSafeguard
SelectSafeguard(
*,
selector: int | str | Parameter,
safeguards: Collection[
dict[str, JSON]
| PointwiseSafeguard
| StencilSafeguard
],
)
Bases: Safeguard
The SelectSafeguard guarantees that, for each element, the guarantees of
the pointwise selected safeguard are upheld. This combinator allows
selecting between several safeguards with per-element granularity.
This combinator can be used to describe simple regions of interest where different safeguards, e.g. with different error bounds, are applied to different parts of the data.
At the moment, only pointwise and stencil safeguards and combinations thereof can be combined by this select-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, the selected safeguard succeed the check.
-
check_pointwise–Check for which elements the selected safeguard succeed the check.
-
compute_safe_intervals–Compute the safe intervals for the selected safeguard.
-
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 between which this combinator selects.
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, the selected safeguard 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 the selected safeguard succeed 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 safe intervals for the selected safeguard.
| 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: |
|---|