colour.utilities.in_array#

colour.utilities.in_array(a: ArrayLike, b: ArrayLike, tolerance: Real = EPSILON) ndarray[Any, dtype[_ScalarType_co]][source]#

Return whether each element of the array \(a\) is also present in the array \(b\) within given tolerance.

Parameters:
  • a (ArrayLike) – Array \(a\) to test the elements from.

  • b (ArrayLike) – The array \(b\) against which to test the elements of array \(a\).

  • tolerance (Real) – Tolerance value.

Returns:

A bool array with array \(a\) shape describing whether an element of array \(a\) is present in array \(b\) within given tolerance.

Return type:

numpy.ndarray

References

[Yor14]

Examples

>>> a = np.array([0.50, 0.60])
>>> b = np.linspace(0, 10, 101)
>>> np.in1d(a, b)
array([ True, False], dtype=bool)
>>> in_array(a, b)
array([ True,  True], dtype=bool)