same
compression_safeguards.safeguards.pointwise.same
Same value safeguard.
Classes:
-
SameValueSafeguard–The
SameValueSafeguardguarantees that if an element has a special
SameValueSafeguard
Bases: PointwiseSafeguard
The SameValueSafeguard guarantees that if an element has a special
value in the input, that element also has bitwise the same value in the
decompressed output.
This safeguard can be used for preserving e.g. zero values, missing values, pre-computed extreme values, or any other value of importance.
By default, elements that do not have the special value in the input
may still have the value in the output. Enabling the exclusive flag
enforces that an element in the output only has the special value if and
only if it also has the value in the input, e.g. to ensure that only
missing values in the input have the missing value bitpattern in the
output.
Beware that +0.0 and -0.0 are semantically equivalent in floating-point but have different bitwise patterns. To preserve both, two same value safeguards are needed, one for each bitpattern.
| Parameters: |
|---|
| Raises: |
|
|---|
Methods:
-
check_pointwise–Check which elements preserve the special
valuefrom thedatato -
compute_safe_intervals–Compute the intervals in which the same value guarantee is upheld with
-
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.
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_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 which elements preserve the special value from the data to
the approximation array.
| 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 intervals in which the same value guarantee is upheld with
respect to the data.
| 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.
The footprint is equivalent to foot & where.
| 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.
The inverse footprint is equivalent to foot & where.
| Parameters: |
|
|---|
| Returns: |
|---|