nearest_interp
- sherpa.utils.nearest_interp(xout, xin, yin)[source] [edit on github]
Nearest-neighbor one-dimensional interpolation.
- Parameters:
- xoutarray_like
The positions at which to interpolate.
- xinarray_like
The x values of the data to interpolate. This must be sorted so that it is monotonically increasing.
- yinarray_like
The y values of the data to interpolate (must be the same size as
xin).
- Returns:
See also
Examples
>>> import numpy as np >>> x = np.asarray([1.2, 3.4, 4.5, 5.2]) >>> y = np.asarray([12.2, 14.4, 16.8, 15.5]) >>> xgrid = np.linspace(2, 5, 5) >>> ygrid = nearest_interp(xgrid, x, y)