[Yt-svn] yt-commit r657 - trunk/yt/lagos

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Tue Jul 8 22:16:52 PDT 2008


Author: mturk
Date: Tue Jul  8 22:16:51 2008
New Revision: 657
URL: http://yt.spacepope.org/changeset/657

Log:
Fix a semi-corner case of thin projections.  This will likely slow down
projections a small amount; I'll think about a better way to do it later...

now if you've got child-zones dangling outside a region, they will be correctly
marked as not contributing to the projection.

Thanks again, DC!



Modified:
   trunk/yt/lagos/BaseDataTypes.py

Modified: trunk/yt/lagos/BaseDataTypes.py
==============================================================================
--- trunk/yt/lagos/BaseDataTypes.py	(original)
+++ trunk/yt/lagos/BaseDataTypes.py	Tue Jul  8 22:16:51 2008
@@ -971,12 +971,16 @@
         full_proj = [self.func(field,axis=self.axis) for field in masked_data]
         weight_proj = self.func(weight_data,axis=self.axis)
         if self._check_region and not self.source._is_fully_enclosed(grid):
-            used_data = self._get_points_in_region(grid)
+            used_data = self._get_points_in_region(grid).astype('bool')
             used_points = na.where(na.logical_or.reduce(used_data, self.axis))
         else:
+            used_data = na.array([1.0], dtype='bool')
             used_points = slice(None)
         if zero_out:
-            subgrid_mask = na.logical_and.reduce(grid.child_mask, self.axis).astype('int64')
+            subgrid_mask = na.logical_and.reduce(
+                                na.logical_or(grid.child_mask,
+                                             ~used_data),
+                                self.axis).astype('int64')
         else:
             subgrid_mask = na.ones(full_proj[0].shape, dtype='int64')
         xind, yind = [arr[used_points].ravel() for arr in na.indices(full_proj[0].shape)]



More information about the yt-svn mailing list