Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F112656889
gbubble
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
Mon, May 12, 01:13
Size
2 KB
Mime Type
text/x-python
Expires
Wed, May 14, 01:13 (2 d)
Engine
blob
Format
Raw Data
Handle
26121042
Attached To
rGTOOLS Gtools
gbubble
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 SM
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")
parser.add_option("--relative",
action="store_true",
dest="relative",
default = 0,
help="plot relative value")
(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()
ps = options.ps
col = options.colors
xmin = options.xmin
xmax = options.xmax
ymin = options.ymin
ymax = options.ymax
log = options.log
obs = options.obs
rel = options.relative
#######################################
# open sm
#######################################
g = Graph_Init(ps)
Graph_SetDefaultsGraphSettings(g)
colors = Graph_SetColorsForFiles(files,col)
#######################################
# 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
'''
x = vals['Time']
if obs == 'OtherKeyWord':
pass
elif vals.has_key(obs):
y = vals[obs]
else:
print "unknown observable %s"%(obs)
sys.exit()
if rel:
y = 100*(fabs(y-y[0]))/y[0]
y = fabs(y)
# use log
if log != None:
x,y = Graph_UseLog(x,y,log)
if file == files[0]:
xmin,xmax,ymin,ymax = Graph_SetLimits(g,xmin,xmax,ymin,ymax,x,y)
g.box()
# plot points
g.ctype(colors[file])
g.ptype(10,3)
g.points(x,y)
g.ptype(0,0)
# labels
g.ctype(0)
g.xlabel('T')
g.ylabel('%s'%obs)
g.ctype(0)
if log == 'xy' or log == 'yx':
g.xlabel('log T')
g.ylabel('log %s'%obs)
elif log == 'x':
g.xlabel('log T')
g.ylabel('%s'%obs)
elif log == 'y':
g.xlabel('T')
g.ylabel('log %s'%obs)
else:
g.xlabel('T')
g.ylabel('%s'%obs)
# -- end ---
Graph_End(g,ps)
Event Timeline
Log In to Comment