sigpy.interpolate

sigpy.interpolate(input, coord, kernel='spline', width=2, param=1)[source]

Interpolation from array to points specified by coordinates.

Let \(x\) be the input, \(y\) be the output, \(c\) be the coordinates, \(W\) be the kernel width, and \(K\) be the interpolation kernel, then the function computes,

\[y[j] = \sum_{i : \| i - c[j] \|_\infty \leq W / 2} K\left(\frac{i - c[j]}{W / 2}\right) x[i]\]

There are two types of kernels: ‘spline’ and ‘kaiser_bessel’.

‘spline’ uses the cardinal B-spline functions as kernels. The order of the spline can be specified using param. For example, param=1 performs linear interpolation. Concretely, for param=0, \(K(x) = 1\), for param=1, \(K(x) = 1 - |x|\), and for param=2, \(K(x) = \frac{9}{8} (1 - |x|)^2\) for \(|x| > \frac{1}{3}\) and \(K(x) = \frac{3}{4} (1 - 3 x^2)\) for \(|x| < \frac{1}{3}\).

These function expressions are derived from the reference wikipedia page by shifting and scaling the range to -1 to 1. When the coordinates specifies a uniformly spaced grid, it is recommended to use the original scaling with width=param + 1 so that the interpolation weights add up to one.

‘kaiser_bessel’ uses the Kaiser-Bessel function as kernel. Concretely, \(K(x) = I_0(\beta \sqrt{1 - x^2})\), where \(I_0\) is the modified Bessel function of the first kind. The beta parameter can be specified with param. The modified Bessel function of the first kind is approximated using the power series, following the reference.

Parameters:
  • input (array) – Input array of shape.
  • coord (array) – Coordinate array of shape […, ndim]
  • width (float or tuple of floats) – Interpolation kernel full-width.
  • kernel (str) – Interpolation kernel, {‘spline’, ‘kaiser_bessel’}.
  • param (float or tuple of floats) – Kernel parameter.
Returns:

Output array.

Return type:

output (array)

References

https://en.wikipedia.org/wiki/Spline_wavelet#Cardinal_B-splines_of_small_orders http://people.math.sfu.ca/~cbm/aands/page_378.htm