[yt-svn] commit/yt: ngoldbaum: Merged in xarthisius/yt (pull request #1707)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Aug 20 09:30:55 PDT 2015


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/5f98bb340f15/
Changeset:   5f98bb340f15
Branch:      yt
User:        ngoldbaum
Date:        2015-08-20 16:30:39+00:00
Summary:     Merged in xarthisius/yt (pull request #1707)

[WIP] Minor optimization for smoothed covering grids
Affected #:  4 files

diff -r d7969f97265f2820654bbc6f23e933983fd749c6 -r 5f98bb340f15ac0d73ba37156dba9ed24d0691d6 yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -321,7 +321,7 @@
         _units_initialized = False
         with self.data_source._field_parameter_state(self.field_parameters):
             for chunk in parallel_objects(self.data_source.chunks(
-                                          [], "io", local_only = True)): 
+                                          [], "io", local_only = True)):
                 mylog.debug("Adding chunk (%s) to tree (%0.3e GB RAM)",
                             chunk.ires.size, get_memory_usage()/1024.)
                 if _units_initialized is False:
@@ -912,22 +912,22 @@
         return ls
 
     def _minimal_box(self, dds):
-        LL = self.left_edge - self.ds.domain_left_edge
+        LL = self.left_edge.d - self.ds.domain_left_edge.d
         # Nudge in case we're on the edge
-        LL += LL.uq * np.finfo(np.float64).eps
-        LS = self.right_edge - self.ds.domain_left_edge
-        LS += LS.uq * np.finfo(np.float64).eps
+        LL += np.finfo(np.float64).eps
+        LS = self.right_edge.d - self.ds.domain_left_edge.d
+        LS += np.finfo(np.float64).eps
         cell_start = LL / dds  # This is the cell we're inside
         cell_end = LS / dds
         if self.level == 0:
             start_index = np.array(np.floor(cell_start), dtype="int64")
             end_index = np.array(np.ceil(cell_end), dtype="int64")
-            dims = np.rint((self.ActiveDimensions * self.dds) / dds).astype("int64")
+            dims = np.rint((self.ActiveDimensions * self.dds.d) / dds).astype("int64")
         else:
             # Give us one buffer
-            start_index = np.rint(cell_start.d).astype('int64') - 1
+            start_index = np.rint(cell_start).astype('int64') - 1
             # How many root cells do we occupy?
-            end_index = np.rint(cell_end.d).astype('int64')
+            end_index = np.rint(cell_end).astype('int64')
             dims = end_index - start_index + 1
         return start_index, end_index.astype("int64"), dims.astype("int32")
 
@@ -1213,9 +1213,9 @@
         >>> distf = 3.1e18*1e3 # distances into kpc
         >>> for i, r in enumerate(rhos):
         ...     surf = ds.surface(sp,'density',r)
-        ...     surf.export_obj("my_galaxy", transparency=trans[i], 
-        ...                      color_field='temperature', dist_fac = distf, 
-        ...                      plot_index = i, color_field_max = ma, 
+        ...     surf.export_obj("my_galaxy", transparency=trans[i],
+        ...                      color_field='temperature', dist_fac = distf,
+        ...                      plot_index = i, color_field_max = ma,
         ...                      color_field_min = mi)
 
         >>> sp = ds.sphere("max", (10, "kpc"))

diff -r d7969f97265f2820654bbc6f23e933983fd749c6 -r 5f98bb340f15ac0d73ba37156dba9ed24d0691d6 yt/data_objects/grid_patch.py
--- a/yt/data_objects/grid_patch.py
+++ b/yt/data_objects/grid_patch.py
@@ -77,13 +77,12 @@
         if self.start_index is not None:
             return self.start_index
         if self.Parent is None:
-            left = self.LeftEdge - self.ds.domain_left_edge
-            start_index = left / self.dds
-            return np.rint(start_index).astype('int64').ravel().view(np.ndarray)
+            left = self.LeftEdge.d - self.ds.domain_left_edge.d
+            start_index = left / self.dds.d
+            return np.rint(start_index).astype('int64').ravel()
 
-        pdx = self.Parent.dds.ndarray_view()
-        di = np.rint( (self.LeftEdge.ndarray_view() -
-                       self.Parent.LeftEdge.ndarray_view()) / pdx)
+        pdx = self.Parent.dds.d
+        di = np.rint((self.LeftEdge.d - self.Parent.LeftEdge.d) / pdx)
         start_index = self.Parent.get_global_startindex() + di
         self.start_index = (start_index * self.ds.refine_by).astype('int64').ravel()
         return self.start_index
@@ -251,7 +250,7 @@
         field_parameters.update(self.field_parameters)
         if smoothed:
             cube = self.ds.smoothed_covering_grid(
-                level, new_left_edge, 
+                level, new_left_edge,
                 field_parameters = field_parameters,
                 **kwargs)
         else:

diff -r d7969f97265f2820654bbc6f23e933983fd749c6 -r 5f98bb340f15ac0d73ba37156dba9ed24d0691d6 yt/geometry/selection_routines.pyx
--- a/yt/geometry/selection_routines.pyx
+++ b/yt/geometry/selection_routines.pyx
@@ -109,6 +109,8 @@
 cdef class SelectorObject:
 
     def __cinit__(self, dobj, *args):
+        cdef np.float64_t [:] DLE
+        cdef np.float64_t [:] DRE
         self.min_level = getattr(dobj, "min_level", 0)
         self.max_level = getattr(dobj, "max_level", 99)
         self.overlap_cells = 0

diff -r d7969f97265f2820654bbc6f23e933983fd749c6 -r 5f98bb340f15ac0d73ba37156dba9ed24d0691d6 yt/units/yt_array.py
--- a/yt/units/yt_array.py
+++ b/yt/units/yt_array.py
@@ -424,7 +424,8 @@
         (conversion_factor, offset) = self.units.get_conversion_factor(new_units)
 
         self.units = new_units
-        self *= conversion_factor
+        values = self.d
+        values *= conversion_factor
 
         if offset:
             np.subtract(self, offset*self.uq, self)
@@ -1309,7 +1310,7 @@
     Parameters
     ----------
     fname : str
-        Filename to read. 
+        Filename to read.
     dtype : data-type, optional
         Data-type of the resulting array; default: float.
     delimiter : str, optional
@@ -1367,7 +1368,7 @@
             footer='', comments='#'):
     r"""
     Write YTArrays with unit information to a text file.
-    
+
     Parameters
     ----------
     fname : str
@@ -1375,7 +1376,7 @@
     arrays : list of YTArrays or single YTArray
         The array(s) to write to the file.
     fmt : str or sequence of strs, optional
-        A single format (%10.5f), or a sequence of formats. 
+        A single format (%10.5f), or a sequence of formats.
     delimiter : str, optional
         String or character separating columns.
     header : str, optional

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