[Yt-svn] yt-commit r1125 - trunk/yt/raven

dcollins at wrangler.dreamhost.com dcollins at wrangler.dreamhost.com
Fri Jan 16 14:19:27 PST 2009


Author: dcollins
Date: Fri Jan 16 14:19:27 2009
New Revision: 1125
URL: http://yt.spacepope.org/changeset/1125

Log:
Updated ClumpContourCallback to work properly with periodically shifted plots

Modified:
   trunk/yt/raven/Callbacks.py

Modified: trunk/yt/raven/Callbacks.py
==============================================================================
--- trunk/yt/raven/Callbacks.py	(original)
+++ trunk/yt/raven/Callbacks.py	Fri Jan 16 14:19:27 2009
@@ -429,14 +429,44 @@
         xx0, xx1 = plot._axes.get_xlim()
         yy0, yy1 = plot._axes.get_ylim()
         plot._axes.hold(True)
-        xf = lagos.axis_names[lagos.x_dict[plot.data.axis]]
-        yf = lagos.axis_names[lagos.y_dict[plot.data.axis]]
 
+        px_index = lagos.x_dict[plot.data.axis]
+        py_index = lagos.y_dict[plot.data.axis]
+
+        xf = lagos.axis_names[px_index]
+        yf = lagos.axis_names[py_index]
+
+        DomainRight = plot.data.pf["DomainRightEdge"]
+        DomainLeft = plot.data.pf["DomainLeftEdge"]
+        DomainWidth = DomainRight - DomainLeft
+        
         nx, ny = plot.image._A.shape
         buff = na.zeros((nx,ny),dtype='float64')
         for i,clump in enumerate(reversed(self.clumps)):
             mylog.debug("Pixelizing contour %s", i)
-            temp = _MPL.Pixelize(clump[xf], clump[yf],
+
+
+            xf_copy = copy.copy(clump[xf])
+            yf_copy = copy.copy(clump[yf])
+
+            #Shift zones that belong shifted, both directions in X and Y.
+            shifted = na.logical_and( xf_copy + DomainWidth[px_index] >= DomainRight[px_index],
+                                      xf_copy + DomainWidth[px_index]<= x1 )
+            xf_copy[na.where(shifted)] += DomainWidth[px_index]
+            
+            shifted = na.logical_and( xf_copy - DomainWidth[px_index] <= DomainLeft[px_index],
+                                      xf_copy - DomainWidth[px_index] >= x0 )
+            xf_copy[na.where(shifted)] -= DomainWidth[px_index]
+            
+            shifted = na.logical_and( yf_copy + DomainWidth[py_index] >= DomainRight[py_index],
+                                      yf_copy + DomainWidth[py_index] <= y1 )
+            yf_copy[na.where(shifted)] += DomainWidth[py_index]
+            
+            shifted = na.logical_and( yf_copy - DomainWidth[py_index] <= DomainLeft[py_index],
+                                      yf_copy - DomainWidth[py_index] >= y0 )
+            yf_copy[na.where(shifted)] -= DomainWidth[py_index]
+            
+            temp = _MPL.Pixelize(xf_copy, yf_copy, 
                                  clump['dx']/2.0,
                                  clump['dy']/2.0,
                                  clump['dx']*0.0+i+1, # inits inside Pixelize



More information about the yt-svn mailing list