caput.algorithms.fft.fftw#
Fast FFT implementation using FFTW.
This module adds some minor abstraction to use pyfftw in a way which seems to be faster than using the pyfftw.builders interface, and uses the same api as scipy.fft and numpy.fft.
Only forward and reverse complex->complex transforms are currently supported.
Examples#
The core of this module is the FFTW, which essentially just
abstracts the pyfftw.FFTW class in a simple way.
>>> import numpy as np
>>> from caput.algorithms.fft import fftw
>>>
>>> shape = (24, 50)
>>> x = np.random.rand(*shape) + 1j * np.random.rand(*shape)
>>>
>>> fftobj = fftw.FFTW(x.shape, x.dtype, axes=-1)
>>>
>>> X = fftobj.fft(x)
>>> xi = fftobj.ifft(X)
>>>
>>> np.allclose(x, xi)
True
Alternatively, for one-off transforms, the module-level functions
can be used, which create FFTW objects internally.
Classes#
Create FFTW objects for repeat use. |
Functions#
|
Perform a forward discrete Fourier Transform. |
|
Convolve two arrays by multiplying in the Fourier domain. |
|
Apply a window function in Fourier space. |
|
Perform an inverse discrete Fourier Transform. |