Page MenuHomec4science

gplotvel
No OneTemporary

File Metadata

Created
Thu, Jun 20, 05:21

gplotvel

#!/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