Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F69341515
gplotsigma
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, Jul 1, 08:50
Size
4 KB
Mime Type
text/x-python
Expires
Wed, Jul 3, 08:50 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18699060
Attached To
rGTOOLS Gtools
gplotsigma
View Options
#!/usr/bin/env python
'''
Extract and plot data from output from jeans fortran program
Yves Revaz
Wed Aug 31 13:47:40 CEST 2005
'''
from
numarray
import
*
import
SM
import
string
import
sys
from
libjeans
import
*
from
scipy.interpolate
import
splrep
,
splev
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"
)
parser
.
add_option
(
"-c"
,
action
=
"store"
,
dest
=
"colors"
,
type
=
"string"
,
default
=
None
,
help
=
"colors"
,
metavar
=
" 0,64,192"
)
parser
.
add_option
(
"-o"
,
action
=
"store"
,
dest
=
"observable"
,
type
=
"string"
,
default
=
'Vc'
,
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
()
ps
=
options
.
ps
rmin
=
options
.
mnx
rmax
=
options
.
mxx
vmin
=
options
.
mny
vmax
=
options
.
mxy
col
=
options
.
colors
observable
=
options
.
observable
# set colors
colors
=
{}
i
=
0
for
file
in
files
:
if
col
!=
None
:
colors
[
file
]
=
col
[
i
]
else
:
colors
[
file
]
=
i
*
255
/
len
(
files
)
i
=
i
+
1
#######################################
# 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
g
.
location
(
3500
,
31000
,
3500
,
31000
)
g
.
limits
(
rmin
,
rmax
,
vmin
,
vmax
)
g
.
box
()
g
.
xlabel
(
'R [kpc]'
)
g
.
ylabel
(
'V [km/s]'
)
#######################################
# LOOP
#######################################
for
file
in
files
:
R
,
Sdens
,
Omega
,
Kappa
,
OmK2
,
Nu
,
Vr
,
Vt
,
Vz
,
Vc
,
Sr
,
St
,
Sz
,
H
,
Q
=
read_jeans
(
file
)
if
observable
==
'Sdens'
:
var
=
Sdens
elif
observable
==
'Omega'
:
var
=
Sdens
elif
observable
==
'Kappa'
:
var
=
Kappa
elif
observable
==
'OmK2'
:
var
=
OmK2
elif
observable
==
'Nu'
:
var
=
Nu
elif
observable
==
'Vr'
:
var
=
Vr
*
978
elif
observable
==
'Vt'
:
var
=
Vt
*
978
elif
observable
==
'Vz'
:
var
=
Vz
*
978
elif
observable
==
'Vc'
:
var
=
Vc
*
978
elif
observable
==
'Sr'
:
var
=
Sr
*
978
elif
observable
==
'St'
:
var
=
St
*
978
elif
observable
==
'Sz'
:
var
=
Sz
*
978
elif
observable
==
'H'
:
var
=
H
elif
observable
==
'Q'
:
var
=
Q
# color
g
.
ctype
(
colors
[
file
])
# first
g
.
location
(
3500
,
31000
,
3500
,
31000
)
g
.
limits
(
rmin
,
rmax
,
vmin
,
vmax
)
g
.
connect
(
R
,
var
)
# colors
if
len
(
files
)
>
1
:
x0
=
0.05
y0
=
0.95
x
=
x0
y
=
y0
dx
=
0.5
/
len
(
files
)
g
.
location
(
3500
,
31000
,
3500
,
31000
)
g
.
limits
(
0
,
1
,
0
,
1
)
g
.
ptype
(
10
,
3
)
g
.
expand
(
1.5
)
for
i
in
range
(
len
(
colors
)):
xp
=
array
([
x
],
Float
)
yp
=
array
([
y
],
Float
)
g
.
ctype
(
colors
[
files
[
i
]])
g
.
points
(
xp
,
yp
)
x
=
x
+
dx
g
.
location
(
3500
,
31000
,
3500
,
31000
)
g
.
limits
(
rmin
,
rmax
,
vmin
,
vmax
)
g
.
ctype
(
0
)
# -- end ---
if
ps
==
None
:
g
.
show
()
else
:
g
.
write
()
g
.
clean
()
Event Timeline
Log In to Comment