powerbox.dft Module¶
A module defining some “nicer” fourier transform functions.
We define only two functions – an arbitrary-dimension forward transform, and its inverse. In each case, the transform is designed to replicate the continuous transform. That is, the transform is volume-normalised and obeys correct Fourier conventions.
The actual FFT backend is provided by pyFFTW
if it is installed, which provides a significant speedup, and
multi-threading.
Conveniently, we allow for arbitrary Fourier convention, according to the scheme in http://mathworld.wolfram.com/FourierTransform.html. That is, we define the forward and inverse n-dimensional transforms respectively as
and
In both transforms, the corresponding co-ordinates are returned so a completely consistent transform is simple to get. This makes switching from standard frequency to angular frequency very simple.
We note that currently, only positive values for b are implemented (in fact, using negative b is consistent, but one must be careful that the frequencies returned are descending, rather than ascending).
Functions¶
fft (X[, L, Lk, a, b, axes, ret_cubegrid]) |
Arbitrary-dimension nice Fourier Transform. |
ifft (X[, Lk, L, a, b, axes, ret_cubegrid]) |
Arbitrary-dimension nice inverse Fourier Transform. |
fftfreq (N[, d, b]) |
Return the fourier frequencies for a box with N cells, using general Fourier convention. |
fftshift (x, *args, **kwargs) |
The same as numpy’s fftshift, except that it preserves units (if Astropy quantities are used) |
ifftshift (x, *args, **kwargs) |
The same as numpy’s ifftshift, except that it preserves units (if Astropy quantities are used) |