scipy: Bug in scipy.signal.resample() when using a window
The signal.resample()
function accepts an optional parameter to specify a window in frequency domain. If that’s done with a tuple with name and parameter, the window is retrieved from another function. Relevant code from signaltools.py:
if window is not None:
if callable(window):
# ...
elif isinstance(window, ndarray):
# ...
else:
W = fftpack.ifftshift(get_window(window, Nx))
However that get_window()
function returns the window in time- and not frequency domain! Which is obviously not correct. The get_window()
can be found here in the windows.py.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (14 by maintainers)
I don’t see this as a deficiency so much as a reasonable design choice. You can accomplish such time-domain windowing to deal with edge artifacts or spectral leakage with
resample(x * window, ...)
in your own code, whereas the Fourier-domain windowing occurs in the middle of transforms (after FFT, before truncation and IFFT) so it has to be a parameter…