pyvista_validation.check.check_range#
- pyvista_validation.check.check_range(array: _ArrayLikeOrScalar[NumberType], /, rng: VectorLike[_NumberType], *, strict_lower: bool = False, strict_upper: bool = False, name: str = 'Array') None#
Check if an array’s values are all within a specific range.
- Parameters:
- arrayfloat | ArrayLike[float]
Number or array to check.
- rngVectorLike[float], optional
Vector with two elements
[min, max]specifying the minimum and maximum data values allowed, respectively. By default, the range endpoints are inclusive, that is, values must be >= min and <= max. Usestrict_lowerand/orstrict_upperto further restrict the allowable range. Usenp.infor-np.infto specify open intervals, e.g.[0, np.inf].- strict_lowerbool, default: False
Enforce a strict lower bound for the range, that is, array values must be strictly greater than the minimum.
- strict_upperbool, default: False
Enforce a strict upper bound for the range, that is, array values must be strictly less than the maximum.
- namestr, default: “Array”
Variable name to use in the error messages if any are raised.
- Raises:
- ValueError
If any array value is outside the specified range.
See also
Examples
Check if an array’s values are in the range ``[0, 1]`.
>>> from pyvista_validation import check_range >>> check_range([0, 0.5, 1], rng=[0, 1])