[yt-svn] commit/yt-3.0: MatthewTurk: This backports the periodicity fix to yt-3.0 from yt. Additionally, it fixes

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Mar 19 13:04:20 PDT 2013


1 new commit in yt-3.0:

https://bitbucket.org/yt_analysis/yt-3.0/commits/e13c58124602/
changeset:   e13c58124602
branch:      yt-3.0
user:        MatthewTurk
date:        2013-03-19 20:58:16
summary:     This backports the periodicity fix to yt-3.0 from yt.  Additionally, it fixes
failing tests by comparing inside/outside, looking at Radius, and using two
methods of calculating the radius.  Note that this makes the requirements for
cell inclusion in a sphere more strict, mandating that the cell center is
enclosed, not just any of the eight corners.
affected #:  3 files

diff -r 3f43eabe2b7c0fb88452542a9ff867830564540c -r e13c58124602c20675ac73b5b3e9548b5f5b034b yt/data_objects/universal_fields.py
--- a/yt/data_objects/universal_fields.py
+++ b/yt/data_objects/universal_fields.py
@@ -1,4 +1,5 @@
 """
+
 The basic field info container resides here.  These classes, code specific and
 universal, are the means by which we access fields across YT, both derived and
 native.
@@ -754,8 +755,9 @@
     for i, ax in enumerate('xyz'):
         np.subtract(data["%s%s" % (field_prefix, ax)], center[i], r)
         if data.pf.periodicity[i] == True:
-            np.subtract(DW[i], r, rdw)
             np.abs(r, r)
+            np.subtract(r, DW[i], rdw)
+            np.abs(rdw, rdw)
             np.minimum(r, rdw, r)
         np.power(r, 2.0, r)
         np.add(radius, r, radius)

diff -r 3f43eabe2b7c0fb88452542a9ff867830564540c -r e13c58124602c20675ac73b5b3e9548b5f5b034b yt/geometry/selection_routines.pyx
--- a/yt/geometry/selection_routines.pyx
+++ b/yt/geometry/selection_routines.pyx
@@ -467,7 +467,7 @@
                     temp -= self.domain_width[i]
                 elif temp < -self.domain_width[i]/2.0:
                     temp += self.domain_width[i]
-            temp = temp - fclip(temp, -dds[i]/2.0, dds[i]/2.0)
+            #temp = temp - fclip(temp, -dds[i]/2.0, dds[i]/2.0)
             dist2 += temp*temp
         if dist2 <= self.radius2: return 1
         return 0

diff -r 3f43eabe2b7c0fb88452542a9ff867830564540c -r e13c58124602c20675ac73b5b3e9548b5f5b034b yt/utilities/tests/test_selectors.py
--- a/yt/utilities/tests/test_selectors.py
+++ b/yt/utilities/tests/test_selectors.py
@@ -20,7 +20,10 @@
         data = pf.h.sphere(center, 0.25)
         data.get_data()
         # WARNING: this value has not be externally verified
-        yield assert_equal, data.size, 19568
+        dd = pf.h.all_data()
+        dd.set_field_parameter("center", center)
+        n_outside = (dd["RadiusCode"] >= 0.25).sum()
+        assert_equal( data.size + n_outside, dd.size)
 
         positions = np.array([data[ax] for ax in 'xyz'])
         centers = np.tile( data.center, data.shape[0] ).reshape(data.shape[0],3).transpose()
@@ -28,4 +31,4 @@
                          pf.domain_right_edge-pf.domain_left_edge,
                          pf.periodicity)
         # WARNING: this value has not been externally verified
-        yield assert_almost_equal, dist.max(), 0.261806188752
+        yield assert_array_less, dist, 0.25

Repository URL: https://bitbucket.org/yt_analysis/yt-3.0/

--

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