Skip to content

Instantly share code, notes, and snippets.

@tkf
Created June 7, 2009 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkf/125221 to your computer and use it in GitHub Desktop.
Save tkf/125221 to your computer and use it in GitHub Desktop.
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