<html><body>
<p>5 new commits in yt:</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/796a8ea1be68/">https://bitbucket.org/yt_analysis/yt/commits/796a8ea1be68/</a> Changeset:   796a8ea1be68 Branch:      yt User:        MatthewTurk Date:        2016-04-30 20:25:52+00:00 Summary:     Add a categorize_particles function that returns Oct IDs and info. Affected #:  1 file</p>
<p>diff -r 2d7b93e59428f2dc6d4cde5030cacc4b113c6ea4 -r 796a8ea1be686fda1273356b752569abc2be1836 yt/geometry/oct_container.pyx --- a/yt/geometry/oct_container.pyx +++ b/yt/geometry/oct_container.pyx @@ -317,6 +317,36 @@</p>
<pre>        oinfo.level = level
        return cur
</pre>
<p>+    def locate_positions(self, np.float64_t[:,:] positions): +        cdef np.float64_t factor = (1 << self.oref) +        cdef dict all_octs = {} +        cdef OctInfo oi +        cdef Oct* o = NULL +        cdef np.float64_t pos[3] +        cdef np.ndarray[np.uint8_t, ndim=1] recorded +        cdef np.ndarray[np.int64_t, ndim=1] oct_id +        oct_id = np.ones(positions.shape[0], dtype="int64") * -1 +        recorded = np.zeros(self.nocts, dtype="uint8") +        cdef np.int64_t i, j, k +        for i in range(positions.shape[0]): +            for j in range(3): +                pos[j] = positions[i,j] +            o = self.get(pos, &oi) +            if o == NULL: +                raise RuntimeError +            if recorded[o.domain_ind] == 0: +                left_edge = np.asarray(<np.float64_t[:3]>oi.left_edge) +                dds = np.asarray(<np.float64_t[:3]>oi.dds) +                right_edge = left_edge + dds*factor +                all_octs[o.domain_ind] = dict( +                    left_edge = left_edge, +                    right_edge = right_edge, +                    level = oi.level +                ) +                recorded[o.domain_ind] = 1 +            oct_id[i] = o.domain_ind +        return oct_id, all_octs +</p>
<pre>def domain_identify(self, SelectorObject selector):
    cdef np.ndarray[np.uint8_t, ndim=1] domain_mask
    domain_mask = np.zeros(self.num_domains, dtype="uint8")</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/c1b06d90ba89/">https://bitbucket.org/yt_analysis/yt/commits/c1b06d90ba89/</a> Changeset:   c1b06d90ba89 Branch:      yt User:        MatthewTurk Date:        2016-05-01 20:49:07+00:00 Summary:     Adding a test for position_locator Affected #:  1 file</p>
<p>diff -r 796a8ea1be686fda1273356b752569abc2be1836 -r c1b06d90ba89efbeafa2bda7847c4d593bd0c13a yt/geometry/tests/test_particle_octree.py --- a/yt/geometry/tests/test_particle_octree.py +++ b/yt/geometry/tests/test_particle_octree.py @@ -209,6 +209,24 @@</p>
<pre>        i[0](*i[1:])
    time.sleep(1)
</pre>
<p>+def test_position_location(): +    np.random.seed(int(0x4d3d3d3)) +    pos = np.random.normal(0.5, scale=0.05, size=(NPART,3)) * (DRE-DLE) + DLE +    # Now convert to integers +    data = {} +    bbox = [] +    for i, ax in enumerate('xyz'): +        np.clip(pos[:,i], DLE[i], DRE[i], pos[:,i]) +        bbox.append([DLE[i], DRE[i]]) +        data["particle_position_%s" % ax] = pos[:,i] +    bbox = np.array(bbox) +    ds = load_particles(data, 1.0, bbox = bbox, over_refine_factor = 2) +    oct_id, all_octs = ds.index.oct_handler.locate_positions(pos) +    for oi in sorted(all_octs): +        this_oct = pos[oct_id == oi] +        assert(np.all(this_oct >= all_octs[oi]["left_edge"])) +        assert(np.all(this_oct <= all_octs[oi]["right_edge"])) +</p>
<pre>os33 = "snapshot_033/snap_033.0.hdf5"
@requires_file(os33)
def test_get_smallest_dx():</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/cde44a02d553/">https://bitbucket.org/yt_analysis/yt/commits/cde44a02d553/</a> Changeset:   cde44a02d553 Branch:      yt User:        MatthewTurk Date:        2016-05-02 15:40:36+00:00 Summary:     Copy the arrays Affected #:  1 file</p>
<p>diff -r c1b06d90ba89efbeafa2bda7847c4d593bd0c13a -r cde44a02d5534283f922387b6b49df03774189d0 yt/geometry/oct_container.pyx --- a/yt/geometry/oct_container.pyx +++ b/yt/geometry/oct_container.pyx @@ -335,8 +335,8 @@</p>
<pre>if o == NULL:
    raise RuntimeError
if recorded[o.domain_ind] == 0:</pre>
<ul><li><p>left_edge = np.asarray(<np.float64_t[:3]>oi.left_edge)</p></li>
<li><p>dds = np.asarray(<np.float64_t[:3]>oi.dds)</p></li></ul>
<p>+                left_edge = np.asarray(<np.float64_t[:3]>oi.left_edge).copy() +                dds = np.asarray(<np.float64_t[:3]>oi.dds).copy()</p>
<pre>right_edge = left_edge + dds*factor
all_octs[o.domain_ind] = dict(
    left_edge = left_edge,</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/410a6b83d2d4/">https://bitbucket.org/yt_analysis/yt/commits/410a6b83d2d4/</a> Changeset:   410a6b83d2d4 Branch:      yt User:        MatthewTurk Date:        2016-05-05 21:37:51+00:00 Summary:     Adding docstring Affected #:  1 file</p>
<p>diff -r cde44a02d5534283f922387b6b49df03774189d0 -r 410a6b83d2d4551ca40c42c3c1e80facfbae974a yt/geometry/oct_container.pyx --- a/yt/geometry/oct_container.pyx +++ b/yt/geometry/oct_container.pyx @@ -318,6 +318,11 @@</p>
<pre>        return cur

    def locate_positions(self, np.float64_t[:,:] positions):</pre>
<p>+        """ +        This routine, meant to be called by other internal routines, returns a +        list of oct IDs and a dictionary of Oct info for all the positions +        supplied.  Positions must be in code_length. +        """</p>
<pre>cdef np.float64_t factor = (1 << self.oref)
cdef dict all_octs = {}
cdef OctInfo oi</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/cb216de0db74/">https://bitbucket.org/yt_analysis/yt/commits/cb216de0db74/</a> Changeset:   cb216de0db74 Branch:      yt User:        chummels Date:        2016-05-05 21:53:29+00:00 Summary:     Merged in MatthewTurk/yt (pull request #2154)</p>
<p>Add a position location method for octrees Affected #:  2 files</p>
<p>diff -r 2f2c9e84c335e5d4be9c4eac86b1f67aed7e752f -r cb216de0db743757a486ff0e90713812a6fb3e16 yt/geometry/oct_container.pyx --- a/yt/geometry/oct_container.pyx +++ b/yt/geometry/oct_container.pyx @@ -317,6 +317,41 @@</p>
<pre>        oinfo.level = level
        return cur
</pre>
<p>+    def locate_positions(self, np.float64_t[:,:] positions): +        """ +        This routine, meant to be called by other internal routines, returns a +        list of oct IDs and a dictionary of Oct info for all the positions +        supplied.  Positions must be in code_length. +        """ +        cdef np.float64_t factor = (1 << self.oref) +        cdef dict all_octs = {} +        cdef OctInfo oi +        cdef Oct* o = NULL +        cdef np.float64_t pos[3] +        cdef np.ndarray[np.uint8_t, ndim=1] recorded +        cdef np.ndarray[np.int64_t, ndim=1] oct_id +        oct_id = np.ones(positions.shape[0], dtype="int64") * -1 +        recorded = np.zeros(self.nocts, dtype="uint8") +        cdef np.int64_t i, j, k +        for i in range(positions.shape[0]): +            for j in range(3): +                pos[j] = positions[i,j] +            o = self.get(pos, &oi) +            if o == NULL: +                raise RuntimeError +            if recorded[o.domain_ind] == 0: +                left_edge = np.asarray(<np.float64_t[:3]>oi.left_edge).copy() +                dds = np.asarray(<np.float64_t[:3]>oi.dds).copy() +                right_edge = left_edge + dds*factor +                all_octs[o.domain_ind] = dict( +                    left_edge = left_edge, +                    right_edge = right_edge, +                    level = oi.level +                ) +                recorded[o.domain_ind] = 1 +            oct_id[i] = o.domain_ind +        return oct_id, all_octs +</p>
<pre>def domain_identify(self, SelectorObject selector):
    cdef np.ndarray[np.uint8_t, ndim=1] domain_mask
    domain_mask = np.zeros(self.num_domains, dtype="uint8")</pre>
<p>diff -r 2f2c9e84c335e5d4be9c4eac86b1f67aed7e752f -r cb216de0db743757a486ff0e90713812a6fb3e16 yt/geometry/tests/test_particle_octree.py --- a/yt/geometry/tests/test_particle_octree.py +++ b/yt/geometry/tests/test_particle_octree.py @@ -209,6 +209,24 @@</p>
<pre>        i[0](*i[1:])
    time.sleep(1)
</pre>
<p>+def test_position_location(): +    np.random.seed(int(0x4d3d3d3)) +    pos = np.random.normal(0.5, scale=0.05, size=(NPART,3)) * (DRE-DLE) + DLE +    # Now convert to integers +    data = {} +    bbox = [] +    for i, ax in enumerate('xyz'): +        np.clip(pos[:,i], DLE[i], DRE[i], pos[:,i]) +        bbox.append([DLE[i], DRE[i]]) +        data["particle_position_%s" % ax] = pos[:,i] +    bbox = np.array(bbox) +    ds = load_particles(data, 1.0, bbox = bbox, over_refine_factor = 2) +    oct_id, all_octs = ds.index.oct_handler.locate_positions(pos) +    for oi in sorted(all_octs): +        this_oct = pos[oct_id == oi] +        assert(np.all(this_oct >= all_octs[oi]["left_edge"])) +        assert(np.all(this_oct <= all_octs[oi]["right_edge"])) +</p>
<pre>os33 = "snapshot_033/snap_033.0.hdf5"
@requires_file(os33)
def test_get_smallest_dx():</pre>
<p>Repository URL: <a href="https://bitbucket.org/yt_analysis/yt/">https://bitbucket.org/yt_analysis/yt/</a></p>
<p>—</p>
<p>This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.</p>

<img src="http://link.bitbucket.org/wf/open?upn=ll4ctv0L-2ByeRZFC1LslHcg6aJmnQ70VruLbmeLQr27C4CfbCalOL9H6i47zYN7awhtXGn8nV4jbbajUr5UOwZ9txB0fg70ET-2FJI8RUS1mHIzExtbURiroWSr0V-2BbfjeZDea1pLddoiVo6F7HOYxQHGhb-2FwNowgPdmxdysgjeUviUpjpkFy2EjYzeCzWWVh2TPoCuT9BiFJ-2FT3Ht9UH8QQXh0mbTS9DfQRgpcN10i8iE-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;"/>
</body></html>