Ensure that self.headings exists in Histogram, e.g. in bell_rate.py's theory hist.
authorW. Trevor King <wking@drexel.edu>
Sat, 6 Nov 2010 13:59:56 +0000 (06:59 -0700)
committerW. Trevor King <wking@drexel.edu>
Sat, 6 Nov 2010 13:59:56 +0000 (06:59 -0700)
pysawsim/histogram.py

index c0d73b7..7591e56 100644 (file)
@@ -35,6 +35,9 @@ class Histogram (object):
 
     >>> h = Histogram()
     """
+    def __init__(self):
+        self.headings = None
+
     def calculate_bin_edges(self, data, bin_width):
         """
         >>> h = Histogram()
@@ -60,7 +63,6 @@ class Histogram (object):
         All bins should be of equal width (so we can calculate which
         bin a data point belongs to).
         """
-        self.headings = None
         data = numpy.array(data)
         self.bin_edges = numpy.array(bin_edges)
         bin_width = self.bin_edges[1] - self.bin_edges[0]