scipy.fftpack
interface¶
This module implements those functions that replace aspects of the
scipy.fftpack
module. This module provides the entire documented
namespace of scipy.fftpack
, but those functions that are not included
here are imported directly from scipy.fftpack
.
The exceptions raised by each of these functions are mostly as per their
equivalents in scipy.fftpack
, though there are some corner cases in
which this may not be true.
Some corner (mis)usages of scipy.fftpack
may not transfer neatly.
For example, using scipy.fftpack.fft2()
with a non 1D array and
a 2D shape argument will return without exception whereas
pyfftw.interfaces.scipy_fftpack.fft2()
will raise a ValueError.
- pyfftw.interfaces.scipy_fftpack.dct(x, type=2, n=None, axis=-1, norm=None, overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform an 1D discrete cosine transform.
The first three arguments are as per
scipy.fftpack.dct()
; the rest of the arguments are documented in the additional arguments docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.
- pyfftw.interfaces.scipy_fftpack.dctn(x, type=2, shape=None, axes=None, norm=None, overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform an nD discrete cosine transform.
The first six arguments are as per
scipy.fftpack.dctn()
; the rest of the arguments are documented in the additional arguments docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.
- pyfftw.interfaces.scipy_fftpack.dst(x, type=2, n=None, axis=-1, norm=None, overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform an 1D discrete sine transform.
The first three arguments are as per
scipy.fftpack.dst()
; the rest of the arguments are documented in the additional arguments docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.
- pyfftw.interfaces.scipy_fftpack.dstn(x, type=2, shape=None, axes=None, norm=None, overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform an nD discrete sine transform.
The first six arguments are as per
scipy.fftpack.dstn()
; the rest of the arguments are documented in the additional arguments docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.
- pyfftw.interfaces.scipy_fftpack.fft(x, n=None, axis=-1, overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform an 1D FFT.
The first three arguments are as per
scipy.fftpack.fft()
; the rest of the arguments are documented in the additional argument docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.
- pyfftw.interfaces.scipy_fftpack.fft2(x, shape=None, axes=(-2, -1), overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform a 2D FFT.
The first three arguments are as per
scipy.fftpack.fft2()
; the rest of the arguments are documented in the additional argument docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.
- pyfftw.interfaces.scipy_fftpack.fftn(x, shape=None, axes=None, overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform an nD FFT.
The first three arguments are as per
scipy.fftpack.fftn()
; the rest of the arguments are documented in the additional argument docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.
- pyfftw.interfaces.scipy_fftpack.idct(x, type=2, n=None, axis=-1, norm=None, overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform an 1D inverse discrete cosine transform.
The first three arguments are as per
scipy.fftpack.idct()
; the rest of the arguments are documented in the additional arguments docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.
- pyfftw.interfaces.scipy_fftpack.idctn(x, type=2, shape=None, axes=None, norm=None, overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform an nD inverse discrete cosine transform.
The first six arguments are as per
scipy.fftpack.idctn()
; the rest of the arguments are documented in the additional arguments docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.
- pyfftw.interfaces.scipy_fftpack.idst(x, type=2, n=None, axis=-1, norm=None, overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform an 1D inverse discrete sine transform.
The first three arguments are as per
scipy.fftpack.idst()
; the rest of the arguments are documented in the additional arguments docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.
- pyfftw.interfaces.scipy_fftpack.idstn(x, type=2, shape=None, axes=None, norm=None, overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform an nD inverse discrete sine transform.
The first six arguments are as per
scipy.fftpack.idstn()
; the rest of the arguments are documented in the additional arguments docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.
- pyfftw.interfaces.scipy_fftpack.ifft(x, n=None, axis=-1, overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform an 1D inverse FFT.
The first three arguments are as per
scipy.fftpack.ifft()
; the rest of the arguments are documented in the additional argument docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.
- pyfftw.interfaces.scipy_fftpack.ifft2(x, shape=None, axes=(-2, -1), overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform a 2D inverse FFT.
The first three arguments are as per
scipy.fftpack.ifft2()
; the rest of the arguments are documented in the additional argument docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.
- pyfftw.interfaces.scipy_fftpack.ifftn(x, shape=None, axes=None, overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform an nD inverse FFT.
The first three arguments are as per
scipy.fftpack.ifftn()
; the rest of the arguments are documented in the additional argument docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.
- pyfftw.interfaces.scipy_fftpack.irfft(x, n=None, axis=-1, overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform an 1D inverse real FFT.
The first three arguments are as per
scipy.fftpack.irfft()
; the rest of the arguments are documented in the additional argument docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.
- pyfftw.interfaces.scipy_fftpack.next_fast_len(target)¶
Find the next fast transform length for FFTW.
FFTW has efficient functions for transforms of length 2**a * 3**b * 5**c * 7**d * 11**e * 13**f, where e + f is either 0 or 1.
- Parameters
target (int) – Length to start searching from. Must be a positive integer.
- Returns
out – The first fast length greater than or equal to target.
- Return type
Examples
On a particular machine, an FFT of prime length takes 2.1 ms:
>>> from pyfftw.interfaces import scipy_fftpack >>> min_len = 10007 # prime length is worst case for speed >>> a = numpy.random.randn(min_len) >>> b = scipy_fftpack.fft(a)
Zero-padding to the next fast length reduces computation time to 406 us, a speedup of ~5 times:
>>> next_fast_len(min_len) 10080 >>> b = scipy_fftpack.fft(a, 10080)
Rounding up to the next power of 2 is not optimal, taking 598 us to compute, 1.5 times as long as the size selected by next_fast_len.
>>> b = fftpack.fft(a, 16384)
Similar speedups will occur for pre-planned FFTs as generated via pyfftw.builders.
- pyfftw.interfaces.scipy_fftpack.rfft(x, n=None, axis=-1, overwrite_x=False, planner_effort=None, threads=None, auto_align_input=True, auto_contiguous=True)¶
Perform an 1D real FFT.
The first three arguments are as per
scipy.fftpack.rfft()
; the rest of the arguments are documented in the additional argument docs.Warning: scipy.fftpack is considered legacy, new code should use scipy.fft instead.