mrpro.utils.interp

mrpro.utils.interp(x: Tensor, xp: Tensor, fp: Tensor) Tensor[source]

One-dimensional linear interpolation for monotonically increasing sample points.

Implements numpy.interp

Evaluates the function at the given coordinates x based on the known points (xp, fp). Out-of-bounds values are clamped to fp[0] and fp[-1], matching the default behavior of numpy.interp.

Parameters:
  • x (Tensor) – The x-coordinates at which to evaluate the interpolated values.

  • xp (Tensor) – 1d tensor of x coordinates of data points. The tensor will be sorted internally. If called repeatedly, it is recommended to sort the tensor once and pass it in.

  • fp (Tensor) – 1d tensor of y coordinates matching the length of xp.

Returns:

The interpolated values matching the shape of x.