[yt-svn] commit/yt: 5 new changesets

Bitbucket commits-noreply at bitbucket.org
Wed Jan 4 08:00:58 PST 2012


5 new commits in yt:


https://bitbucket.org/yt_analysis/yt/changeset/dd274f6ba7d3/
changeset:   dd274f6ba7d3
branch:      yt
user:        sskory
date:        2011-12-26 18:52:28
summary:     Fixing/improving the __repr__ for boolean data containers.
affected #:  1 file

diff -r 75de61bbd2b98c71d1993f6260ef91f4dd16ff74 -r dd274f6ba7d36658454cb341bc5d827b5f86a336 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -3658,6 +3658,19 @@
                     self._some_overlap.append(grid)
                     continue
     
+    def __repr__(self):
+        # We'll do this the slow way to be clear what's going on
+        s = "%s (%s): " % (self.__class__.__name__, self.pf)
+        s += "["
+        for i, region in enumerate(self.regions):
+            if region in ["OR", "AND", "NOT", "(", ")"]:
+                s += region + ", "
+            else:
+                s += region.__repr__()
+                if i != (len(self.regions) - 1): s += ", "
+        s += "]"
+        return s
+    
     def _is_fully_enclosed(self, grid):
         return (grid in self._all_overlap)
 



https://bitbucket.org/yt_analysis/yt/changeset/f3220517c9ee/
changeset:   f3220517c9ee
branch:      yt
user:        sskory
date:        2011-12-26 19:01:07
summary:     Making the boolean __repr__ prettier.
affected #:  1 file

diff -r dd274f6ba7d36658454cb341bc5d827b5f86a336 -r f3220517c9ee46c94865dbad345ff7a593435476 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -397,9 +397,10 @@
                      [self.field_parameters])
         return (_reconstruct_object, args)
 
-    def __repr__(self):
+    def __repr__(self, clean = False):
         # We'll do this the slow way to be clear what's going on
-        s = "%s (%s): " % (self.__class__.__name__, self.pf)
+        if clean: s = "%s: " % (self.__class__.__name__)
+        else: s = "%s (%s): " % (self.__class__.__name__, self.pf)
         s += ", ".join(["%s=%s" % (i, getattr(self,i))
                        for i in self._con_args])
         return s
@@ -3664,10 +3665,10 @@
         s += "["
         for i, region in enumerate(self.regions):
             if region in ["OR", "AND", "NOT", "(", ")"]:
-                s += region + ", "
+                s += region
             else:
-                s += region.__repr__()
-                if i != (len(self.regions) - 1): s += ", "
+                s += region.__repr__(clean = True)
+            if i < (len(self.regions) - 1): s += ", "
         s += "]"
         return s
     



https://bitbucket.org/yt_analysis/yt/changeset/d9b11947838c/
changeset:   d9b11947838c
branch:      yt
user:        sskory
date:        2012-01-04 00:45:40
summary:     Fixing the volume calculation for cylinders.
affected #:  1 file

diff -r f3220517c9ee46c94865dbad345ff7a593435476 -r d9b11947838c12fc3d47297f876c2c078a6f6248 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -2995,7 +2995,7 @@
         """
         Return the volume of the cylinder in units of *unit*.
         """
-        return math.pi * (self._radius)**2. * self._height * pf[unit]**3
+        return math.pi * (self._radius)**2. * self._height * self.pf[unit]**3
 
 class AMRInclinedBox(AMR3DData):
     _type_name="inclined_box"



https://bitbucket.org/yt_analysis/yt/changeset/3ea4bbb75033/
changeset:   3ea4bbb75033
branch:      yt
user:        sskory
date:        2012-01-04 16:58:47
summary:     Removing the .volume() calculation for cylinders, so it now defaults
to the cell-counting method inherited from AMR3DData.
affected #:  1 file

diff -r d9b11947838c12fc3d47297f876c2c078a6f6248 -r 3ea4bbb75033fe3f47bd06b3dc3007db475a7c8a yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -2991,12 +2991,6 @@
                  & (r <= self._radius))
         return cm
 
-    def volume(self, unit="unitary"):
-        """
-        Return the volume of the cylinder in units of *unit*.
-        """
-        return math.pi * (self._radius)**2. * self._height * self.pf[unit]**3
-
 class AMRInclinedBox(AMR3DData):
     _type_name="inclined_box"
     _con_args = ('origin','box_vectors')



https://bitbucket.org/yt_analysis/yt/changeset/7310d5fcf892/
changeset:   7310d5fcf892
branch:      yt
user:        sskory
date:        2012-01-04 16:59:03
summary:     Merge.
affected #:  1 file

diff -r 3ea4bbb75033fe3f47bd06b3dc3007db475a7c8a -r 7310d5fcf89255079bc584370e3149cc745e7ad2 yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -484,6 +484,15 @@
         if self.num_grids > 40:
             starter = na.random.randint(0, 20)
             random_sample = na.mgrid[starter:len(self.grids)-1:20j].astype("int32")
+            # We also add in a bit to make sure that some of the grids have
+            # particles
+            gwp = self.grid_particle_count > 0
+            if na.any(gwp) and not na.any(gwp[(random_sample,)]):
+                # We just add one grid.  This is not terribly efficient.
+                first_grid = na.where(gwp)[0][0]
+                random_sample.resize((21,))
+                random_sample[-1] = first_grid
+                mylog.debug("Added additional grid %s", first_grid)
             mylog.debug("Checking grids: %s", random_sample.tolist())
         else:
             random_sample = na.mgrid[0:max(len(self.grids)-1,1)].astype("int32")

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list