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

Bitbucket commits-noreply at bitbucket.org
Fri Apr 6 02:38:28 PDT 2012


2 new commits in yt:


https://bitbucket.org/yt_analysis/yt/changeset/7ace7c2f5563/
changeset:   7ace7c2f5563
branch:      yt
user:        MatthewTurk
date:        2012-04-06 11:37:29
summary:     Adding a check that the hash of a parameter file in Enzo must match a stored
parameter file to use the binary hierarchy.  This invalidates existing binary
hierarchies, which may result in a small overhead on the next initialization of
yt for Enzo users.
affected #:  2 files

diff -r 2af699ff04a4d28d0494cd18f727a3a0b7f6a2e5 -r 7ace7c2f556354c150546f4e90010fb22e922b62 yt/data_objects/hierarchy.py
--- a/yt/data_objects/hierarchy.py
+++ b/yt/data_objects/hierarchy.py
@@ -337,18 +337,6 @@
             del self._data_file
             self._data_file = None
 
-    def _deserialize_hierarchy(self, harray):
-        # THIS IS BROKEN AND NEEDS TO BE FIXED
-        mylog.debug("Cached entry found.")
-        self.gridDimensions[:] = harray[:,0:3]
-        self.gridStartIndices[:] = harray[:,3:6]
-        self.gridEndIndices[:] = harray[:,6:9]
-        self.gridLeftEdge[:] = harray[:,9:12]
-        self.gridRightEdge[:] = harray[:,12:15]
-        self.gridLevels[:] = harray[:,15:16]
-        self.gridTimes[:] = harray[:,16:17]
-        self.gridNumberOfParticles[:] = harray[:,17:18]
-
     def get_smallest_dx(self):
         """
         Returns (in code units) the smallest cell size in the simulation.


diff -r 2af699ff04a4d28d0494cd18f727a3a0b7f6a2e5 -r 7ace7c2f556354c150546f4e90010fb22e922b62 yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -354,6 +354,11 @@
             f = h5py.File(self.hierarchy_filename[:-9] + "harrays")
         except:
             return False
+        hash = f["/"].attrs.get("hash", None)
+        if hash != self.parameter_file._hash():
+            mylog.info("Binary hierarchy does not match: recreating")
+            f.close()
+            return False
         self.grid_dimensions[:] = f["/ActiveDimensions"][:]
         self.grid_left_edge[:] = f["/LeftEdges"][:]
         self.grid_right_edge[:] = f["/RightEdges"][:]
@@ -390,6 +395,7 @@
             f = h5py.File(self.hierarchy_filename[:-9] + "harrays", "w")
         except IOError:
             return
+        f["/"].attrs["hash"] = self.parameter_file._hash()
         f.create_dataset("/LeftEdges", data=self.grid_left_edge)
         f.create_dataset("/RightEdges", data=self.grid_right_edge)
         parents, procs, levels = [], [], []



https://bitbucket.org/yt_analysis/yt/changeset/3a59901021ed/
changeset:   3a59901021ed
branch:      yt
user:        MatthewTurk
date:        2012-04-06 11:38:18
summary:     Merge
affected #:  1 file

diff -r 7ace7c2f556354c150546f4e90010fb22e922b62 -r 3a59901021ed0e0caba2130043ecda61b720f67b yt/analysis_modules/two_point_functions/two_point_functions.py
--- a/yt/analysis_modules/two_point_functions/two_point_functions.py
+++ b/yt/analysis_modules/two_point_functions/two_point_functions.py
@@ -23,6 +23,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
+import h5py
 from yt.mods import *
 #from yt.utilities.math_utils import *
 from yt.utilities.performance_counters import yt_counters, time_function

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