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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Nov 10 12:59:56 PST 2014


8 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/effba5d3bf1c/
Changeset:   effba5d3bf1c
Branch:      yt
User:        hegan
Date:        2014-10-09 22:38:19+00:00
Summary:     Allowing enzo to read in active particles that have array attributes
Affected #:  2 files

diff -r 047649b328179cc900ab38f3400390e440530ac1 -r effba5d3bf1c231dbedbe440d82572cd751fd180 yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -31,6 +31,7 @@
 class IOHandlerPackedHDF5(BaseIOHandler):
 
     _dataset_type = "enzo_packed_3d"
+    _array_fields = {}
     _base = slice(None)
 
     def _read_field_names(self, grid):
@@ -80,6 +81,11 @@
                             r"particle_position_%s")
                     x, y, z = (np.asarray(pds.get(pn % ax).value, dtype="=f8")
                                for ax in 'xyz')
+                    for field in field_list:
+                        if np.asarray(pds.get(field)).ndim > 1:
+                            shape = pds.get(field).shape
+                            self._array_fields[field] = shape
+
                     yield ptype, (x, y, z)
             if f: f.close()
 

diff -r 047649b328179cc900ab38f3400390e440530ac1 -r effba5d3bf1c231dbedbe440d82572cd751fd180 yt/utilities/io_handler.py
--- a/yt/utilities/io_handler.py
+++ b/yt/utilities/io_handler.py
@@ -35,6 +35,7 @@
 @add_metaclass(RegisteredIOHandler)
 class BaseIOHandler(object):
     _vector_fields = ()
+    _array_fields = ()
     _dataset_type = None
     _particle_reader = False
 
@@ -160,6 +161,8 @@
         for field in fields:
             if field[1] in self._vector_fields:
                 shape = (fsize[field], 3)
+            elif field[1] in self._array_fields:
+                shape = (fsize[field],)+self._array_fields[field[1]]
             else:
                 shape = (fsize[field], )
             rv[field] = np.empty(shape, dtype="float64")


https://bitbucket.org/yt_analysis/yt/commits/d0cd503cb324/
Changeset:   d0cd503cb324
Branch:      yt
User:        hegan
Date:        2014-10-09 22:53:19+00:00
Summary:     putting the check in read field names instead of particle coords, because it makes more sense there
Affected #:  1 file

diff -r effba5d3bf1c231dbedbe440d82572cd751fd180 -r d0cd503cb324398309c43b522b0636157db2f300 yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -35,6 +35,7 @@
     _base = slice(None)
 
     def _read_field_names(self, grid):
+        print grid.id
         if grid.filename is None: return []
         f = h5py.File(grid.filename, "r")
         group = f["/Grid%08i" % grid.id]
@@ -51,6 +52,13 @@
                     fields.append( ("io", str(name)) )
             else:
                 fields.append( ("enzo", str(name)) )
+        for ptype, field_list in sorted(group['Particles/'].items()):
+            pds = group['Particles/{0}'.format(ptype)]
+            for field in field_list:
+                if np.asarray(pds[field]).ndim > 1:
+                    shape = pds[field].shape
+                    self._array_fields[field] = shape
+
         f.close()
         return fields
 
@@ -81,10 +89,6 @@
                             r"particle_position_%s")
                     x, y, z = (np.asarray(pds.get(pn % ax).value, dtype="=f8")
                                for ax in 'xyz')
-                    for field in field_list:
-                        if np.asarray(pds.get(field)).ndim > 1:
-                            shape = pds.get(field).shape
-                            self._array_fields[field] = shape
 
                     yield ptype, (x, y, z)
             if f: f.close()


https://bitbucket.org/yt_analysis/yt/commits/51ba99cbedc0/
Changeset:   51ba99cbedc0
Branch:      yt
User:        hegan
Date:        2014-10-09 22:54:37+00:00
Summary:     forgot to delete print statement
Affected #:  1 file

diff -r d0cd503cb324398309c43b522b0636157db2f300 -r 51ba99cbedc0ad52ef5f49a8770f0a0187ab0968 yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -35,7 +35,6 @@
     _base = slice(None)
 
     def _read_field_names(self, grid):
-        print grid.id
         if grid.filename is None: return []
         f = h5py.File(grid.filename, "r")
         group = f["/Grid%08i" % grid.id]


https://bitbucket.org/yt_analysis/yt/commits/496866146692/
Changeset:   496866146692
Branch:      yt
User:        hegan
Date:        2014-10-09 22:55:27+00:00
Summary:     removing accidentally added whitespace
Affected #:  1 file

diff -r 51ba99cbedc0ad52ef5f49a8770f0a0187ab0968 -r 496866146692ea88a09faade9affe75294724263 yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -88,7 +88,6 @@
                             r"particle_position_%s")
                     x, y, z = (np.asarray(pds.get(pn % ax).value, dtype="=f8")
                                for ax in 'xyz')
-
                     yield ptype, (x, y, z)
             if f: f.close()
 


https://bitbucket.org/yt_analysis/yt/commits/4d2077532c89/
Changeset:   4d2077532c89
Branch:      yt
User:        hegan
Date:        2014-10-09 22:57:56+00:00
Summary:     combining lines for clarity
Affected #:  1 file

diff -r 496866146692ea88a09faade9affe75294724263 -r 4d2077532c89c4b69fbbdc3588f5524017e045da yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -55,8 +55,7 @@
             pds = group['Particles/{0}'.format(ptype)]
             for field in field_list:
                 if np.asarray(pds[field]).ndim > 1:
-                    shape = pds[field].shape
-                    self._array_fields[field] = shape
+                    self._array_fields[field] = pds[field].shape
 
         f.close()
         return fields


https://bitbucket.org/yt_analysis/yt/commits/94fd67265ef3/
Changeset:   94fd67265ef3
Branch:      yt
User:        hegan
Date:        2014-10-09 23:07:07+00:00
Summary:     added check to make this work even if Particles field doesnt exist
Affected #:  1 file

diff -r 4d2077532c89c4b69fbbdc3588f5524017e045da -r 94fd67265ef3e6fcb8441fbcf56bc911074a313b yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -51,11 +51,13 @@
                     fields.append( ("io", str(name)) )
             else:
                 fields.append( ("enzo", str(name)) )
-        for ptype, field_list in sorted(group['Particles/'].items()):
-            pds = group['Particles/{0}'.format(ptype)]
-            for field in field_list:
-                if np.asarray(pds[field]).ndim > 1:
-                    self._array_fields[field] = pds[field].shape
+
+        if 'Particles' in group.keys():
+            for ptype, field_list in sorted(group['Particles/'].items()):
+                pds = group['Particles/{0}'.format(ptype)]
+                for field in field_list:
+                    if np.asarray(pds[field]).ndim > 1:
+                        self._array_fields[field] = pds[field].shape
 
         f.close()
         return fields


https://bitbucket.org/yt_analysis/yt/commits/313696c644b8/
Changeset:   313696c644b8
Branch:      yt
User:        hegan
Date:        2014-10-09 23:34:26+00:00
Summary:     removing class level dictionary declaration and moving particle array field check from read_fields to read_particle_coords
Affected #:  2 files

diff -r 94fd67265ef3e6fcb8441fbcf56bc911074a313b -r 313696c644b8c2583f2ec76d4347511daad3cfe2 yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -31,7 +31,6 @@
 class IOHandlerPackedHDF5(BaseIOHandler):
 
     _dataset_type = "enzo_packed_3d"
-    _array_fields = {}
     _base = slice(None)
 
     def _read_field_names(self, grid):
@@ -51,14 +50,6 @@
                     fields.append( ("io", str(name)) )
             else:
                 fields.append( ("enzo", str(name)) )
-
-        if 'Particles' in group.keys():
-            for ptype, field_list in sorted(group['Particles/'].items()):
-                pds = group['Particles/{0}'.format(ptype)]
-                for field in field_list:
-                    if np.asarray(pds[field]).ndim > 1:
-                        self._array_fields[field] = pds[field].shape
-
         f.close()
         return fields
 
@@ -89,6 +80,9 @@
                             r"particle_position_%s")
                     x, y, z = (np.asarray(pds.get(pn % ax).value, dtype="=f8")
                                for ax in 'xyz')
+                    for field in field_list:
+                        if np.asarray(pds[field]).ndim > 1:
+                            self._array_fields[field] = pds[field].shape
                     yield ptype, (x, y, z)
             if f: f.close()
 

diff -r 94fd67265ef3e6fcb8441fbcf56bc911074a313b -r 313696c644b8c2583f2ec76d4347511daad3cfe2 yt/utilities/io_handler.py
--- a/yt/utilities/io_handler.py
+++ b/yt/utilities/io_handler.py
@@ -35,7 +35,6 @@
 @add_metaclass(RegisteredIOHandler)
 class BaseIOHandler(object):
     _vector_fields = ()
-    _array_fields = ()
     _dataset_type = None
     _particle_reader = False
 
@@ -44,6 +43,7 @@
         self.ds = ds
         self._last_selector_id = None
         self._last_selector_counts = None
+        self._array_fields = {}
 
     # We need a function for reading a list of sets
     # and a function for *popping* from a queue all the appropriate sets


https://bitbucket.org/yt_analysis/yt/commits/feba284df7fe/
Changeset:   feba284df7fe
Branch:      yt
User:        MatthewTurk
Date:        2014-11-10 20:59:45+00:00
Summary:     Merged in hegan/yt (pull request #1248)

[Minor Enhancement] Allowing enzo frontend to read in active particles that have array attributes
Affected #:  2 files

diff -r 9153a5a32dce19164cc66f8073a26d460aa74cbe -r feba284df7fea6ac46d0329b9ed2a0bfde6487a2 yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -83,6 +83,9 @@
                             r"particle_position_%s")
                     x, y, z = (np.asarray(pds.get(pn % ax).value, dtype="=f8")
                                for ax in 'xyz')
+                    for field in field_list:
+                        if np.asarray(pds[field]).ndim > 1:
+                            self._array_fields[field] = pds[field].shape
                     yield ptype, (x, y, z)
             if f: f.close()
 

diff -r 9153a5a32dce19164cc66f8073a26d460aa74cbe -r feba284df7fea6ac46d0329b9ed2a0bfde6487a2 yt/utilities/io_handler.py
--- a/yt/utilities/io_handler.py
+++ b/yt/utilities/io_handler.py
@@ -43,6 +43,7 @@
         self.ds = ds
         self._last_selector_id = None
         self._last_selector_counts = None
+        self._array_fields = {}
 
     # We need a function for reading a list of sets
     # and a function for *popping* from a queue all the appropriate sets
@@ -160,6 +161,8 @@
         for field in fields:
             if field[1] in self._vector_fields:
                 shape = (fsize[field], 3)
+            elif field[1] in self._array_fields:
+                shape = (fsize[field],)+self._array_fields[field[1]]
             else:
                 shape = (fsize[field], )
             rv[field] = np.empty(shape, dtype="float64")

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