]> git.donarmstrong.com Git - neurodebian.git/blobdiff - tools/nd_apachelogs2subscriptionstats
More bandwidth.
[neurodebian.git] / tools / nd_apachelogs2subscriptionstats
index b3daf28f26800c4a483fd90fa8b6e5621615c56c..1dd39289084dfc4df023d5331868836ced2e6795 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,
@@ -90,10 +94,6 @@ if __name__ == '__main__':
     if not len(sys.argv) > 1:
         print 'Need output filename.'
         sys.exit(1)
-    if len(sys.argv) > 2:
-        ymax = float(sys.argv[2])
-    else:
-        ymax = 13
     cfg_path="/home/neurodebian/neurodebian.git/neurodebian.cfg"
     cfg = SafeConfigParser()
     cfg.read(cfg_path)
@@ -108,4 +108,4 @@ if __name__ == '__main__':
         date = datetime.strptime(date, "%d %b %Y")
         data.append((ip.strip(), loc, suite, date2num(date)))
     data = np.array(data, dtype=dt)
-    make_figure(data, ymax).savefig(sys.argv[1], bbox_inches='tight', dpi=60)
+    make_figure(data, ymax=18).savefig(sys.argv[1], bbox_inches='tight', dpi=60)