Closed
Description
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
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
Metadata
Metadata
Assignees
Labels
No labels