[Yt-svn] commit/yt: jwise77: This avoids crashes if a user tries to take the log of a zero field.

Bitbucket commits-noreply at bitbucket.org
Sun Sep 25 10:27:18 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/3dde3fdb8caa/
changeset:   3dde3fdb8caa
branch:      yt
user:        jwise77
date:        2011-09-25 19:26:29
summary:     This avoids crashes if a user tries to take the log of a zero field.
affected #:  1 file (-1 bytes)

--- a/yt/visualization/plot_types.py	Sat Sep 24 09:39:43 2011 -0600
+++ b/yt/visualization/plot_types.py	Sun Sep 25 13:26:29 2011 -0400
@@ -381,8 +381,12 @@
                     self[self.axis_names["Z"]].max())
         if self.log_field:
             bI = na.where(buff > 0)
-            newmin = na.nanmin(buff[bI])
-            newmax = na.nanmax(buff[bI])
+            if len(bI[0]) == 0:
+                newmin = 1e-99
+                newmax = 1e-99
+            else:
+                newmin = na.nanmin(buff[bI])
+                newmax = na.nanmax(buff[bI])
         else:
             newmin = na.nanmin(buff)
             newmax = na.nanmax(buff)

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