David Craig : > Hi, thanks for that. I've made the following changes: > > NFFT = 100*60*10 # Linked to window size > Fs = stream[0].stats.sampling_rate > win = np.hanning(NFFT) > overlap = NFFT/2 > power, freq = plt.psd(data, NFFT, Fs, win, overlap) > > but it returns the following error: > > Traceback (most recent call last): > File "/home/davcra/Desktop/python_scripts/welchPSD.py", line 20, in > <module> > power, freq = plt.psd(data, NFFT, Fs, win, overlap) > File "/usr/lib/python2.7/site-packages/matplotlib/pyplot.py", line > 2322, in psd > ret = ax.psd(x, NFFT, Fs, Fc, detrend, window, noverlap, pad_to, > sides, scale_by_freq, **kwargs) > File "/usr/lib/python2.7/site-packages/matplotlib/axes.py", line > 7876, in psd > sides, scale_by_freq) > File "/usr/lib/python2.7/site-packages/matplotlib/mlab.py", line > 389, in psd > scale_by_freq) > File "/usr/lib/python2.7/site-packages/matplotlib/mlab.py", line > 419, in csd > noverlap, pad_to, sides, scale_by_freq) > File "/usr/lib/python2.7/site-packages/matplotlib/mlab.py", line > 268, in _spectral_helper > thisX = windowVals * detrend(thisX) > TypeError: 'int' object is not callable
Please, look the syntax of .psd in http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=psd#matplotlib.pyplot.psd You will find, for example, that the 5th argument, detrend, should be callable. In your code it is just a number. Use explicit keywords, it may save you from misunderstanding yourself... Jerzy Karczmarczuk OH. Fabrice Silva found it as well. OK, two is better than one... ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users