Page MenuHomec4science

test01.py
No OneTemporary

File Metadata

Created
Sun, Nov 3, 17:31

test01.py

from pNbody import *
import time
import treelib
import Ptools as pt
ErrTolTheta = 0.8
eps = 0.1
# open a model
nb = Nbody("../../examples/snap.dat",ftype='gadget')
#nb = nb.selectc(nb.rxyz()<2)
# create a tree object
MyTree = treelib.Tree(npart=array(nb.npart),pos=nb.pos,vel=nb.vel,mass=nb.mass,ErrTolTheta=ErrTolTheta)
R = arange(-20,20,0.1)
print len(R)
pos = concatenate((R,zeros(len(R)),zeros(len(R))))
pos.shape = (3,len(R))
pos = transpose(pos)
pos = pos.astype(float32)
pot = MyTree.Potential(pos,eps)
pt.plot(R,pot)
pt.show()

Event Timeline