Created
June 7, 2009 07:15
-
-
Save tkf/125221 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scipy | |
from scipy.integrate import odeint | |
sin=scipy.sin | |
cos=scipy.cos | |
def dydt(y,t0, dl, bt, ro): | |
return scipy.array([ | |
dl * (y[1] - y[0]), | |
y[0] * (ro - y[2]) - y[1], | |
y[0] * y[1] - bt * y[2] | |
]) | |
tm = scipy.arange(0,1000,0.01) | |
ans = odeint(dydt, [0.1,0.1,0.1], tm, args=(10,8/3,28)) | |
## import pylab | |
## pylab.clf() | |
## pylab.plot(ans[:,0],ans[:,1]) | |
import time | |
import Gnuplot | |
gp = Gnuplot.Gnuplot() | |
gp('set term x11 0') | |
time_s = time.time() | |
gp.plot( | |
Gnuplot.PlotItems.Data(ans[:,0],ans[:,1],inline=True,**{'with':'l'}) | |
) | |
time_e = time.time() | |
print "inline: True" | |
print time_e-time_s | |
gp('set term x11 1') | |
time_s = time.time() | |
gp.plot( | |
Gnuplot.PlotItems.Data(ans[:,0],ans[:,1],**{'with':'l'}) | |
) | |
time_e = time.time() | |
print "inline: default" | |
print time_e-time_s | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment