pyvista.core._validation.check.check_range

目次

pyvista.core._validation.check.check_range#

check_range(
array: _ArrayLikeOrScalar[NumberType],
/,
rng: VectorLike[_NumberType],
*,
strict_lower: bool = False,
strict_upper: bool = False,
name: str = 'Array',
) None[ソース]#

配列の値がすべて特定の範囲内にあるかどうかをチェックします.

パラメータ:
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, i.e. values must be >= min and <= max. Use strict_lower and/or strict_upper to further restrict the allowable range. Use np.inf or -np.inf to specify open intervals, e.g. [0, np.inf].

strict_lowerbool, default: False

範囲の厳密な下限を強制する,つまり配列の値は厳密に最小値より大きくなければなりません.

strict_upperbool, default: False

範囲の厳密な上限を強制する,つまり配列の値は厳密に最大値より小さくなければなりません.

namestr, default: "Array"

エラーメッセージが発生した場合に使用する変数名.

エラー処理:
ValueError

配列の値が指定範囲外の場合.

配列の値が [0, 1] の範囲にあるかどうかをチェックします.

>>> from pyvista import _validation
>>> _validation.check_range([0, 0.5, 1], rng=[0, 1])