colour.utilities.closest_indexes

colour.utilities.closest_indexes(a, b)[source]

Returns the \(a\) variable closest element indexes to reference \(b\) variable elements.

Parameters:
  • a (array_like) – Variable to search for the closest element indexes.
  • b (numeric) – Reference variable.
Returns:

Closest \(a\) variable element indexes.

Return type:

numeric

Examples

>>> a = np.array([24.31357115, 63.62396289, 55.71528816,
...               62.70988028, 46.84480573, 25.40026416])
>>> closest_indexes(a, 63)
array([3])
>>> closest_indexes(a, [63, 25])
array([3, 5])