You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In /usr/local/lib/python2.7/dist-packages/matplotlib/mlab.py Welch's periodogramm method is implemented erronously for the case of two time series. For the second time series the order of detrending and windowing are interchanged.
between lines 716 to 728, within the _spectral_helper method
result = detrend(result, detrend_func, axis=0) // ZIL comment: detrend first
result, windowVals = apply_window(result, window, axis=0, // ZIL comment: windowing next
return_window=True) // THIS IS CORRECT!
result = np.fft.fft(result, n=pad_to, axis=0)[:numFreqs, :]
freqs = np.fft.fftfreq(pad_to, 1/Fs)[:numFreqs]
if not same_data:
# if same_data is False, mode must be 'psd'
resultY = stride_windows(y, NFFT, noverlap)
resultY = apply_window(resultY, window, axis=0) // ZIL comment: windowing first ?????
resultY = detrend(resultY, detrend_func, axis=0) // ZIL comment: detrend next ??????
// THIS IS INCORRECT!
resultY = np.fft.fft(resultY, n=pad_to, axis=0)[:numFreqs, :]
result = np.conjugate(result) * resultY
Matplotlib version
Operating system: Ubuntu 16.04
Matplotlib version: 2.0.1
Python version: 2.7.12
The text was updated successfully, but these errors were encountered:
What to do about these fcns is an interesting conversation, because users really should be using the numpy functions. I think these ones are a historic artifact.
That said, I agree this is wrong, and I just checked, that it is indeed wrong in master. Did you want to try a PR to fix it. If not, I'm happy to do it.
Bug report
Bug summary
In
/usr/local/lib/python2.7/dist-packages/matplotlib/mlab.py
Welch's periodogramm method is implemented erronously for the case of two time series. For the second time series the order of detrending and windowing are interchanged.between lines 716 to 728, within the
_spectral_helper
methodMatplotlib version
The text was updated successfully, but these errors were encountered: