Code: Select all
import boost_histogram as bh
import numpy as np
import matplotlib as plt
# Compose axis however you like; this is a 2D histogram
hist = bh.Histogram(bh.axis.Regular(2, 0, 1), bh.axis.Regular(4, 0.0, 1.0))
# Filling can be done with arrays, one per dimension
hist.fill([0.3, 0.5, 0.2], [0.1, 0.4, 0.9])
# NumPy array view into histogram counts, no overflow bins
counts = hist.view()
print(counts)similar output?
1989
1981
