pyvista.core._validation.validate.validate_data_range

pyvista.core._validation.validate.validate_data_range#

validate_data_range(rng, /, **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:
rngarray_like[float, float]

Range to validate in the form (lower_bound, upper_bound).

**kwargsdict, optional

Additional keyword arguments passed to validate_array().

Returns:
tuple

Validated range as (lower_bound, upper_bound).

See also

validate_array

Generic 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)