[yt-svn] commit/yt: xarthisius: Merged in hegan/yt (pull request #1311)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Dec 2 12:14:21 PST 2014


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/8d144ae1a0e7/
Changeset:   8d144ae1a0e7
Branch:      yt
User:        xarthisius
Date:        2014-12-02 20:14:10+00:00
Summary:     Merged in hegan/yt (pull request #1311)

[bugfix] First pass at correcting periodic rvec calculation
Affected #:  1 file

diff -r dc2ade03350286b7e54436ac100da00d086c24ae -r 8d144ae1a0e76369339f08b4633a6ef7eb91e7fc yt/fields/field_functions.py
--- a/yt/fields/field_functions.py
+++ b/yt/fields/field_functions.py
@@ -55,8 +55,19 @@
     for i in range(coords.shape[0]):
         if not data.ds.periodicity[i]: continue
         coords[i, ...] -= le[i]
-        coords[i, ...] = np.min([np.abs(np.mod(coords[i, ...],  dw[i])),
-                                 np.abs(np.mod(coords[i, ...], -dw[i]))],
-                                 axis=0)
-        coords[i, ...] += le[i]
+        #figure out which measure is less
+        mins = np.argmin([np.abs(np.mod(coords[i, ...],  dw[i])),
+                         np.abs(np.mod(coords[i, ...], -dw[i]))],
+                         axis=0)
+        temp_coords = np.mod(coords[i, ...], dw[i])
+
+        #Where second measure is better, updating temporary coords
+        ii = mins==1
+        temp_coords[ii] = np.mod(coords[i, ...], -dw[i])[ii]
+
+        # Putting the temporary coords into the actual storage
+        coords[i, ...] = temp_coords
+
+        coords[i, ...] + le[i]
+
     return coords

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