Allow None values for plot clicks or SI values
authorW. Trevor King <wking@drexel.edu>
Tue, 10 Aug 2010 12:33:32 +0000 (08:33 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 10 Aug 2010 12:33:32 +0000 (08:33 -0400)
hooke/ui/gui/panel/plot.py
hooke/util/si.py

index 66cc64da4d1c2653b546b15512bddec153ef673d..602ee650024f5c3c6b5820c941e6a75dc385e4d9 100644 (file)
@@ -189,6 +189,8 @@ class PlotPanel (Panel, wx.Panel):
             return
         d = self._config.get('plot decimals', 2)
         x,y = (event.xdata, event.ydata)
+        if None in [x, y]:
+            return
         xt = ppSI(value=x, unit=self._x_unit, decimals=d)
         yt = ppSI(value=y, unit=self._y_unit, decimals=d)
         point_indexes = []
index 48fe4e0c87d7fbb1f725a382325f8223edbb30b7..ac3e633746571177bb1e8c2f83d214fc8704d8de 100644 (file)
@@ -111,7 +111,7 @@ def ppSI(value, unit='', decimals=None, power=None, pad=False):
     """
     if value == 0:
         return '0'
-    if isnan(value):
+    if value == None or isnan(value):
         return 'NaN'
 
     if power == None:  # auto-detect power