colour.kernel_nearest_neighbour#
- colour.kernel_nearest_neighbour(x: ArrayLike) NDArrayFloat[source]#
Return the nearest-neighbour kernel evaluated at specified samples.
The nearest-neighbour kernel is a discontinuous kernel function that equals 1 for samples within the range [-0.5, 0.5) and 0 elsewhere. This kernel represents the simplest interpolation method where each output value is determined by the closest input sample.
- Parameters:
x (ArrayLike) – Samples at which to evaluate the nearest-neighbour kernel.
- Returns:
The nearest-neighbour kernel evaluated at specified samples.
- Return type:
References
[BB09]
Examples
>>> kernel_nearest_neighbour(np.linspace(0, 1, 10)) array([1, 1, 1, 1, 1, 0, 0, 0, 0, 0])