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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sun May 7 19:58:35 PDT 2017


3 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/638324574add/
Changeset:   638324574add
User:        atmyers
Date:        2017-05-05 23:37:37+00:00
Summary:     smarter logic in setting the node / element fields.
Affected #:  1 file

diff -r e7e94f63f352eb34eedc0ebf17bbd7711ac993d1 -r 638324574add390c642531a92834816c48e20142 yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -1880,8 +1880,11 @@
         fluid_types += ['connect%d' % i]
     sds.fluid_types = tuple(fluid_types)
 
-    sds._node_fields = [[f[1] for f in m][0] for m in node_data if m]
-    sds._elem_fields = [[f[1] for f in m][0] for m in elem_data if m]
+    def flatten(l):
+        return [item for sublist in l for item in sublist]
+
+    sds._node_fields = flatten([[f[1] for f in m] for m in node_data if m])
+    sds._elem_fields = flatten([[f[1] for f in m] for m in elem_data if m])
     sds.default_field = [f for f in sds.field_list
                          if f[0] == 'connect1'][-1]
 


https://bitbucket.org/yt_analysis/yt/commits/4fe99f3e1b91/
Changeset:   4fe99f3e1b91
User:        atmyers
Date:        2017-05-05 23:39:40+00:00
Summary:     Add a test for the case where we have more than one nodal field.
Affected #:  1 file

diff -r 638324574add390c642531a92834816c48e20142 -r 4fe99f3e1b91bf10ac2ba3126f8a2dd019c209a8 yt/frontends/stream/tests/test_stream_unstructured.py
--- a/yt/frontends/stream/tests/test_stream_unstructured.py
+++ b/yt/frontends/stream/tests/test_stream_unstructured.py
@@ -26,3 +26,25 @@
     sl = SlicePlot(ds, 'z', ('all', 'test'))
     sl.annotate_mesh_lines()
 
+def test_multi_field():
+    coords = np.array([[0.0, 0.0],
+                       [1.0, 0.0],
+                       [1.0, 1.0],
+                       [0.0, 1.0]], dtype=np.float64)
+    
+    connect = np.array([[0, 1, 3],
+                        [1, 2, 3]], dtype=np.int64)
+
+    data = {}
+    data['connect1', 'test']      = np.array([[0.0, 1.0, 3.0],
+                                              [1.0, 2.0, 3.0]], dtype=np.float64)
+    data['connect1', 'testAgain'] = np.array([[0.0, 1.0, 3.0],
+                                              [1.0, 2.0, 3.0]], dtype=np.float64)
+    
+    ds = load_unstructured_mesh(connect, coords, data)
+    
+    sl = SlicePlot(ds, 'z', 'test')
+    sl.annotate_mesh_lines()
+
+    sl = SlicePlot(ds, 'z', 'testAgain')
+    sl.annotate_mesh_lines()


https://bitbucket.org/yt_analysis/yt/commits/dc5a133d889a/
Changeset:   dc5a133d889a
User:        ngoldbaum
Date:        2017-05-08 02:58:24+00:00
Summary:     Merge pull request #1375 from atmyers/master

[Bugfix] Meshes with multiple fields in the streaming unstructured frontend
Affected #:  2 files

diff -r 58d0040aad81f45b010a8ac67b41893c7fb6df24 -r dc5a133d889a42da6135a8d8c0eb578e2e7a70bd yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -1880,8 +1880,11 @@
         fluid_types += ['connect%d' % i]
     sds.fluid_types = tuple(fluid_types)
 
-    sds._node_fields = [[f[1] for f in m][0] for m in node_data if m]
-    sds._elem_fields = [[f[1] for f in m][0] for m in elem_data if m]
+    def flatten(l):
+        return [item for sublist in l for item in sublist]
+
+    sds._node_fields = flatten([[f[1] for f in m] for m in node_data if m])
+    sds._elem_fields = flatten([[f[1] for f in m] for m in elem_data if m])
     sds.default_field = [f for f in sds.field_list
                          if f[0] == 'connect1'][-1]
 

diff -r 58d0040aad81f45b010a8ac67b41893c7fb6df24 -r dc5a133d889a42da6135a8d8c0eb578e2e7a70bd yt/frontends/stream/tests/test_stream_unstructured.py
--- a/yt/frontends/stream/tests/test_stream_unstructured.py
+++ b/yt/frontends/stream/tests/test_stream_unstructured.py
@@ -26,3 +26,25 @@
     sl = SlicePlot(ds, 'z', ('all', 'test'))
     sl.annotate_mesh_lines()
 
+def test_multi_field():
+    coords = np.array([[0.0, 0.0],
+                       [1.0, 0.0],
+                       [1.0, 1.0],
+                       [0.0, 1.0]], dtype=np.float64)
+    
+    connect = np.array([[0, 1, 3],
+                        [1, 2, 3]], dtype=np.int64)
+
+    data = {}
+    data['connect1', 'test']      = np.array([[0.0, 1.0, 3.0],
+                                              [1.0, 2.0, 3.0]], dtype=np.float64)
+    data['connect1', 'testAgain'] = np.array([[0.0, 1.0, 3.0],
+                                              [1.0, 2.0, 3.0]], dtype=np.float64)
+    
+    ds = load_unstructured_mesh(connect, coords, data)
+    
+    sl = SlicePlot(ds, 'z', 'test')
+    sl.annotate_mesh_lines()
+
+    sl = SlicePlot(ds, 'z', 'testAgain')
+    sl.annotate_mesh_lines()

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