bartorch.fermi_window

Contents

bartorch.fermi_window#

bartorch.fermi_window()#

Fermi apodization window over a centred k-space grid.

The kernel is

\[W(u) = \frac{1}{1 + e^{(u - r) / w}},\]

with \(u\) the k-space coordinate normalized per axis to zero at index n // 2 and one at the Nyquist edge, \(r\) the radius and \(w\) the width (Bernstein et al. [1]).

Parameters:
  • shape (tuple of int) – Grid shape, any number of axes.

  • radius (float, default=1.0) – Coordinate of the half-height, as a fraction of the Nyquist edge. At the default a radial window is exactly 0.5 at (k_max, 0).

  • width (float, default=None) – Transition width in the same coordinate. None is ten samples of the longest axis, 10 / (max(shape) // 2).

  • geometry ({"radial", "separable"}, default='radial') – "radial" evaluates the kernel on the Euclidean norm of the coordinates, an ellipsoid over the grid; "separable" multiplies the kernel along each axis, which retains more of the corners.

  • device (torch.device or str, default=None) – Device of the window.

Returns:

Real float32 window of shape shape.

Return type:

torch.Tensor

Raises:

ValueError – If width is not positive, geometry is neither value, or an axis is empty.

References

Examples

>>> window = fermi_window((256, 256))
>>> float(window[128, 128]), round(float(window[128, 0]), 3)
(1.0, 0.5)