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

Bitbucket commits-noreply at bitbucket.org
Thu Jul 12 22:17:28 PDT 2012


2 new commits in yt:


https://bitbucket.org/yt_analysis/yt/changeset/9fb14be94b87/
changeset:   9fb14be94b87
branch:      yt
user:        xarthisius
date:        2012-07-13 01:53:51
summary:     [data_objects/data_containers] cut memory usage during grid coordinates generation
affected #:  1 file

diff -r d2fc7a6bd11a4d0a2fb930cf79b6125225beb595 -r 9fb14be94b8799d62c113f8c877007cc2014f7bf yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -1103,17 +1103,25 @@
         mask = self.__cut_mask_child_mask(grid)[sl]
         cm = na.where(mask.ravel()== 1)
         cmI = na.indices((nx,ny))
-        xind = cmI[0,:].ravel()
-        xpoints = na.ones(cm[0].shape, 'float64')
-        xpoints *= xind[cm]*dx+(grid.LeftEdge[xaxis] + 0.5*dx)
-        yind = cmI[1,:].ravel()
-        ypoints = na.ones(cm[0].shape, 'float64')
-        ypoints *= yind[cm]*dy+(grid.LeftEdge[yaxis] + 0.5*dy)
-        zpoints = na.ones(xpoints.shape, 'float64') * self.coord
-        dx = na.ones(xpoints.shape, 'float64') * dx/2.0
-        dy = na.ones(xpoints.shape, 'float64') * dy/2.0
-        t = na.array([xpoints, ypoints, zpoints, dx, dy]).swapaxes(0,1)
-        return t
+        xind = cmI[0, :].ravel()
+        npoints = cm[0].shape
+        # create array of "npoints" ones that will be reused later
+        points = na.ones(npoints, 'float64')
+        # calculate xpoints array
+        t = points * xind[cm] * dx + (grid.LeftEdge[xaxis] + 0.5 * dx)
+        # calculate ypoints array
+        yind = cmI[1, :].ravel()
+        t = na.vstack( (t, points * yind[cm] * dy + \
+                (grid.LeftEdge[yaxis] + 0.5 * dy))
+            )
+        # calculate zpoints array
+        t = na.vstack((t, points * self.coord))
+        # calculate dx array
+        t = na.vstack((t, points * dx * 0.5))
+        # calculate dy array
+        t = na.vstack((t, points * dy * 0.5))
+        # return [xpoints, ypoints, zpoints, dx, dy] as (5, npoints) array
+        return t.swapaxes(0, 1)
 
     @restore_grid_state
     def _get_data_from_grid(self, grid, field):



https://bitbucket.org/yt_analysis/yt/changeset/a6b706e18e1e/
changeset:   a6b706e18e1e
branch:      yt
user:        xarthisius
date:        2012-07-13 02:08:16
summary:     [data_objects/data_containers] cut memory usage even more
affected #:  1 file

diff -r 9fb14be94b8799d62c113f8c877007cc2014f7bf -r a6b706e18e1e9a0e5a8df7762a540c4e50b90f78 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -1103,17 +1103,19 @@
         mask = self.__cut_mask_child_mask(grid)[sl]
         cm = na.where(mask.ravel()== 1)
         cmI = na.indices((nx,ny))
-        xind = cmI[0, :].ravel()
+        ind = cmI[0, :].ravel()   # xind
         npoints = cm[0].shape
         # create array of "npoints" ones that will be reused later
         points = na.ones(npoints, 'float64')
         # calculate xpoints array
-        t = points * xind[cm] * dx + (grid.LeftEdge[xaxis] + 0.5 * dx)
+        t = points * ind[cm] * dx + (grid.LeftEdge[xaxis] + 0.5 * dx)
         # calculate ypoints array
-        yind = cmI[1, :].ravel()
-        t = na.vstack( (t, points * yind[cm] * dy + \
+        ind = cmI[1, :].ravel()   # yind
+        del cmI   # no longer needed 
+        t = na.vstack( (t, points * ind[cm] * dy + \
                 (grid.LeftEdge[yaxis] + 0.5 * dy))
             )
+        del ind, cm   # no longer needed
         # calculate zpoints array
         t = na.vstack((t, points * self.coord))
         # calculate dx array

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