pyvista.core._validation.validate.validate_data_range#
- validate_data_range(rng: VectorLike[float], /, **kwargs)[source]#
Validate a data range.
By default, the data range is checked to ensure:
it has two values
it has real numbers
the lower bound is not more than the upper bound
- Parameters:
- rng
VectorLike[float] Range to validate in the form
(lower_bound, upper_bound).- **kwargs
dict,optional Additional keyword arguments passed to
validate_array().
- rng
- Returns:
tupleValidated range as
(lower_bound, upper_bound).
See also
validate_arrayGeneric array validation function.
Examples
Validate a data range.
>>> from pyvista import _validation >>> _validation.validate_data_range([-5, 5]) (-5, 5)
Add additional constraints if needed.
>>> _validation.validate_data_range([0, 1.0], must_be_nonnegative=True) (0.0, 1.0)