-
Notifications
You must be signed in to change notification settings - Fork 756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scipy.signal.get_window(window,M,fftbins=True) takes a 3rd argument #78
Comments
From my experiments, this only appears to have an effect on the phase spectrum. |
You are my life-saver!!! |
Commenting because this was still a pain point when I took the course in 2023, and it looks like it hasn't been addressed. I loved the class and want to help maintain it if I can! Prior to SciPy 0.18, an odd window length would always return a symmetric window, even though the default is for a periodic window ( Setting |
...the
fftbins=True
argument (True
beeing the default value), which is not mentionned throughout of the course, and can lead to precision errors easily in a multitude of cases, because it forces the window to be periodic or symmetric* :So if this argument is unchanged, get_window will always return a periodic window. This option could possibly have been added in a modern-ish version of scipy, hence why it's not beeing adressed. (see here https://www.coursera.org/learn/audio-signal-processing/programming/AZcF0/short-time-fourier-transform-stft/discussions/threads/W6_BoR4dEeiRQwooVK8Q3A)
*a first wrong understanding on my end was that this parameter changed the length of the window to be of an even or odd size, and change the length in samples of the output. It doesn't seem to change the length of the output. The way i understand it, if for example the size in samples is odd and the window supposed to be even-sized, then it may create an even sized window and zero-pad the last sample or the first one. In any case, the difference is real. See https://en.wikipedia.org/wiki/Window_function#Symmetry . I could add this line to have
get_window
behave consistently with what was expected from it :fftbins = M%2==0
;M
beeing the window size ; then passingfftbins
argument toget_window
.This is possibly related to this SciPy commit & discussion : scipy/scipy#6483
The text was updated successfully, but these errors were encountered: