reciprocal_grid

odl.trafos.util.ft_utils.reciprocal_grid(grid, shift=True, axes=None, halfcomplex=False)[source]

Return the reciprocal of the given regular grid.

This function calculates the reciprocal (Fourier/frequency space) grid for a given regular grid defined by the nodes:

x[k] = x[0] + k * s,

where k = (k[0], ..., k[d-1]) is a d-dimensional index in the range 0 <= k < N (component-wise). The multi-index N is the shape of the input grid. This grid’s reciprocal is then given by the nodes:

xi[j] = xi[0] + j * sigma,

with the reciprocal grid stride sigma = 2*pi / (s * N). The minimum frequency xi[0] can in principle be chosen freely, but usually it is chosen in a such a way that the reciprocal grid is centered around zero. For this, there are two possibilities:

  1. Make the grid point-symmetric around 0.

  2. Make the grid “almost” point-symmetric around zero by shifting it to the left by half a reciprocal stride.

In the first case, the minimum frequency (per axis) is given as:

xi_1[0] = -pi/s + pi/(s*n) = -pi/s + sigma/2.

For the second case, it is:

xi_1[0] = -pi / s.

Note that the zero frequency is contained in case 1 for an odd number of points, while for an even size, the second option guarantees that 0 is contained.

If a real-to-complex (half-complex) transform is to be computed, the reciprocal grid has the shape M[i] = floor(N[i]/2) + 1 in the last transform axis i.

Parameters
griduniform RectGrid

Original sampling grid,.

shiftbool or sequence of bools, optional

If True, the grid is shifted by half a stride in the negative direction. With a sequence, this option is applied separately on each axis.

axesint or sequence of ints, optional

Dimensions in which to calculate the reciprocal. The sequence must have the same length as shift if the latter is given as a sequence. None means all axes in grid.

halfcomplexbool, optional

If True, return the half of the grid with last coordinate less than zero. This is related to the fact that for real-valued functions, the other half is the mirrored complex conjugate of the given half and therefore needs not be stored.

Returns
reciprocal_griduniform RectGrid

The reciprocal grid.