## matplotlib-users

 [Matplotlib-users] specgram and psd with complex valued data From: Johan Nilsson - 2006-02-08 21:26:39 ```Dear group I am rather new to matplotlib. I have a reasonably large file of complex valued data. Today I tried out specgram and psd, and they both work nicely. However I would like the negative frequencies to be on the negative side of the spectrum. I tried to look around, but could not find any parameter to set this. My question is, if this is easily possible or do I need to do something like a,b,c,d=pylab.specgram(y,1024) pylab.show() x1,y1=a.shape q=zeros([x1,y1],'d') q[:,x1/2:x1-1]=a[:,0:x1/2-1] q[:,0:x1/2-1]=a[:,x1-1:x1/2:-1] pylab.imshow(q) Apart from that I don't get the slicing to work properly yet, it would be nicer if there was just a parameter to set for specgram /Johan ```
 Re: [Matplotlib-users] specgram and psd with complex valued data From: Johan Nilsson - 2006-02-09 22:32:16 ```I worked out the slicing Pxx, freqs, bins = matplotlib.mlab.specgram(x, NFFT, Fs, detrend, window, noverlap) #line 3377 x1,y1=Pxx.shape q=zeros([x1,y1],'d') q[:][x1/2:x1]=Pxx[:][0:x1/2] q[:][0:x1/2]=Pxx[:][x1/2:x1] Pxx=q This would be the small change needed. To me it looks like the change could be done in axes.py One could add an argument wrapparound=False and then if wrapparound new code I assume that one should do something about the y-axis as well. extent = xmin, xmax, -amax(b)/2, amax(b)/2, is probably not 100% OK but will do it for me... I guess I will have a look at psd now. I guess that will be easier /Johan On Wed, 2006-02-08 at 22:26 +0100, Johan Nilsson wrote: > Dear group > > I am rather new to matplotlib. I have a reasonably large file of complex > valued data. Today I tried out specgram and psd, and they both work > nicely. However I would like the negative frequencies to be on the > negative side of the spectrum. I tried to look around, but could not > find any parameter to set this. My question is, if this is easily > possible or do I need to do something like > > a,b,c,d=pylab.specgram(y,1024) > pylab.show() > > x1,y1=a.shape > q=zeros([x1,y1],'d') > q[:,x1/2:x1-1]=a[:,0:x1/2-1] > q[:,0:x1/2-1]=a[:,x1-1:x1/2:-1] > > pylab.imshow(q) > > Apart from that I don't get the slicing to work properly yet, it would > be nicer if there was just a parameter to set for specgram > > > > /Johan > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users ```