colour.utilities.closest¶
-
colour.utilities.
closest
(a, b)[source]¶ Returns the \(a\) variable closest elements to reference \(b\) variable elements.
Parameters: - a (array_like) – Variable to search for the closest elements.
- b (numeric) – Reference variable.
Returns: Closest \(a\) variable elements.
Return type: numeric
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])