pyvista.core._validation.check.check_real

Contents

pyvista.core._validation.check.check_real#

check_real(array: _ArrayLikeOrScalar[NumberType], /, *, name: str = 'Array')[source]#

Check if an array has real numbers, i.e. float or integer type.

Parameters:
arrayfloat | ArrayLike[float]

Number or array to check.

namestr, default: “Array”

Variable name to use in the error messages if any are raised.

Raises:
TypeError

If the array does not have real numbers.

See also

check_integer

Similar function for integer arrays.

check_number

Similar function for scalar values.

check_finite

Check for finite values.

Notes

  • Boolean data types are not considered real and will raise an error.

  • Arrays with infinity or NaN values are considered real and will not raise an error. Use check_finite() to check for finite values.

Examples

Check if an array has real numbers.

>>> from pyvista import _validation
>>> _validation.check_real([1, 2, 3])