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])
>>> print(closest_indexes(a, 63))
[3]
>>> print(closest_indexes(a, [63, 25]))
[3 5]