scipy/legacy-signal
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| SciPy | info | safe, with xpd check --fix |
All versions |
SciPy marks signal.stft, spectrogram and similar functions as legacy. Use a ShortTimeFFT object and its method of the same purpose.
w, h = signal.sosfreqz(sos, worN=512)w, h = signal.freqz_sos(sos, worN=512)What the rule reports
Section titled “What the rule reports”The rule reports signal.stft, istft, spectrogram and check_COLA, which SciPy marks as
legacy in favor of the ShortTimeFFT class. It also reports signal.sosfreqz, a legacy alias
of freqz_sos, but not on SciPy older than 1.15.
How to fix it
Section titled “How to fix it”xpd check --fix applies the fix of this rule.
The safe fix writes freqz_sos for sosfreqz, whose body only calls freqz_sos. The other forms have no fix.
A manual move to ShortTimeFFT also needs to adapt the arguments to its methods.
Diagnostic message
Section titled “Diagnostic message”SciPy marks signal.$F as a legacy function. Write a ShortTimeFFT object and call its method of the same purpose, such as stft or spectrogram.See all rules in the SciPy pack.