Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100638620
gheader
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, Feb 1, 09:41
Size
2 KB
Mime Type
text/x-python
Expires
Mon, Feb 3, 09:41 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24005873
Attached To
rGTOOLS Gtools
gheader
View Options
#!/usr/bin/env python
#!/usr/bin/env python
import
os
,
thread
,
sys
,
string
,
time
,
glob
from
numpy
import
*
from
pNbody
import
*
from
optparse
import
OptionParser
########################################
#
# parser
#
########################################
def
parse_options
():
usage
=
"usage: %prog [options] file"
parser
=
OptionParser
(
usage
=
usage
)
parser
.
add_option
(
"-t"
,
action
=
"store"
,
dest
=
"ftype"
,
type
=
"string"
,
default
=
None
,
help
=
"type of the file"
,
metavar
=
" TYPE"
)
parser
.
add_option
(
"--exec"
,
action
=
"store"
,
dest
=
"execline"
,
type
=
"string"
,
default
=
None
,
help
=
"give command to execute before"
,
metavar
=
" STRING"
)
(
options
,
args
)
=
parser
.
parse_args
()
if
len
(
args
)
==
0
:
#print "you must specify a filename"
#sys.exit(0)
file
=
None
else
:
file
=
args
return
file
,
options
################################################################################
#
# MAIN
#
################################################################################
files
,
opt
=
parse_options
()
opt
.
pio
=
'no'
opt
.
byteorder
=
sys
.
byteorder
for
file
in
files
:
tpl
=
(
24
,
48
,
float
,
float
,
int32
,
int32
,
24
,
int32
,
int32
,
float
,
float
,
float
,
float
,
int32
,
int32
,
24
,
int32
,
int32
,
float
,
48
)
f
=
open
(
file
,
'r'
)
header
=
io
.
ReadBlock
(
f
,
tpl
,
byteorder
=
opt
.
byteorder
,
pio
=
opt
.
pio
)
f
.
close
()
npart
,
massarr
,
atime
,
redshift
,
flag_sfr
,
flag_feedback
,
nall
,
flag_cooling
,
num_files
,
boxsize
,
omega0
,
omegalambda
,
hubbleparam
,
flag_age
,
flag_metals
,
nallhw
,
flag_entr_ic
,
flag_chimie_extraheader
,
critical_energy_spec
,
empty
=
header
npart
=
fromstring
(
npart
,
int32
)
massarr
=
fromstring
(
massarr
,
float
)
nall
=
fromstring
(
nall
,
int32
)
nallhw
=
fromstring
(
nallhw
,
int32
)
nbody
=
sum
(
npart
)
print
"
%s
atime=
%13.10f
redshift=
%13.10f
nbody=
%8d
"
%
(
file
,
atime
,
redshift
,
nbody
)
#print " atime = %g"%atime
#print " redshift = %g"%redshift
#print " npart = %s"%npart
Event Timeline
Log In to Comment