[yt-svn] commit/yt: ngoldbaum: Switch to linear colorbar scaling if someone tries to make a PhasePlot with no

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jun 18 13:51:54 PDT 2014


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/5a31577825d9/
Changeset:   5a31577825d9
Branch:      yt-3.0
User:        ngoldbaum
Date:        2014-06-18 21:58:07
Summary:     Switch to linear colorbar scaling if someone tries to make a PhasePlot with no
positive values.
Affected #:  1 file

diff -r 4e6992f76dfc157cfc5a7b2336ac8ed0d14811e2 -r 5a31577825d925d3795e8587a3106771d5b61dae yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -791,8 +791,17 @@
 
             if zlim == (None, None):
                 if z_scale == 'log':
-                    zmin = data[data > 0.0].min()
-                    self._field_transform[f] = log_transform
+                    positive_values = data[data > 0.0]
+                    if len(positive_values) == 0:
+                        mylog.warning("Profiled field %s has no positive "
+                                      "values.  Max = %d." % (f, data.max()))
+                        mylog.warning("Switching to linear colorbar scaling.")
+                        zmin = data.min()
+                        z_scale = 'linear'
+                        self._field_transform[f] = linear_transform
+                    else:
+                        zmin = positive_values.min()
+                        self._field_transform[f] = log_transform
                 else:
                     zmin = data.min()
                     self._field_transform[f] = linear_transform

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