Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F112470813
gbubble_stat
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, May 10, 19:32
Size
1 KB
Mime Type
text/x-python
Expires
Mon, May 12, 19:32 (1 d, 11 h)
Engine
blob
Format
Raw Data
Handle
26093232
Attached To
rGTOOLS Gtools
gbubble_stat
View Options
#!/usr/bin/env python
'''
Extract and plot info contained in the
output Gadget file called by default "bubble.txt".
Yves Revaz
mer sep 6 10:18:58 CEST 2006
'''
from
numarray
import
*
from
Nbody
import
*
import
string
import
sys
import
os
from
Nbody.libutil
import
histogram
from
optparse
import
OptionParser
from
Gtools
import
*
from
Gtools
import
io
def
parse_options
():
usage
=
"usage: %prog [options] file"
parser
=
OptionParser
(
usage
=
usage
)
parser
=
add_postscript_options
(
parser
)
parser
=
add_color_options
(
parser
)
parser
=
add_limits_options
(
parser
)
parser
=
add_log_options
(
parser
)
parser
.
add_option
(
"-o"
,
action
=
"store"
,
dest
=
"obs"
,
type
=
"string"
,
default
=
'OverPressure'
,
help
=
"observable name"
,
metavar
=
" NAME"
)
(
options
,
args
)
=
parser
.
parse_args
()
if
options
.
colors
!=
None
:
exec
(
"options.colors = array([
%s
])"
%
(
options
.
colors
))
if
len
(
args
)
==
0
:
print
"you must specify a filename"
sys
.
exit
(
0
)
files
=
args
return
files
,
options
#############################
# graph
#############################
# get options
files
,
options
=
parse_options
()
obs
=
options
.
obs
#######################################
# LOOP
#######################################
# read files
for
file
in
files
:
try
:
vals
=
io
.
read_bubble
(
file
)
except
:
print
"problem reading
%s
"
%
(
file
)
sys
.
exit
()
'''
Step Time OverPressure EgyJet EgyInt EgyPot
'''
t
=
vals
[
'Time'
]
e
=
vals
[
'EgyJet'
]
tmin
=
min
(
t
)
tmax
=
max
(
t
)
dt
=
tmax
-
tmin
print
print
file
print
"Mean Energy =
%g
"
%
(
e
.
mean
())
print
"Tot Energy =
%g
"
%
(
sum
(
e
))
print
"Num of bubbles =
%d
"
%
(
len
(
e
))
print
"Mean Jet Time =
%g
"
%
(
2
*
dt
/
len
(
e
))
Event Timeline
Log In to Comment