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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sat Jul 16 09:00:54 PDT 2016


3 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/9a22db2e1036/
Changeset:   9a22db2e1036
Branch:      yt
User:        MatthewTurk
Date:        2016-07-16 00:27:44+00:00
Summary:     Adding grid_level and grid_indices for octrees.

Note that this doesn't do a lot for grid_indices for particle datasets, but at
least it doesn't infinitely recurse anymore.
Affected #:  1 file

diff -r 1c339ea7619997cba6842e973cf5f0e13b2f30ee -r 9a22db2e10361771739e2d734407461a3bc4ede1 yt/fields/geometric_fields.py
--- a/yt/fields/geometric_fields.py
+++ b/yt/fields/geometric_fields.py
@@ -51,21 +51,33 @@
 
     def _grid_level(field, data):
         """The AMR refinement level"""
-        return np.ones(data.ActiveDimensions)*(data.Level)
+        arr = np.ones(data.ires.shape, dtype="float64") 
+        arr *= data.ires
+        if data._spatial:
+            return data._reshape_vals(arr)
+        return arr
 
     registry.add_field(("index", "grid_level"),
                        function=_grid_level,
                        units="",
-                       validators=[ValidateGridType(), ValidateSpatial(0)])
+                       validators=[ValidateSpatial(0)])
 
     def _grid_indices(field, data):
         """The index of the leaf grid the mesh cells exist on"""
-        return np.ones(data["index", "ones"].shape)*(data.id-data._id_offset)
+        if hasattr(data, "domain_id"):
+            this_id = data.domain_id
+        else:
+            this_id = data.id - data._id_offset
+        arr = np.ones(data["index", "ones"].shape)
+        arr *= this_id
+        if data._spatial:
+            return data._reshape_vals(arr)
+        return arr
 
     registry.add_field(("index", "grid_indices"),
                        function=_grid_indices,
                        units="",
-                       validators=[ValidateGridType(), ValidateSpatial(0)],
+                       validators=[ValidateSpatial(0)],
                        take_log=False)
 
     def _ones_over_dx(field, data):


https://bitbucket.org/yt_analysis/yt/commits/9ffaf0cfffe8/
Changeset:   9ffaf0cfffe8
Branch:      yt
User:        ngoldbaum
Date:        2016-07-16 04:48:45+00:00
Summary:     Fix test failures
Affected #:  2 files

diff -r 9a22db2e10361771739e2d734407461a3bc4ede1 -r 9ffaf0cfffe819ed160af854eb8e778682ccf1b6 yt/data_objects/tests/test_covering_grid.py
--- a/yt/data_objects/tests/test_covering_grid.py
+++ b/yt/data_objects/tests/test_covering_grid.py
@@ -56,7 +56,7 @@
             # Now we test other attributes
             yield assert_equal, cg["ones"].max(), 1.0
             yield assert_equal, cg["ones"].min(), 1.0
-            yield assert_equal, cg["grid_level"], 0
+            yield assert_equal, cg["grid_level"], level
             yield assert_equal, cg["cell_volume"].sum(), ds.domain_width.prod()
             for g in ds.index.grids:
                 di = g.get_global_startindex()

diff -r 9a22db2e10361771739e2d734407461a3bc4ede1 -r 9ffaf0cfffe819ed160af854eb8e778682ccf1b6 yt/fields/geometric_fields.py
--- a/yt/fields/geometric_fields.py
+++ b/yt/fields/geometric_fields.py
@@ -18,7 +18,6 @@
 
 from .derived_field import \
     ValidateParameter, \
-    ValidateGridType, \
     ValidateSpatial
 
 from .field_functions import \


https://bitbucket.org/yt_analysis/yt/commits/acc390b0a7fe/
Changeset:   acc390b0a7fe
Branch:      yt
User:        xarthisius
Date:        2016-07-16 16:00:24+00:00
Summary:     Merged in MatthewTurk/yt (pull request #2278)

Add grid_levels and grid_indices to octrees.  Closes #993.
Affected #:  2 files

diff -r d893be12e55c80f5fce09fe679cd570b0b7cc1f3 -r acc390b0a7fec1cb38db9030a9f0e22eac2dcbc2 yt/data_objects/tests/test_covering_grid.py
--- a/yt/data_objects/tests/test_covering_grid.py
+++ b/yt/data_objects/tests/test_covering_grid.py
@@ -56,7 +56,7 @@
             # Now we test other attributes
             yield assert_equal, cg["ones"].max(), 1.0
             yield assert_equal, cg["ones"].min(), 1.0
-            yield assert_equal, cg["grid_level"], 0
+            yield assert_equal, cg["grid_level"], level
             yield assert_equal, cg["cell_volume"].sum(), ds.domain_width.prod()
             for g in ds.index.grids:
                 di = g.get_global_startindex()

diff -r d893be12e55c80f5fce09fe679cd570b0b7cc1f3 -r acc390b0a7fec1cb38db9030a9f0e22eac2dcbc2 yt/fields/geometric_fields.py
--- a/yt/fields/geometric_fields.py
+++ b/yt/fields/geometric_fields.py
@@ -18,7 +18,6 @@
 
 from .derived_field import \
     ValidateParameter, \
-    ValidateGridType, \
     ValidateSpatial
 
 from .field_functions import \
@@ -51,21 +50,33 @@
 
     def _grid_level(field, data):
         """The AMR refinement level"""
-        return np.ones(data.ActiveDimensions)*(data.Level)
+        arr = np.ones(data.ires.shape, dtype="float64") 
+        arr *= data.ires
+        if data._spatial:
+            return data._reshape_vals(arr)
+        return arr
 
     registry.add_field(("index", "grid_level"),
                        function=_grid_level,
                        units="",
-                       validators=[ValidateGridType(), ValidateSpatial(0)])
+                       validators=[ValidateSpatial(0)])
 
     def _grid_indices(field, data):
         """The index of the leaf grid the mesh cells exist on"""
-        return np.ones(data["index", "ones"].shape)*(data.id-data._id_offset)
+        if hasattr(data, "domain_id"):
+            this_id = data.domain_id
+        else:
+            this_id = data.id - data._id_offset
+        arr = np.ones(data["index", "ones"].shape)
+        arr *= this_id
+        if data._spatial:
+            return data._reshape_vals(arr)
+        return arr
 
     registry.add_field(("index", "grid_indices"),
                        function=_grid_indices,
                        units="",
-                       validators=[ValidateGridType(), ValidateSpatial(0)],
+                       validators=[ValidateSpatial(0)],
                        take_log=False)
 
     def _ones_over_dx(field, data):

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