colour.utilities.closest#
- colour.utilities.closest(a: ArrayLike, b: ArrayLike) ndarray[Any, dtype[_ScalarType_co]] [source]#
Return the closest array \(a\) elements to the reference array \(b\) elements.
- Parameters:
a (ArrayLike) – Array \(a\) to search for the closest element.
b (ArrayLike) – Reference array \(b\).
- Returns:
Closest array \(a\) elements.
- Return type:
Examples
>>> a = np.array( ... [ ... 24.31357115, ... 63.62396289, ... 55.71528816, ... 62.70988028, ... 46.84480573, ... 25.40026416, ... ] ... ) >>> closest(a, 63) array([ 62.70988028]) >>> closest(a, [63, 25]) array([ 62.70988028, 25.40026416])