Interpolation
Differentiable interpolation (ungridding) and adjoint interpolation (gridding) functions.
torchlinops.functional.interpolate
interpolate(
vals: Inexact[Tensor, ...],
locs: Float[Tensor, "... D"],
width: float | tuple[float, ...],
kernel="kaiser_bessel",
norm: int = 1,
pad_mode: str = "circular",
kernel_params: dict = None,
)
Interpolate from a regular grid to scattered locations (ungridding).
Evaluates values on a uniform grid at arbitrary non-uniform locations using kernel-based interpolation. This is the forward NUFFT interpolation step. Gradients are computed via the adjoint (gridding) operation.
| PARAMETER | DESCRIPTION |
|---|---|
vals
|
Values on a regular grid. The last
TYPE:
|
locs
|
Non-uniform target locations, with coordinates in the range
TYPE:
|
width
|
Interpolation kernel width (in grid units) for each spatial dimension. A scalar applies the same width to all dimensions.
TYPE:
|
kernel
|
Interpolation kernel type. Default is
TYPE:
|
norm
|
Kernel normalization order. Default is 1.
TYPE:
|
pad_mode
|
Padding mode for out-of-bounds access. Default is
TYPE:
|
kernel_params
|
Additional parameters passed to the interpolation kernel
(e.g.,
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Interpolated values at the non-uniform locations. |
Source code in src/torchlinops/functional/_interp/interp.py
torchlinops.functional.interpolate_adjoint
interpolate_adjoint(
vals: Inexact[Tensor, ...],
locs: Float[Tensor, "... D"],
grid_size: tuple[int, ...],
width: float | tuple[float, ...],
kernel: str = "kaiser_bessel",
norm: int = 1,
pad_mode: str = "circular",
kernel_params: dict = None,
)
Adjoint of interpolation (gridding) from scattered locations to a regular grid.
Scatters values from non-uniform locations back onto a regular grid
using kernel-based gridding. This is the adjoint of the interpolate
operation and corresponds to the gridding step in an adjoint NUFFT.
| PARAMETER | DESCRIPTION |
|---|---|
vals
|
Values at non-uniform locations to be gridded.
TYPE:
|
locs
|
Non-uniform source locations, with coordinates in the range
TYPE:
|
grid_size
|
Output grid size for each spatial dimension.
TYPE:
|
width
|
Interpolation kernel width (in grid units) for each spatial dimension. A scalar applies the same width to all dimensions.
TYPE:
|
kernel
|
Interpolation kernel type. Default is
TYPE:
|
norm
|
Kernel normalization order. Default is 1.
TYPE:
|
pad_mode
|
Padding mode for out-of-bounds access. Default is
TYPE:
|
kernel_params
|
Additional parameters passed to the interpolation kernel
(e.g.,
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Gridded values on a regular grid of shape |