]> git.donarmstrong.com Git - neurodebian.git/commitdiff
Help stats script to deal with fresh ubuntu precise
authorMichael Hanke <michael.hanke@gmail.com>
Wed, 2 May 2012 13:26:15 +0000 (15:26 +0200)
committerMichael Hanke <michael.hanke@gmail.com>
Wed, 2 May 2012 13:26:15 +0000 (15:26 +0200)
tools/nd_apachelogs2subscriptionstats

index f7962ba24fcda13b14203c27b749af5e8d0d89e0..0bae742a45c2db947134231ac57c28eac41c8e81 100755 (executable)
@@ -47,6 +47,10 @@ def plot_datehist(ax, data, bins, suites, title=None, ymax=None):
         # make approx monthly bins, smaller bins yield spiky curves
         # needs new=True to work with oldish numpy
         (hist, bin_edges) = np.histogram(dates, np.ceil(history_length/30.), new=True)
+        if len(bin_edges) < 2:
+            # protect against single data point entries by ignoring them
+            # wouldn't be able to draw a line anyway ;-)
+            continue
         width = bin_edges[1] - bin_edges[0]
         # think lines
         ax.plot(bin_edges[:-1]+(width/2), hist / width,