From: <jd...@us...> - 2007-10-29 19:00:26
|
Revision: 4062 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4062&view=rev Author: jdh2358 Date: 2007-10-29 12:00:25 -0700 (Mon, 29 Oct 2007) Log Message: ----------- added cohere demo Modified Paths: -------------- trunk/matplotlib/examples/backend_driver.py trunk/matplotlib/examples/image_slices_viewer.py Added Paths: ----------- trunk/matplotlib/examples/cohere_demo.py Modified: trunk/matplotlib/examples/backend_driver.py =================================================================== --- trunk/matplotlib/examples/backend_driver.py 2007-10-29 18:52:41 UTC (rev 4061) +++ trunk/matplotlib/examples/backend_driver.py 2007-10-29 19:00:25 UTC (rev 4062) @@ -32,9 +32,10 @@ 'barh_demo.py', 'color_demo.py', 'colorbar_only.py', + 'cohere_demo.py', 'contour_demo.py', 'contourf_demo.py', - 'csd_demo.py', + 'csd_demo.py', 'custom_ticker1.py', 'customize_rc.py', 'date_demo1.py', Added: trunk/matplotlib/examples/cohere_demo.py =================================================================== --- trunk/matplotlib/examples/cohere_demo.py (rev 0) +++ trunk/matplotlib/examples/cohere_demo.py 2007-10-29 19:00:25 UTC (rev 4062) @@ -0,0 +1,37 @@ +#!/usr/bin/env python +""" +Compute the coherence of two signals +""" +import numpy as n + +from pylab import figure, show + +dt = 0.01 +t = n.arange(0, 30, dt) +Nt = len(t) +nse1 = n.random.randn(Nt) # white noise 1 +nse2 = n.random.randn(Nt) # white noise 2 +r = n.exp(-t/0.05) + +cnse1 = n.convolve(nse1, r)*dt # colored noise 1 +cnse1 = cnse1[:Nt] +cnse2 = n.convolve(nse2, r)*dt # colored noise 2 +cnse2 = cnse2[:Nt] + +# two signals with a coherent part and a random part +s1 = 0.01*n.sin(2*n.pi*10*t) + cnse1 +s2 = 0.01*n.sin(2*n.pi*10*t) + cnse2 + +fig = figure() +ax = fig.add_subplot(211) +ax.plot(t, s1, 'b-', t, s2, 'g-') +ax.set_xlim(0,5) +ax.set_xlabel('time') +ax.set_ylabel('s1 and s2') + +ax = fig.add_subplot(212) +cxy, f = ax.cohere(s1, s2, 256, 1./dt) + +show() + + Modified: trunk/matplotlib/examples/image_slices_viewer.py =================================================================== --- trunk/matplotlib/examples/image_slices_viewer.py 2007-10-29 18:52:41 UTC (rev 4061) +++ trunk/matplotlib/examples/image_slices_viewer.py 2007-10-29 19:00:25 UTC (rev 4062) @@ -17,7 +17,7 @@ self.update() def onscroll(self, event): - + print event.button if event.button=='up': self.ind = numpy.clip(self.ind+1, 0, self.slices-1) else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |