Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90667106
test01.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Nov 3, 17:31
Size
547 B
Mime Type
text/x-python
Expires
Tue, Nov 5, 17:31 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22116809
Attached To
rPNBODY pNbody
test01.py
View Options
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
Log In to Comment