pyvista.core._validation.check.check_integer

Contents

pyvista.core._validation.check.check_integer#

check_integer(
array: _ArrayLikeOrScalar[NumberType],
/,
*,
strict: bool = False,
name: str = 'Array',
) None[source]#

Check if an array has integer or integer-like float values.

Parameters:
arrayfloat | ArrayLike[float]

Number or array to check.

strictbool, default: False

If True, the array’s data must be a subtype of int or np.integer. Otherwise, floats are allowed but must be whole numbers.

namestr, default: “Array”

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

Raises:
ValueError

If any element’s value differs from its floor.

TypeError

If strict=True and the array’s dtype is not integral.

Examples

Check if an array has integer-like values.

>>> from pyvista import _validation
>>> _validation.check_integer([1.0, 2.0])