aminnj / yahist

1D and 2D histogram objects
10 stars 3 forks source link

make from_bincounts more convenient #6

Closed aminnj closed 3 years ago

aminnj commented 3 years ago

I wanted to check gaussian and binomial errors of a ratio via

den = Hist1D.from_bincounts(np.array([4.]), np.array([0,1]))
num = Hist1D.from_bincounts(np.array([3.]), np.array([0,1]))
num.divide(den, binomial=True).errors_up

and it should be more user-friendly. First, lists should be converted to numpy arrays internally, so this should work

den = Hist1D.from_bincounts([4.],[0,1])
num = Hist1D.from_bincounts([3.],[0,1])

and edges should be set automatically to np.arange(len(counts))?

den = Hist1D.from_bincounts([4.])
num = Hist1D.from_bincounts([3.])
aminnj commented 3 years ago

solved by https://github.com/aminnj/yahist/commit/26ea7e684f059beb327a8a6501136f076427f56b