diff SMART/Java/Python/plot.py @ 18:94ab73e8a190

Uploaded
author m-zytnicki
date Mon, 29 Apr 2013 03:20:15 -0400
parents 769e306b7933
children
line wrap: on
line diff
--- a/SMART/Java/Python/plot.py	Mon Apr 22 11:11:10 2013 -0400
+++ b/SMART/Java/Python/plot.py	Mon Apr 29 03:20:15 2013 -0400
@@ -134,7 +134,11 @@
         values   = dict([i * step + minValue, 0] for i in range(0, self.nbBars))
         top      = (self.nbBars - 1) * step + minValue
         for key, value in line.iteritems():
-            newKey = min(top, int(math.floor((key - minValue) / float(maxValue - minValue) * self.nbBars)) * step + minValue)
+            divisor = float(maxValue - minValue) * self.nbBars
+            tmpMinValue = top
+            if divisor != 0:
+                tmpMinValue = min(top, int(math.floor((key - minValue) / divisor)))
+            newKey =  tmpMinValue * step + minValue
             values[newKey] += value
         return values