Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F80646308
gaxis
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
Sun, Sep 1, 21:03
Size
3 KB
Mime Type
text/x-python
Expires
Tue, Sep 3, 21:03 (2 d)
Engine
blob
Format
Raw Data
Handle
20341510
Attached To
rMTOOLS Mtools
gaxis
View Options
#!/usr/bin/env python
from
optparse
import
OptionParser
import
Ptools
as
pt
from
pNbody
import
*
from
pNbody
import
units
import
string
def
parse_options
():
usage
=
"usage: %prog [options] file"
parser
=
OptionParser
(
usage
=
usage
)
parser
=
pt
.
add_postscript_options
(
parser
)
parser
=
pt
.
add_ftype_options
(
parser
)
parser
=
pt
.
add_reduc_options
(
parser
)
parser
=
pt
.
add_center_options
(
parser
)
parser
=
pt
.
add_select_options
(
parser
)
parser
=
pt
.
add_cmd_options
(
parser
)
parser
=
pt
.
add_display_options
(
parser
)
parser
=
pt
.
add_info_options
(
parser
)
parser
=
pt
.
add_limits_options
(
parser
)
parser
=
pt
.
add_log_options
(
parser
)
parser
.
add_option
(
"-d"
,
"--dir"
,
action
=
"store"
,
dest
=
"dir"
,
type
=
"string"
,
default
=
None
,
help
=
"output directory for png files"
)
parser
.
add_option
(
"--param"
,
action
=
"store"
,
dest
=
"param"
,
type
=
"string"
,
default
=
None
,
help
=
"parameter file"
)
parser
.
add_option
(
"--x"
,
action
=
"store"
,
dest
=
"x"
,
type
=
"string"
,
default
=
'r'
,
help
=
"x value to plot"
,
metavar
=
" STRING"
)
parser
.
add_option
(
"--y"
,
action
=
"store"
,
dest
=
"y"
,
type
=
"string"
,
default
=
'T'
,
help
=
"y value to plot"
,
metavar
=
" STRING"
)
parser
.
add_option
(
"--z"
,
action
=
"store"
,
dest
=
"z"
,
type
=
"string"
,
default
=
None
,
help
=
"z value to plot"
,
metavar
=
" STRING"
)
parser
.
add_option
(
"--xlabel"
,
action
=
"store"
,
dest
=
"xlabel"
,
type
=
"string"
,
default
=
None
,
help
=
"xlabel"
,
metavar
=
" STRING"
)
parser
.
add_option
(
"--ylabel"
,
action
=
"store"
,
dest
=
"ylabel"
,
type
=
"string"
,
default
=
None
,
help
=
"ylabel"
,
metavar
=
" STRING"
)
parser
.
add_option
(
"-n"
,
action
=
"store"
,
dest
=
"n"
,
type
=
"int"
,
default
=
1
,
help
=
"number of images"
,
metavar
=
" INTEGER"
)
(
options
,
args
)
=
parser
.
parse_args
()
files
=
args
return
files
,
options
#######################################
# MakePlot
#######################################
def
MakePlot
(
files
,
opt
):
xmin
=
opt
.
xmin
xmax
=
opt
.
xmax
ymin
=
opt
.
ymin
ymax
=
opt
.
ymax
# figure
fig
=
pt
.
gcf
()
ax
=
pt
.
gca
()
# here, we run the parameter file
if
opt
.
param
!=
None
:
execfile
(
opt
.
param
)
# plot axis
pt
.
SetAxis
(
xmin
,
xmax
,
ymin
,
ymax
,
log
=
opt
.
log
)
if
opt
.
xlabel
!=
None
:
pt
.
xlabel
(
opt
.
xlabel
,
fontsize
=
pt
.
labelfont
)
if
opt
.
ylabel
!=
None
:
pt
.
ylabel
(
opt
.
ylabel
,
fontsize
=
pt
.
labelfont
)
pt
.
grid
(
False
)
########################################################################
# MAIN
########################################################################
if
__name__
==
'__main__'
:
files
,
opt
=
parse_options
()
#(500*(1+0.1))/100
if
opt
.
dir
!=
None
:
if
not
os
.
path
.
exists
(
opt
.
dir
):
os
.
mkdir
(
opt
.
dir
)
opt
.
size
=
(
5.12
,
5.12
)
# create directory
for
i
in
xrange
(
opt
.
n
):
if
opt
.
dir
!=
None
:
opt
.
ps
=
os
.
path
.
join
(
opt
.
dir
,
"
%08d
.png"
%
i
)
print
opt
.
ps
# counter
opt
.
i
=
i
pt
.
InitPlot
(
files
,
opt
)
pt
.
pcolors
MakePlot
(
files
,
opt
)
pt
.
EndPlot
(
files
,
opt
)
Event Timeline
Log In to Comment