Skip to content

scipy/legacy-fftpack

Rule legacy-fftpack
Pack SciPy
Severity info
Fix none, edit by hand
Library versions every version

scipy.fftpack is legacy, and SciPy says new code should use scipy.fft. Import from scipy.fft, and check rfft, whose output layout differs.

from scipy import fftpack
y = fftpack.dct(x)
from scipy import fft
y = fft.dct(x)

The rule reports an import of scipy.fftpack, whose module docstring marks it as legacy and says new code should use scipy.fft. scipy.fft was no faster in the measurements, so the rule claims only the preference.

xpd has no automatic fix. Because rfft packs its output differently and the pseudo differential operators have no scipy.fft form. Make the change by hand.

xpd prints this message with the issue. A name that starts with $ stands for code from your file.

scipy.fftpack is legacy, and its SciPy docstring says new code should use scipy.fft. Import from scipy.fft instead, and check rfft, whose output layout differs.

Browse the other rules of the SciPy pack.