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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri May 24 12:39:44 PDT 2013


4 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/57c7417b6dc6/
Changeset:   57c7417b6dc6
Branch:      yt
User:        MatthewTurk
Date:        2013-05-23 19:54:34
Summary:     This fixes a weird bug for DM-only Enzo sims with empty grids being analyzed in parallel.

This now sets the grids such that, if there is no filename associated (i.e., no
baryons, no particles) they will have None for filename.  And then, if filename
is None, it doesn't try to read them during ReadMultipleGrids.

Note that if you have such a run, you would probably have seen a similar bug!
But now this will, I believe in a backwards-compatible way, store your .harrays
correctly.
Affected #:  1 file

diff -r 21c384dd9c6b65666c0c6659b347586b2dd06449 -r 57c7417b6dc68a443c7fbcbb5317ef07908d522c yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -105,6 +105,9 @@
         """
         Intelligently set the filename.
         """
+        if filename is None:
+            self.filename = filename
+            return
         if self.hierarchy._strip_path:
             self.filename = os.path.join(self.hierarchy.directory,
                                          os.path.basename(filename))
@@ -311,6 +314,7 @@
                 if line.startswith("Pointer:"):
                     vv = patt.findall(line)[0]
                     self.__pointer_handler(vv)
+        fn = [f if f >=0 else (None, ) for f in fn]
         pbar.finish()
         self._fill_arrays(ei, si, LE, RE, npart)
         temp_grids = np.empty(self.num_grids, dtype='object')
@@ -373,6 +377,7 @@
         giter = izip(grids, levels, procs, parents)
         bn = self._bn % (self.pf)
         pmap = [(bn % P,) for P in xrange(procs.max()+1)]
+        pmap.append((None, )) # Now, P==-1 will give None
         for grid,L,P,Pid in giter:
             grid.Level = L
             grid._parent_id = Pid


https://bitbucket.org/yt_analysis/yt/commits/dba1d6f64519/
Changeset:   dba1d6f64519
Branch:      yt
User:        MatthewTurk
Date:        2013-05-23 20:16:39
Summary:     Two minor fixes.  Default to None, instead of string "-1" and catch this during
binary hierarchy storing.  This should fix some of Cameron's subsequent issues.
Affected #:  1 file

diff -r 57c7417b6dc68a443c7fbcbb5317ef07908d522c -r dba1d6f645199b13b61a79ba84225309f2e89571 yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -305,7 +305,7 @@
             LE.append(_next_token_line("GridLeftEdge", f))
             RE.append(_next_token_line("GridRightEdge", f))
             nb = int(_next_token_line("NumberOfBaryonFields", f)[0])
-            fn.append(["-1"])
+            fn.append([None])
             if nb > 0: fn[-1] = _next_token_line("BaryonFileName", f)
             npart.append(int(_next_token_line("NumberOfParticles", f)[0]))
             if nb == 0 and npart[-1] > 0: fn[-1] = _next_token_line("ParticleFileName", f)
@@ -314,7 +314,6 @@
                 if line.startswith("Pointer:"):
                     vv = patt.findall(line)[0]
                     self.__pointer_handler(vv)
-        fn = [f if f >=0 else (None, ) for f in fn]
         pbar.finish()
         self._fill_arrays(ei, si, LE, RE, npart)
         temp_grids = np.empty(self.num_grids, dtype='object')
@@ -410,7 +409,10 @@
                 parents.append(g.Parent.id)
             else:
                 parents.append(-1)
-            procs.append(int(self.filenames[i][0][-4:]))
+            if self.filenames[i][0] is None:
+                procs.append(-1)
+            else:
+                procs.append(int(self.filenames[i][0][-4:]))
             levels.append(g.Level)
 
         parents = np.array(parents, dtype='int64')


https://bitbucket.org/yt_analysis/yt/commits/a57f2b4eab0f/
Changeset:   a57f2b4eab0f
Branch:      yt
User:        MatthewTurk
Date:        2013-05-23 20:23:11
Summary:     All of the previous changes are moot without this change.
Affected #:  1 file

diff -r dba1d6f645199b13b61a79ba84225309f2e89571 -r a57f2b4eab0f1b6f0dd02469209f1c57ec6407c7 yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -119,9 +119,13 @@
         files_keys = defaultdict(lambda: [])
         pf_field_list = grids[0].pf.h.field_list
         sets = [dset for dset in list(sets) if dset in pf_field_list]
-        for g in grids: files_keys[g.filename].append(g)
+        for g in grids:
+            files_keys[g.filename].append(g)
         exc = self._read_exception
         for file in files_keys:
+            # This is a funny business with Enzo files that are DM-only,
+            # where grids can have *no* data, but still exist.
+            if file is None: continue
             mylog.debug("Starting read %s (%s)", file, sets)
             nodes = [g.id for g in files_keys[file]]
             nodes.sort()


https://bitbucket.org/yt_analysis/yt/commits/0ca8dcd21df6/
Changeset:   0ca8dcd21df6
Branch:      yt
User:        brittonsmith
Date:        2013-05-24 21:39:36
Summary:     Merged in MatthewTurk/yt (pull request #510)

This fixes a weird bug for DM-only Enzo sims with empty grids being analyzed in parallel.
Affected #:  2 files

diff -r 853203f07769bae913f3f391bbef64689944d823 -r 0ca8dcd21df688a26c90569517fa90254a76341f yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -105,6 +105,9 @@
         """
         Intelligently set the filename.
         """
+        if filename is None:
+            self.filename = filename
+            return
         if self.hierarchy._strip_path:
             self.filename = os.path.join(self.hierarchy.directory,
                                          os.path.basename(filename))
@@ -302,7 +305,7 @@
             LE.append(_next_token_line("GridLeftEdge", f))
             RE.append(_next_token_line("GridRightEdge", f))
             nb = int(_next_token_line("NumberOfBaryonFields", f)[0])
-            fn.append(["-1"])
+            fn.append([None])
             if nb > 0: fn[-1] = _next_token_line("BaryonFileName", f)
             npart.append(int(_next_token_line("NumberOfParticles", f)[0]))
             if nb == 0 and npart[-1] > 0: fn[-1] = _next_token_line("ParticleFileName", f)
@@ -373,6 +376,7 @@
         giter = izip(grids, levels, procs, parents)
         bn = self._bn % (self.pf)
         pmap = [(bn % P,) for P in xrange(procs.max()+1)]
+        pmap.append((None, )) # Now, P==-1 will give None
         for grid,L,P,Pid in giter:
             grid.Level = L
             grid._parent_id = Pid
@@ -405,7 +409,10 @@
                 parents.append(g.Parent.id)
             else:
                 parents.append(-1)
-            procs.append(int(self.filenames[i][0][-4:]))
+            if self.filenames[i][0] is None:
+                procs.append(-1)
+            else:
+                procs.append(int(self.filenames[i][0][-4:]))
             levels.append(g.Level)
 
         parents = np.array(parents, dtype='int64')

diff -r 853203f07769bae913f3f391bbef64689944d823 -r 0ca8dcd21df688a26c90569517fa90254a76341f yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -119,9 +119,13 @@
         files_keys = defaultdict(lambda: [])
         pf_field_list = grids[0].pf.h.field_list
         sets = [dset for dset in list(sets) if dset in pf_field_list]
-        for g in grids: files_keys[g.filename].append(g)
+        for g in grids:
+            files_keys[g.filename].append(g)
         exc = self._read_exception
         for file in files_keys:
+            # This is a funny business with Enzo files that are DM-only,
+            # where grids can have *no* data, but still exist.
+            if file is None: continue
             mylog.debug("Starting read %s (%s)", file, sets)
             nodes = [g.id for g in files_keys[file]]
             nodes.sort()

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