Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F109852089
gplotvel
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
Wed, Apr 23, 15:53
Size
3 KB
Mime Type
text/x-python
Expires
Fri, Apr 25, 15:53 (2 d)
Engine
blob
Format
Raw Data
Handle
25762907
Attached To
rGTOOLS Gtools
gplotvel
View Options
#!/usr/bin/env python
'''
Extract and plot data from output from jeans fortran program
Yves Revaz
Tue Aug 16 14:05:26 CEST 2005
'''
from numarray import *
import SM
import string
import sys
from libjeans import *
try:
from optparse import OptionParser
except ImportError:
from optik import OptionParser
def parse_options():
usage = "usage: %prog [options] file"
parser = OptionParser(usage=usage)
parser.add_option("--minx",
action="store",
dest="mnx",
default=0,
help="min value in x")
parser.add_option("--maxx",
action="store",
dest="mxx",
default=30,
help="max value in x")
parser.add_option("--miny",
action="store",
dest="mny",
default=0,
help="min value in y")
parser.add_option("--maxy",
action="store",
dest="mxy",
default=220,
help="max value in y")
parser.add_option("-p",
action="store",
dest="ps",
type="string",
default = None,
help="postscript filename",
metavar=" FILE")
(options, args) = parser.parse_args()
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()
file = files[0]
ps = options.ps
rmin = options.mnx
rmax = options.mxx
vmin = options.mny
vmax = options.mxy
R,Sdens,Omega,Kappa,OmK2,Nu,Vr,Vt,Vz,Vc,Sr,St,Sz,H,Q=read_jeans(file)
r = R
vt = Vt*978.
vc = Vc*978.
sr = Sr*978.
st = St*978.
sz = Sz*978.
# open sm
if ps==None:
g = SM.plot("x11 -bg white -fg black ")
else:
g = SM.plot("postencap %s"%ps)
# some init
#g.palette('bgyrw')
g.expand(0.999)
g.setvariable('TeX_strings', '1')
#------- first graph -------
g.location(3500, 30000, 3500, 19000)
g.limits(0,rmax,0,vmax)
g.box()
g.ctype('cyan')
g.connect(r,vt)
g.ctype('green')
g.connect(r,sr)
g.ctype('red')
g.connect(r,st)
g.ctype('blue')
g.connect(r,sz)
g.ctype('black')
g.connect(r,vc)
g.xlabel('R')
g.ylabel('V')
#------- labels -------
g.location(3500, 30000, 19000, 23000)
g.limits(0,13,1,3)
#
g.ltype(0)
g.ctype('black')
g.relocate(5,1.5)
g.draw(7,1.5)
g.relocate(8,1.5)
g.putlabel(5,'\\ v_c')
#
g.ltype(1)
g.ctype('cyan')
g.relocate(1,1.5)
g.draw(3,1.5)
g.relocate(4,1.5)
g.putlabel(5,'\\ \\bar{v_\\theta}')
#
g.ltype(2)
g.ctype('green')
g.relocate(1,2)
g.draw(3,2)
g.relocate(4,2)
g.putlabel(5,'\\ \\sigma_r')
#
g.ltype(3)
g.ctype('red')
g.relocate(5,2)
g.draw(7,2)
g.relocate(8,2)
g.putlabel(5,'\\ \\sigma_\\theta')
#
g.ltype(4)
g.ctype('blue')
g.relocate(9,2)
g.draw(11,2)
g.relocate(12,2)
g.putlabel(5,'\\ \\sigma_z')
g.ltype(0)
g.ctype('black')
#------- second graph -------
g.location(3500, 30000, 23000, 30000)
g.limits(rmin,rmax,-1,3)
g.box()
g.connect(r,Q)
g.ltype(2)
g.relocate(-200,1)
g.draw(200,1)
g.ylabel('Q')
# -- end ---
if ps==None:
g.show()
else:
g.write()
g.clean()
Event Timeline
Log In to Comment