dft_preprocess_data¶
- odl.trafos.util.ft_utils.dft_preprocess_data(arr, shift=True, axes=None, sign='-', out=None)[source]¶
Pre-process the real-space data before DFT.
This function multiplies the given data with the separable function:
p(x) = exp(+- 1j * dot(x - x[0], xi[0]))
where
x[0]
andxi[0]
are the minimum coodinates of the real-space and reciprocal grids, respectively. The sign of the exponent depends on the choice ofsign
. In discretized form, this function becomes an array:p[k] = exp(+- 1j * k * s * xi[0])
If the reciprocal grid is not shifted, i.e. symmetric around 0, it is
xi[0] = pi/s * (-1 + 1/N)
, hence:p[k] = exp(-+ 1j * pi * k * (1 - 1/N))
For a shifted grid, we have :math:
xi[0] = -pi/s
, thus the array is given by:p[k] = (-1)**k
- Parameters:
- arr
array-like
Array to be pre-processed. If its data type is a real non-floating type, it is converted to 'float64'.
- shiftbool or 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. Default: all axes.- sign{'-', '+'}, optional
Sign of the complex exponent.
- out
numpy.ndarray
, optional Array in which the result is stored. If
out is arr
, an in-place modification is performed. For real data type, this is only possible forshift=True
since the factors are complex otherwise.
- arr
- Returns:
- out
numpy.ndarray
Result of the pre-processing. If
out
was given, the returned object is a reference to it.
- out
Notes
If
out
is not specified, the data type of the returned array is the same as that ofarr
except whenarr
has real data type andshift
is notTrue
. In this case, the return type is the complex counterpart ofarr.dtype
.