|
From: Henrik W. <e9h...@gm...> - 2009-10-21 12:04:19
|
Hello all, I'm sorry if this has been treated before, but I haven't found anything when searching the archives or the net. Basically, the problem surfaces when plotting FFT spectras using many data points. The amplitudes of the peaks in the spectra then seem to depend on the size of the plot window. Example code: >>> from pylab import * >>> t=arange(65536) >>> plot(abs(fft(sin(2*pi*.01*t)*blackman(len(t))))) [<matplotlib.lines.Line2D object at 0x03871990>] >>> show() With the original window size (WXAgg backend), I get maximum peaks at about 390. Zooming in on the peak will increase the amplitude. Resizing the window can also make the amplitude increase. The expected amplitude is: >>> max(abs(fft(sin(2*pi*.01*t)*blackman(len(t))))) 12891.96683092583 Is this a known problem, or should I file a bug report? Is there any workaround (except decreasing the length of t, and thus the level of detail)? I'm using ActivePython 2.6.3.7 for windows, matplotlib 0.99.1 binary, numpy 1.3.0 and wxPython-unicode-2.8.10.1. I've also tried with the TkAgg backend, which gives similar results. Thanks, Henrik |
|
From: Michael D. <md...@st...> - 2009-10-21 12:45:14
|
It looks like the path simplification code is failing on this. As a workaround, you can turn it off: rcParams['path.simplify'] = False or reduce the threshold below which vertices are removed: rcParams['path.simplify_threshold'] = 0.0001 In the meantime, I'll look further into why this is failing. Perhaps we need a lower default threshold. Mike Henrik Wallin wrote: > Hello all, > > I'm sorry if this has been treated before, but I haven't found > anything when searching the archives or the net. > > Basically, the problem surfaces when plotting FFT spectras using many > data points. The amplitudes of the peaks in the spectra then seem to > depend on the size of the plot window. > > Example code: > > > >>>> from pylab import * >>>> t=arange(65536) >>>> plot(abs(fft(sin(2*pi*.01*t)*blackman(len(t))))) >>>> > [<matplotlib.lines.Line2D object at 0x03871990>] > >>>> show() >>>> > > With the original window size (WXAgg backend), I get maximum peaks at > about 390. Zooming in on the peak will increase the amplitude. > Resizing the window can also make the amplitude increase. > > The expected amplitude is: > > >>>> max(abs(fft(sin(2*pi*.01*t)*blackman(len(t))))) >>>> > 12891.96683092583 > > Is this a known problem, or should I file a bug report? Is there any > workaround (except decreasing the length of t, and thus the level of > detail)? > > I'm using ActivePython 2.6.3.7 for windows, matplotlib 0.99.1 binary, > numpy 1.3.0 and wxPython-unicode-2.8.10.1. I've also tried with the > TkAgg backend, which gives similar results. > > Thanks, > Henrik > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |
|
From: Michael D. <md...@st...> - 2009-10-21 13:29:39
|
I have fixed this bug that was causing peaks to be truncated in SVN r7895 and r7896. It should make it into the next bugfix release. Mike Michael Droettboom wrote: > It looks like the path simplification code is failing on this. As a > workaround, you can turn it off: > > rcParams['path.simplify'] = False > > or reduce the threshold below which vertices are removed: > > rcParams['path.simplify_threshold'] = 0.0001 > > In the meantime, I'll look further into why this is failing. Perhaps we > need a lower default threshold. > > Mike > > Henrik Wallin wrote: > >> Hello all, >> >> I'm sorry if this has been treated before, but I haven't found >> anything when searching the archives or the net. >> >> Basically, the problem surfaces when plotting FFT spectras using many >> data points. The amplitudes of the peaks in the spectra then seem to >> depend on the size of the plot window. >> >> Example code: >> >> >> >> >>>>> from pylab import * >>>>> t=arange(65536) >>>>> plot(abs(fft(sin(2*pi*.01*t)*blackman(len(t))))) >>>>> >>>>> >> [<matplotlib.lines.Line2D object at 0x03871990>] >> >> >>>>> show() >>>>> >>>>> >> With the original window size (WXAgg backend), I get maximum peaks at >> about 390. Zooming in on the peak will increase the amplitude. >> Resizing the window can also make the amplitude increase. >> >> The expected amplitude is: >> >> >> >>>>> max(abs(fft(sin(2*pi*.01*t)*blackman(len(t))))) >>>>> >>>>> >> 12891.96683092583 >> >> Is this a known problem, or should I file a bug report? Is there any >> workaround (except decreasing the length of t, and thus the level of >> detail)? >> >> I'm using ActivePython 2.6.3.7 for windows, matplotlib 0.99.1 binary, >> numpy 1.3.0 and wxPython-unicode-2.8.10.1. I've also tried with the >> TkAgg backend, which gives similar results. >> >> Thanks, >> Henrik >> >> ------------------------------------------------------------------------------ >> Come build with us! The BlackBerry(R) Developer Conference in SF, CA >> is the only developer event you need to attend this year. Jumpstart your >> developing skills, take BlackBerry mobile applications to market and stay >> ahead of the curve. Join us from November 9 - 12, 2009. Register now! >> http://p.sf.net/sfu/devconference >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |