def test_time():
# Just run the timer...
N= 101
totmass= 1.
sigma= 1.
zh= 2.*sigma**2./totmass
x= numpy.arctanh(2.*numpy.random.uniform(size=N)-1)*zh
v= numpy.random.normal(size=N)*sigma
v-= numpy.mean(v) # stabilize
m= numpy.ones_like(x)/N*(1.+0.1*(2.*numpy.random.uniform(size=N)-1))
g= wendy.nbody(x,v,m,0.05,approx=True,nleap=1000,full_output=True)
tx,tv, time_elapsed= next(g)
assert time_elapsed < 1., 'More than 1 second elapsed for simple problem'
return None
评论列表
文章目录