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

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Tue May 25 08:54:38 PDT 2010


Author: mturk
Date: Tue May 25 08:54:38 2010
New Revision: 1731
URL: http://yt.enzotools.org/changeset/1731

Log:
Now UsedBins for 1D profiles is meaningful; it is not queried as of the present
time, so this should not affect plotting.



Modified:
   trunk/yt/lagos/Profiles.py

Modified: trunk/yt/lagos/Profiles.py
==============================================================================
--- trunk/yt/lagos/Profiles.py	(original)
+++ trunk/yt/lagos/Profiles.py	Tue May 25 08:54:38 2010
@@ -235,7 +235,7 @@
         if weight: weight_data = self._get_field(source, weight, check_cut)[mi]
         binned_field = self._get_empty_field()
         weight_field = self._get_empty_field()
-        used_field = na.ones(weight_field.shape, dtype='bool')
+        used_field = self._get_empty_field()
         # Now we perform the actual binning
         for bin in inv_bin_indices.keys():
             # temp_field is *all* the points from source that go into this bin
@@ -245,13 +245,15 @@
                 weight_field[bin] = weight_data[inv_bin_indices[bin]].sum()
                 temp_field *= weight_data[inv_bin_indices[bin]]
             binned_field[bin] = temp_field.sum()
+            # inv_bin_indices is a tuple of indices
+            if inv_bin_indices[bin][0].size > 0: used_field[bin] = 1
         # Fix for laziness, because at the *end* we will be
         # summing up all of the histograms and dividing by the
         # weights.  Accumulation likely doesn't work with weighted
         # average fields.
         if accumulation: 
             binned_field = na.add.accumulate(binned_field)
-        return binned_field, weight_field, na.ones(binned_field.shape,dtype='bool')
+        return binned_field, weight_field, used_field.astype("bool")
 
     @preserve_source_parameters
     def _get_bins(self, source, check_cut=False):



More information about the yt-svn mailing list