FFTW#

class caput.algorithms.fft.fftw.FFTW(shape, dtype, axes=None, forward=True, backward=True)[source]#

Create FFTW objects for repeat use.

This implementation is most efficient when used to repeatedly apply FFTs to arrays with the same shape and dtype, because a single, highly optimised pathway can be used with a single initialisation.

Even for a single use, this will typically be faster than the scipy.fft() or numpy.fft() implementations, especially when multiple cores are available.

Parameters:
shapetuple[int, …]

The shape of the arrays to initialise.

dtypedtype

Datatype to create a pathway for. At the moment, only complex -> complex or real -> real are supported. The pyfftw implementation of the real -> real backward transform will destroy the input array.

axesint | iterable[int], optional

Axes over which to apply the FFT. Default is all axes.

forwardbool, optional

If true, initialise the forward FFT. Default is True.

backwardbool, optional

If true, initialise the backward FFT. Default is True.

property params[source]#

Display the parameters of this FFT.

Returns:
parametersdict

ncpu, simd alignment, shape, dtype, axes, and flags used by this FFTW object.

Methods#

fft(x)

Perform a forward FFT.

fftconvolve(in1, in2)

Convolve two arrays by multiplying in the Fourier domain.

fftwindow(x, window)

Apply a window function in Fourier space.

ifft(x)

Perform a backward FFT.