Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F68802316
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
Sat, Jun 29, 00:14
Size
634 B
Mime Type
text/x-python
Expires
Mon, Jul 1, 00:14 (2 d)
Engine
blob
Format
Raw Data
Handle
18634148
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
# 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
)
print
"init hsml"
hsml
=
MyTree
.
InitHsml
(
33
,
3
)
print
"compute density"
density
,
hsml
=
MyTree
.
Density
(
pos
,
hsml
,
33
,
3
)
pt
.
plot
(
R
,
density
)
pt
.
show
()
Event Timeline
Log In to Comment