From 6ba2a2509fa3bdf09c705d1d0d96a92b25d9ddc4 Mon Sep 17 00:00:00 2001 From: Michael Hanke Date: Wed, 2 May 2012 15:26:15 +0200 Subject: [PATCH] Help stats script to deal with fresh ubuntu precise --- tools/nd_apachelogs2subscriptionstats | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/nd_apachelogs2subscriptionstats b/tools/nd_apachelogs2subscriptionstats index f7962ba..0bae742 100755 --- a/tools/nd_apachelogs2subscriptionstats +++ b/tools/nd_apachelogs2subscriptionstats @@ -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, -- 2.39.2