[yt-svn] commit/yt: brittonsmith: Adding a tolerance to the periodic_ray to fix roundoff issues. Thanks

Bitbucket commits-noreply at bitbucket.org
Wed Aug 1 06:31:12 PDT 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/f5bf25f2ca64/
changeset:   f5bf25f2ca64
branch:      yt
user:        brittonsmith
date:        2012-08-01 15:30:59
summary:     Adding a tolerance to the periodic_ray to fix roundoff issues.  Thanks
to Josh Moloney for catching and figuring out a fix.
affected #:  1 file

diff -r 89d481781a2e0a8446da844e084d83fd92ceae4a -r f5bf25f2ca64e874fece921aa360bbd7e3f07ca8 yt/analysis_modules/cosmological_observation/light_ray/light_ray.py
--- a/yt/analysis_modules/cosmological_observation/light_ray/light_ray.py
+++ b/yt/analysis_modules/cosmological_observation/light_ray/light_ray.py
@@ -579,7 +579,7 @@
     this_end = na.copy(end)
     t = 0.0
     tolerance = 1e-6
-    
+
     while t < 1.0 - tolerance:
         hit_left = (this_start <= left) & (vector < 0)
         if (hit_left).any():
@@ -594,6 +594,8 @@
                                 for q in range(start.size)])
         dt = ((nearest - this_start) / vector)[bound].min()
         now = this_start + vector * dt
+        close_enough = na.abs(now - nearest) < 1e-10
+        now[close_enough] = nearest[close_enough]
         segments.append([na.copy(this_start), na.copy(now)])
         this_start = na.copy(now)
         t += dt

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