[Yt-svn] yt: fixed Orion's time reporting; added a time option to yt plot...
hg at spacepope.org
hg at spacepope.org
Fri Jun 25 16:07:21 PDT 2010
hg Repository: yt
details: yt/rev/d0cea0aac751
changeset: 1819:d0cea0aac751
user: J.S. Oishi <jsoishi at gmail.com>
date:
Fri Jun 25 16:07:11 2010 -0700
description:
fixed Orion's time reporting; added a time option to yt plot command line that puts the time in years on a slice or proj
diffstat:
yt/command_line.py | 10 +++++++++-
yt/lagos/OutputTypes.py | 4 ++--
2 files changed, 11 insertions(+), 3 deletions(-)
diffs (62 lines):
diff -r cbf801419328 -r d0cea0aac751 yt/command_line.py
--- a/yt/command_line.py Fri Jun 25 12:21:16 2010 -0700
+++ b/yt/command_line.py Fri Jun 25 16:07:11 2010 -0700
@@ -142,6 +142,10 @@
action="store_true",
dest="grids", default=False,
help="Show the grid boundaries"),
+ time = dict(short="", long="--time",
+ action="store_true",
+ dest="time", default=False,
+ help="Print time in years on image"),
halos = dict(short="", long="--halos",
action="store", type="string",
dest="halos",default="multiple",
@@ -168,6 +172,7 @@
make_projections = dict(short="", long="--make_projections",
action="store_true", default=False,
help="Make projections with halo profiler.")
+
)
def _add_options(parser, *options):
@@ -440,7 +445,7 @@
@add_cmd_options(["width", "unit", "bn", "proj", "center",
"zlim", "axis", "field", "weight", "skip",
- "cmap", "output", "grids"])
+ "cmap", "output", "grids", "time"])
@check_args
def do_plot(self, subcmd, opts, arg):
"""
@@ -466,6 +471,9 @@
weight_field=opts.weight, center=center)
else: pc.add_slice(opts.field, ax, center=center)
if opts.grids: pc.plots[-1].modify["grids"]()
+ if opts.time:
+ time = pf['InitialTime']*pf['Time']*pf['years']
+ pc.plots[-1].modify["text"]((0.2,0.8), 't = %5.2f yr'%time)
pc.set_width(opts.width, opts.unit)
pc.set_cmap(opts.cmap)
if opts.zlim: pc.set_zlim(*opts.zlim)
diff -r cbf801419328 -r d0cea0aac751 yt/lagos/OutputTypes.py
--- a/yt/lagos/OutputTypes.py Fri Jun 25 12:21:16 2010 -0700
+++ b/yt/lagos/OutputTypes.py Fri Jun 25 16:07:11 2010 -0700
@@ -491,7 +491,7 @@
# These should maybe not be hardcoded?
self.parameters["HydroMethod"] = 'orion' # always PPM DE
- self.parameters["InitialTime"] = 0. # FIX ME!!!
+ self.parameters["Time"] = 1. # default unit is 1...
self.parameters["DualEnergyFormalism"] = 0 # always off.
self.parameters["EOSType"] = -1 # default
if self.fparameters.has_key("mu"):
@@ -586,7 +586,7 @@
lines = header_file.readlines()
header_file.close()
n_fields = int(lines[1])
- self.parameters["Time"] = float(lines[3+n_fields])
+ self.parameters["InitialTime"] = float(lines[3+n_fields])
def _set_units(self):
More information about the yt-svn
mailing list