8 Base class for generating bin boundaries in some range.
12 Initialise with the number of ranges for which
13 to generate bin edges, in the range [lower, upper].
22 Generator class for bins with equal intervals in log10.
25 super(BinsLog10, self).
__init__(n, lower, upper)
33 Generator function for (n+1) bin edges.
35 for i
in range(0, self.
n + 1):
36 yield math.pow(10., self.
lower + i * self.
width)
40 Generator function for n bin lower edges.
42 for i
in range(0, self.
n):
43 yield math.pow(10., self.
lower + i * self.
width)
47 Generator function for n bin upper edges.
49 for i
in range(1, self.
n + 1):
50 yield math.pow(10., self.
lower + i * self.
width)
55 Rebins an axis such that bins span equal intervals in log_10(x).
57 if isinstance(obj, ROOT.TAxis):
58 binner =
BinsLog10(obj.GetNbins(), obj.GetXmin(), obj.GetXmax())
60 edgearray = array.array(
'd', [x
for x
in binner.edges()])
61 obj.Set(obj.GetNbins(), edgearray)
62 elif isinstance(obj, ROOT.TH1):
63 axes = [obj.GetXaxis(), obj.GetYaxis(), obj.GetZaxis()]
64 for i
in range(0, obj.GetDimension()):