scipp.isclose¶
- scipp.isclose(x, y, *, rtol=None, atol=None, equal_nan=False)¶
Compares values (x, y) element by element against absolute and relative tolerances (non-symmetric).
abs(x - y) <= atol + rtol * abs(y)
If both x and y have variances, the variances are also compared between elements. In this case, both values and variances must be within the computed tolerance limits. That is:
abs(x.value - y.value) <= atol + rtol * abs(y.value) and abs(sqrt(x.variance) - sqrt(y.variance)) <= atol + rtol * abs(sqrt(y.variance))
- Parameters
x (scipp._scipp.core.Variable) – Left input.
y (scipp._scipp.core.Variable) – Right input.
rtol (Optional[scipp._scipp.core.Variable]) – Tolerance value relative (to y). Can be a scalar or non-scalar. Defaults to scalar 1e-5 if unset.
atol (Optional[scipp._scipp.core.Variable]) – Tolerance value absolute. Can be a scalar or non-scalar. Defaults to scalar 1e-8 if unset and takes units from y arg.
equal_nan (bool) – if true, non-finite values at the same index in (x, y) are treated as equal. Signbit must match for infs.
- Returns
Variable same size as input. Element True if absolute diff of value <= atol + rtol * abs(y), otherwise False.
- Seealso
scipp.allclose()
: isclose applied over all dimensions- Return type