Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F85924658
tipsybig.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, Oct 3, 02:04
Size
999 B
Mime Type
text/x-python
Expires
Sat, Oct 5, 02:04 (2 d)
Engine
blob
Format
Raw Data
Handle
21300512
Attached To
rPNBODY pNbody
tipsybig.py
View Options
class
Nbody_tipsybig
(
NbodyDefault
):
def
read_p
(
self
,
f
):
'''
specific format for particle file
'''
# header
h1
=
fromstring
(
f
.
read
(
8
),
Float
)
.
byteswapped
()
h2
=
fromstring
(
f
.
read
(
4
*
5
),
Int
)
.
byteswapped
()
tnow
=
h1
[
0
]
nbody
=
h2
[
0
]
ndim
=
h2
[
1
]
ngas
=
h2
[
2
]
ndark
=
h2
[
3
]
nstar
=
h2
[
4
]
#f.read(4) ?
# gas
vec1
=
fromstring
(
f
.
read
(
4
*
12
*
ngas
),
Float32
)
.
byteswapped
()
# dark
vec2
=
fromstring
(
f
.
read
(
4
*
9
*
ndark
),
Float32
)
.
byteswapped
()
# stars
vec3
=
fromstring
(
f
.
read
(
4
*
11
*
nstar
),
Float32
)
.
byteswapped
()
vec1
.
shape
=
(
ngas
,
12
)
vec2
.
shape
=
(
ndark
,
9
)
vec3
.
shape
=
(
nstar
,
11
)
mass
=
concatenate
((
vec1
[:,
0
],
vec2
[:,
0
],
vec3
[:,
0
]))
pos
=
concatenate
((
vec1
[:,
1
:
4
],
vec2
[:,
1
:
4
],
vec3
[:,
1
:
4
]))
vel
=
concatenate
((
vec1
[:,
4
:
7
],
vec2
[:,
4
:
7
],
vec3
[:,
4
:
7
]))
# make global
self
.
tnow
=
tnow
self
.
nbody
=
nbody
self
.
label
=
'tipsy file'
self
.
pos
=
pos
self
.
vel
=
vel
Event Timeline
Log In to Comment