[Yt-svn] yt-commit r973 - in trunk/yt: . extensions
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Wed Dec 3 12:25:18 PST 2008
Author: mturk
Date: Wed Dec 3 12:25:17 2008
New Revision: 973
URL: http://yt.spacepope.org/changeset/973
Log:
Added a unit-boxes option to the zoomin command-line script and fixed _fix_pf
to check for directories.
Modified:
trunk/yt/commands.py
trunk/yt/extensions/HierarchySubset.py
trunk/yt/recipes.py
Modified: trunk/yt/commands.py
==============================================================================
--- trunk/yt/commands.py (original)
+++ trunk/yt/commands.py Wed Dec 3 12:25:17 2008
@@ -111,6 +111,10 @@
dest="age_filter", default=None,
nargs=2,
help="Bounds for the field to select"),
+ uboxes = dict(short="", long="--unit-boxes",
+ action="store_true",
+ dest="unit_boxes",
+ help="Display helpful unit boxes"),
)
def _add_options(parser, *options):
@@ -128,7 +132,7 @@
def zoomin():
parser = _get_parser("maxw", "minw", "proj", "axis", "field", "weight",
- "zlim", "nframes", "output", "cmap")
+ "zlim", "nframes", "output", "cmap", "uboxes")
opts, args = parser.parse_args()
for arg in args:
@@ -143,8 +147,9 @@
if opts.projection: pc.add_projection(opts.field, ax,
weight_field=opts.weight)
else: pc.add_slice(opts.field, ax)
+ if opts.unit_boxes: pc.plots[-1].add_callback(
+ UnitBoundaryCallback(factor=8))
pc.set_width(opts.max_width,'1')
- pc.set_cmap(opts.cmap)
# Check the output directory
if not os.path.isdir(opts.output):
os.mkdir(opts.output)
@@ -161,6 +166,7 @@
mylog.info("Saving frame %06i",i)
pc.set_width(w,"1")
if opts.zlim: pc.set_zlim(*opts.zlim)
+ pc.set_cmap(opts.cmap)
pc.save(os.path.join(opts.output,"%s_frame%06i" % (pf,i)))
w *= factor
@@ -181,14 +187,14 @@
# Now we figure out where this file is
bn_try = "%s%04i" % (opts.basename, n)
try:
- pf = _get_pf(bn_try)
+ pf = _fix_pf(bn_try)
except IOError:
- pf = _get_pf("%s.dir/%s" % (bn_try, bn_try))
+ pf = _fix_pf("%s.dir/%s" % (bn_try, bn_try))
pc=raven.PlotCollection(pf)
center = opts.center
if center is None or opts.center == (-1,-1,-1):
mylog.info("No center fed in; seeking.")
- v, center = a.h.find_max("Density")
+ v, center = pf.h.find_max("Density")
center = na.array(center)
if opts.axis == 4:
axes = range(3)
Modified: trunk/yt/extensions/HierarchySubset.py
==============================================================================
--- trunk/yt/extensions/HierarchySubset.py (original)
+++ trunk/yt/extensions/HierarchySubset.py Wed Dec 3 12:25:17 2008
@@ -127,11 +127,7 @@
def __get_pf(bn, n):
bn_try = "%s%04i" % (bn, n)
- try:
- pf = commands._fix_pf(bn_try)
- except IOError:
- pf = commands._fix_pf("%s.dir/%s" % (bn_try, bn_try))
- return pf
+ return commands._fix_pf(bn_try)
def export_amira():
Modified: trunk/yt/recipes.py
==============================================================================
--- trunk/yt/recipes.py (original)
+++ trunk/yt/recipes.py Wed Dec 3 12:25:17 2008
@@ -36,6 +36,12 @@
if isinstance(pf, lagos.StaticOutput): return pf
if os.path.exists("%s.hierarchy" % pf):
return lagos.EnzoStaticOutput(pf)
+ elif os.path.isdir("%s" % pf) and \
+ os.path.exists("%s/%s" % (pf,pf)):
+ return lagos.EnzoStaticOutput("%s/%s" % (pf,pf))
+ elif os.path.isdir("%s.dir" % pf) and \
+ os.path.exists("%s.dir/%s" % (pf,pf)):
+ return lagos.EnzoStaticOutput("%s.dir/%s" % (pf,pf))
elif pf.endswith(".hierarchy"):
return lagos.EnzoStaticOutput(pf[:-10])
# JS will have to implement the Orion one
More information about the yt-svn
mailing list