Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91786030
test03.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
Thu, Nov 14, 11:16
Size
713 B
Mime Type
text/x-python
Expires
Sat, Nov 16, 11:16 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22323488
Attached To
rPNBODY pNbody
test03.py
View Options
from
pNbody
import
*
import
time
import
treelib
import
Ptools
as
pt
ErrTolTheta
=
0.8
eps
=
0.1
params
=
{}
params
[
'ErrTolTheta'
]
=
ErrTolTheta
# open a model
nb
=
Nbody
(
"../../examples/snap.dat"
,
ftype
=
'gadget'
)
#nb.set_tpe(0)
#nb = nb.selectc(nb.rxyz()<2)
# create a tree object
nb
.
Tree
=
treelib
.
Tree
(
npart
=
array
(
nb
.
npart
),
pos
=
nb
.
pos
,
vel
=
nb
.
vel
,
mass
=
nb
.
mass
,
num
=
nb
.
num
,
tpe
=
nb
.
tpe
,
params
=
params
)
# make the tree
nb
.
Tree
.
BuildTree
()
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
)
hsml
=
nb
.
Tree
.
InitHsml
(
33
,
3
)
density
,
hsml
=
nb
.
Tree
.
Density
(
pos
,
hsml
,
33
,
3
)
pt
.
plot
(
R
,
density
)
pt
.
show
()
Event Timeline
Log In to Comment