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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sat Sep 24 14:00:34 PDT 2016


3 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/9380c2c09e07/
Changeset:   9380c2c09e07
Branch:      yt
User:        ngoldbaum
Date:        2016-09-05 15:57:03+00:00
Summary:     Fix type issue in octree construction. Closes #1272
Affected #:  2 files

diff -r 068ad05bda58e31a1684d907398a61ce93fd595c -r 9380c2c09e078c7a706d068958d7df74ebdbe491 yt/frontends/stream/tests/test_stream_octree.py
--- /dev/null
+++ b/yt/frontends/stream/tests/test_stream_octree.py
@@ -0,0 +1,26 @@
+import yt
+import numpy as np
+
+OCT_MASK_LIST = [8, 0, 0, 0, 0, 8, 0, 0,
+                 0, 0, 0, 0, 0, 0, 0, 0,
+                 8, 0, 0, 0, 0, 0, 0, 0,
+                 0]
+
+
+def test_octree():
+    # See Issue #1272
+    octree_mask = np.array(OCT_MASK_LIST, dtype=np.uint8)
+
+    quantities = {}
+    quantities[('gas', 'density')] = np.ones((22, 1), dtype=float)
+
+    bbox = np.array([[-10., 10.], [-10., 10.], [-10., 10.]])
+
+    ds = yt.load_octree(octree_mask=octree_mask,
+                        data=quantities,
+                        bbox=bbox,
+                        over_refine_factor=0,
+                        partial_coverage=0)
+
+    proj = ds.proj('density', 'x')
+    proj['density']

diff -r 068ad05bda58e31a1684d907398a61ce93fd595c -r 9380c2c09e078c7a706d068958d7df74ebdbe491 yt/geometry/oct_visitors.pxd
--- a/yt/geometry/oct_visitors.pxd
+++ b/yt/geometry/oct_visitors.pxd
@@ -100,7 +100,7 @@
 
 cdef class FillFileIndicesO(OctVisitor):
     cdef np.uint8_t[:] levels
-    cdef np.uint8_t[:] file_inds
+    cdef np.int64_t[:] file_inds
     cdef np.uint8_t[:] cell_inds
 
 cdef class FillFileIndicesR(OctVisitor):


https://bitbucket.org/yt_analysis/yt/commits/67d9c9260497/
Changeset:   67d9c9260497
Branch:      yt
User:        ngoldbaum
Date:        2016-09-23 17:51:20+00:00
Summary:     update load_octree docstrings
Affected #:  1 file

diff -r 9380c2c09e078c7a706d068958d7df74ebdbe491 -r 67d9c9260497877eb4aa57f8d935eb4106cd85e4 yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -1497,10 +1497,13 @@
     Parameters
     ----------
     octree_mask : np.ndarray[uint8_t]
-        This is a depth-first refinement mask for an Octree.  It should be of
-        size n_octs * 8, where each item is 1 for an oct-cell being refined and
-        0 for it not being refined.  Note that for over_refine_factors != 1,
-        the children count will still be 8, so this is always 8.
+        This is a depth-first refinement mask for an Octree.  It should be 
+        of size n_octs * 8 (but see note about the root oct below), where 
+        each item is 1 for an oct-cell being refined and 0 for it not being
+        refined.  For over_refine_factors != 1, the children count will 
+        still be 8, so there will stil be n_octs * 8 entries. Note that if 
+        the root oct is not refined, there will be only one entry
+        for the root, so the size of the mask will be (n_octs - 1)*8 + 1.
     data : dict
         A dictionary of 1D arrays.  Note that these must of the size of the
         number of "False" values in the ``octree_mask``.
@@ -1522,8 +1525,29 @@
         Determines whether the data will be treated as periodic along
         each axis
     partial_coverage : boolean
-        Whether or not an oct can be refined cell-by-cell, or whether all 8 get
-        refined.
+        Whether or not an oct can be refined cell-by-cell, or whether all 
+        8 get refined.
+
+    Example
+    -------
+
+    >>> import yt
+    >>> import numpy as np
+    >>> oct_mask = [8, 0, 0, 0, 0, 8, 0, 8,
+    ...             0, 0, 0, 0, 0, 0, 0, 0,
+    ...             8, 0, 0, 0, 0, 0, 0, 0,
+    ...             0]
+    >>>
+    >>> octree_mask = np.array(oct_mask, dtype=np.uint8)
+    >>> quantities = {}
+    >>> quantities['gas', 'density'] = np.random.random((22, 1), dtype='f8')
+    >>> bbox = np.array([[-10., 10.], [-10., 10.], [-10., 10.]])
+    >>>
+    >>> ds = yt.load_octree(octree_mask=octree_mask,
+    ...                     data=quantities,
+    ...                     bbox=bbox,
+    ...                     over_refine_factor=0,
+    ...                     partial_coverage=0)
 
     """
 


https://bitbucket.org/yt_analysis/yt/commits/af34b428166a/
Changeset:   af34b428166a
Branch:      yt
User:        xarthisius
Date:        2016-09-24 21:00:06+00:00
Summary:     Merged in ngoldbaum/yt (pull request #2362)

Fix type issue in octree construction. Closes #1272
Affected #:  3 files

diff -r 71960f84ae9d3e12d70759e342b2bc581581674c -r af34b428166a02df3f069fa33f5df3ca8cf58545 yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -1497,10 +1497,13 @@
     Parameters
     ----------
     octree_mask : np.ndarray[uint8_t]
-        This is a depth-first refinement mask for an Octree.  It should be of
-        size n_octs * 8, where each item is 1 for an oct-cell being refined and
-        0 for it not being refined.  Note that for over_refine_factors != 1,
-        the children count will still be 8, so this is always 8.
+        This is a depth-first refinement mask for an Octree.  It should be 
+        of size n_octs * 8 (but see note about the root oct below), where 
+        each item is 1 for an oct-cell being refined and 0 for it not being
+        refined.  For over_refine_factors != 1, the children count will 
+        still be 8, so there will stil be n_octs * 8 entries. Note that if 
+        the root oct is not refined, there will be only one entry
+        for the root, so the size of the mask will be (n_octs - 1)*8 + 1.
     data : dict
         A dictionary of 1D arrays.  Note that these must of the size of the
         number of "False" values in the ``octree_mask``.
@@ -1522,8 +1525,29 @@
         Determines whether the data will be treated as periodic along
         each axis
     partial_coverage : boolean
-        Whether or not an oct can be refined cell-by-cell, or whether all 8 get
-        refined.
+        Whether or not an oct can be refined cell-by-cell, or whether all 
+        8 get refined.
+
+    Example
+    -------
+
+    >>> import yt
+    >>> import numpy as np
+    >>> oct_mask = [8, 0, 0, 0, 0, 8, 0, 8,
+    ...             0, 0, 0, 0, 0, 0, 0, 0,
+    ...             8, 0, 0, 0, 0, 0, 0, 0,
+    ...             0]
+    >>>
+    >>> octree_mask = np.array(oct_mask, dtype=np.uint8)
+    >>> quantities = {}
+    >>> quantities['gas', 'density'] = np.random.random((22, 1), dtype='f8')
+    >>> bbox = np.array([[-10., 10.], [-10., 10.], [-10., 10.]])
+    >>>
+    >>> ds = yt.load_octree(octree_mask=octree_mask,
+    ...                     data=quantities,
+    ...                     bbox=bbox,
+    ...                     over_refine_factor=0,
+    ...                     partial_coverage=0)
 
     """
 

diff -r 71960f84ae9d3e12d70759e342b2bc581581674c -r af34b428166a02df3f069fa33f5df3ca8cf58545 yt/frontends/stream/tests/test_stream_octree.py
--- /dev/null
+++ b/yt/frontends/stream/tests/test_stream_octree.py
@@ -0,0 +1,26 @@
+import yt
+import numpy as np
+
+OCT_MASK_LIST = [8, 0, 0, 0, 0, 8, 0, 0,
+                 0, 0, 0, 0, 0, 0, 0, 0,
+                 8, 0, 0, 0, 0, 0, 0, 0,
+                 0]
+
+
+def test_octree():
+    # See Issue #1272
+    octree_mask = np.array(OCT_MASK_LIST, dtype=np.uint8)
+
+    quantities = {}
+    quantities[('gas', 'density')] = np.ones((22, 1), dtype=float)
+
+    bbox = np.array([[-10., 10.], [-10., 10.], [-10., 10.]])
+
+    ds = yt.load_octree(octree_mask=octree_mask,
+                        data=quantities,
+                        bbox=bbox,
+                        over_refine_factor=0,
+                        partial_coverage=0)
+
+    proj = ds.proj('density', 'x')
+    proj['density']

diff -r 71960f84ae9d3e12d70759e342b2bc581581674c -r af34b428166a02df3f069fa33f5df3ca8cf58545 yt/geometry/oct_visitors.pxd
--- a/yt/geometry/oct_visitors.pxd
+++ b/yt/geometry/oct_visitors.pxd
@@ -100,7 +100,7 @@
 
 cdef class FillFileIndicesO(OctVisitor):
     cdef np.uint8_t[:] levels
-    cdef np.uint8_t[:] file_inds
+    cdef np.int64_t[:] file_inds
     cdef np.uint8_t[:] cell_inds
 
 cdef class FillFileIndicesR(OctVisitor):

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