realspace_grid

odl.trafos.util.ft_utils.realspace_grid(recip_grid, x0, axes=None, halfcomplex=False, halfcx_parity='even')[source]

Return the real space grid from the given reciprocal grid.

Given a reciprocal grid:

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

with a multi-index j = (j[0], ..., j[d-1]) in the range 0 <= j < M, this function calculates the original grid:

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

by using a provided x[0] and calculating the stride s.

If the reciprocal grid is interpreted as coming from a usual complex-to-complex FFT, it is N == M, and the stride is:

s = 2*pi / (sigma * N)

For a reciprocal grid from a real-to-complex (half-complex) FFT, it is M[i] = floor(N[i]/2) + 1 in the last transform axis i. To resolve the ambiguity regarding the parity of N[i], the it must be specified if the output shape should be even or odd, resulting in:

odd : N[i] = 2 * M[i] - 1
even: N[i] = 2 * M[i] - 2

The output stride is calculated with this N as above in this case.

Parameters
recip_griduniform RectGrid

Sampling grid in reciprocal space.

x0array-like

Desired minimum point of the real space grid.

axesint or sequence of ints, optional

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

halfcomplexbool, optional

If True, interpret the given grid as the reciprocal as used in a half-complex FFT (see above). Otherwise, the grid is regarded as being used in a complex-to-complex transform.

halfcx_parity{‘even’, ‘odd’}

Use this parity for the shape of the returned grid in the last axis of axes in the case halfcomplex=True

Returns
irecipuniform RectGrid

The inverse reciprocal grid.