colour.utilities.in_array

colour.utilities.in_array(a, b, tolerance=2.2204460492503131e-16)[source]

Tests whether each element of an array is also present in a second array within given tolerance.

Parameters
  • a (array_like) – Array to test the elements from.

  • b (array_like) – The values against which to test each value of array a.

  • tolerance (numeric, optional) – Tolerance value.

Returns

A boolean array with a shape describing whether an element of a is present in b within given tolerance.

Return type

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)