[Yt-svn] yt-commit r1396 - in trunk/yt: lagos raven

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Fri Aug 14 09:43:50 PDT 2009


Author: mturk
Date: Fri Aug 14 09:43:50 2009
New Revision: 1396
URL: http://yt.spacepope.org/changeset/1396

Log:
Fixed an odd bug in ParallelTools that showed up when the root proc didn't have
any work to do on a slice.

Changed our plots to be made via data replacement on an existing image, which
should be much faster.  New callbacks that use something other than a patch, a
collection or text might require more additions to the callback clearing
operation.



Modified:
   trunk/yt/lagos/ParallelTools.py
   trunk/yt/raven/PlotTypes.py

Modified: trunk/yt/lagos/ParallelTools.py
==============================================================================
--- trunk/yt/lagos/ParallelTools.py	(original)
+++ trunk/yt/lagos/ParallelTools.py	Fri Aug 14 09:43:50 2009
@@ -326,7 +326,9 @@
         # First we receive, then we make a new list.
         for i in range(1,MPI.COMM_WORLD.size):
             buf = _recv_array(source=i, tag=0)
-            if buf is not None: data = na.concatenate([data, buf])
+            if buf is not None:
+                if data is None: data = buf
+                else: data = na.concatenate([data, buf])
         return data
 
     @parallel_passthrough

Modified: trunk/yt/raven/PlotTypes.py
==============================================================================
--- trunk/yt/raven/PlotTypes.py	(original)
+++ trunk/yt/raven/PlotTypes.py	Fri Aug 14 09:43:50 2009
@@ -217,6 +217,9 @@
         self._callbacks[id] = lambda a: None
 
     def _run_callbacks(self):
+        self._axes.patches = []
+        self._axes.collections = []
+        self._axes.texts = []
         for cb in self._callbacks:
             cb(self)
 
@@ -329,7 +332,6 @@
         return buff
 
     def _redraw_image(self, *args):
-        self._axes.clear() # To help out the colorbar
         buff = self._get_buff()
         mylog.debug("Received buffer of min %s and max %s (data: %s %s)",
                     na.nanmin(buff), na.nanmax(buff),
@@ -342,12 +344,16 @@
         else:
             newmin = na.nanmin(buff)
             newmax = na.nanmax(buff)
+        aspect = (self.ylim[1]-self.ylim[0])/(self.xlim[1]-self.xlim[0])
+        if self.image._A.size != buff.size:
+            self._axes.clear()
+            self.image = \
+                self._axes.imshow(buff, interpolation='nearest', norm = self.norm,
+                                aspect=aspect, picker=True, origin='lower')
+        else:
+            self.image.set_data(buff)
         if self.do_autoscale:
             self.norm.autoscale(na.array((newmin,newmax)))
-        aspect = (self.ylim[1]-self.ylim[0])/(self.xlim[1]-self.xlim[0])
-        self.image = \
-            self._axes.imshow(buff, interpolation='nearest', norm = self.norm,
-                            aspect=aspect, picker=True, origin='lower')
         self._reset_image_parameters()
         self._run_callbacks()
 



More information about the yt-svn mailing list