raphaelvallat / yasa

YASA (Yet Another Spindle Algorithm): a Python package to analyze polysomnographic sleep recordings.
https://raphaelvallat.com/yasa/
BSD 3-Clause "New" or "Revised" License
417 stars 113 forks source link

Error with welch code #3

Closed apavlo89 closed 5 years ago

apavlo89 commented 5 years ago

Hello,

Running your example gives the following error

from scipy.signal import welch

win = int(4 * sf) # Window size is set to 4 seconds freqs, psd = welch(data_NREM, sf, nperseg=win, average='median') # Works with single or multi-channel data

print(freqs.shape, psd.shape) # psd has shape (n_channels, n_frequencies)

Plot

plt.plot(freqs, psd[1], 'k', lw=2) plt.fill_between(freqs, psd[1], cmap='Spectral') plt.xlim(0, 50) plt.yscale('log') sns.despine() plt.title(chan[1]) plt.xlabel('Frequency [Hz]') plt.ylabel('PSD log($uV^2$/Hz)');


TypeError Traceback (most recent call last)

in 2 3 win = int(4 * sf) # Window size is set to 4 seconds ----> 4 freqs, psd = welch(data_NREM, sf, nperseg=win, average='median') # Works with single or multi-channel data 5 6 print(freqs.shape, psd.shape) # psd has shape (n_channels, n_frequencies) TypeError: welch() got an unexpected keyword argument 'average' Please advice. Thank you for your help in the matter
apavlo89 commented 5 years ago

fixed by updating scipy -.-