[Yt-svn] yt-commit r1363 - in trunk/yt: extensions raven
britton at wrangler.dreamhost.com
britton at wrangler.dreamhost.com
Sun Jul 5 12:49:34 PDT 2009
Author: britton
Date: Sun Jul 5 12:49:33 2009
New Revision: 1363
URL: http://yt.spacepope.org/changeset/1363
Log:
Added a keyword, 'force_save' (boolean: default False), to PlotCollection.save
and and plot save_image to force image saving. Set to true, it will bypass
the root_only property of the save functions so that any process may save an
image. This allows the HaloProfiler to save all projection images when done in
parallel.
Modified:
trunk/yt/extensions/HaloProfiler.py
trunk/yt/raven/PlotCollection.py
trunk/yt/raven/PlotTypes.py
Modified: trunk/yt/extensions/HaloProfiler.py
==============================================================================
--- trunk/yt/extensions/HaloProfiler.py (original)
+++ trunk/yt/extensions/HaloProfiler.py Sun Jul 5 12:49:33 2009
@@ -281,11 +281,13 @@
frb = raven.FixedResolutionBuffer(pc.plots[e].data,(proj_left[0],proj_right[0],proj_left[1],proj_right[1]),
(projectionResolution,projectionResolution),
antialias=False)
- output.create_dataset("/%s_%s" % (field,self.projectionFields[field]),data=frb[field])
+ dataset_name = "%s_%s" % (field,self.projectionFields[field])
+ if dataset_name in output.listnames(): del output[dataset_name]
+ output.create_dataset(dataset_name,data=frb[field])
output.close()
if save_images:
- pc.save("%s/Halo_%04d" % (outputDir,halo['id']))
+ pc.save("%s/Halo_%04d" % (outputDir,halo['id']),force_save=True)
pc.clear_plots()
del region
Modified: trunk/yt/raven/PlotCollection.py
==============================================================================
--- trunk/yt/raven/PlotCollection.py (original)
+++ trunk/yt/raven/PlotCollection.py Sun Jul 5 12:49:33 2009
@@ -67,7 +67,7 @@
for p in self.plots:
yield p
- def save(self, basename, format="png", override=False):
+ def save(self, basename, format="png", override=False, force_save=False):
"""
Same plots with automatically generated names, prefixed with *basename*
(including directory path) unless *override* is specified, and in
@@ -77,7 +77,7 @@
for plot in self.plots:
fn.append(plot.save_image(basename, \
format=format, submit=self._run_id,
- override=override))
+ override=override, force_save=force_save))
if self.submit:
im = plot.im.copy()
im["Filename"] = self._http_prefix + "/" \
Modified: trunk/yt/raven/PlotTypes.py
==============================================================================
--- trunk/yt/raven/PlotTypes.py (original)
+++ trunk/yt/raven/PlotTypes.py Sun Jul 5 12:49:33 2009
@@ -101,7 +101,7 @@
def __getitem__(self, item):
return self.data[item] # Should be returned in CGS
- def save_image(self, prefix, format="png", submit=None, override=True):
+ def save_image(self, prefix, format="png", submit=None, override=True, force_save=False):
"""
Save this plot image. Will generate a filename based on the *prefix*,
*format*. *submit* will govern the submission to the Deliverator and
@@ -115,7 +115,10 @@
my_prefix = prefix
fn = ".".join([my_prefix, format])
canvas = engineVals["canvas"](self._figure)
- only_on_root(canvas.print_figure, fn)
+ if force_save:
+ canvas.print_figure(fn)
+ else:
+ only_on_root(canvas.print_figure, fn)
self["Type"] = self._type_name
self["GeneratedAt"] = self.data.pf["CurrentTimeIdentifier"]
return fn
More information about the yt-svn
mailing list