Currently, weighted histograms don’t plot or interact nicely with the rest of the Scikit-HEP ecosystem, but a Protocol to allow this is in the works and should be rougly ready by the end of the month.
@henryiii That's great and would be quite helpful to be able to use as defaults for https://github.com/matthewfeickert/heputils/blob/master/src/heputils/convert.py
Is there an Issue open at the moment that I could follow for this? I realize I'm also making a lot of requests without volunteering to help on anything, so apologies there, but maybe by 2021 I'll understand enough that I can start making some more helpful Issues or easy PRs.
I don’t think it’s really a replacement for gitter; it’s more of a replacement for a) stack overflow, and b) opening issues for help instead of a bug. It’s also all in one place - GitHub, so less fragmented. It’s really just a bit more orginisation on issues, with some minor added features. An issue closes - you aren’t supposed to care about the issue anymore when it’s fixed. But if it was opened as a discussion, or moved to a discussion, in the Q&A category, then it just gets an answer, but remains easy to find, so it becomes less likely to become a recurring quesiton. The “showcase” topic looks great - people can post thier most intersting and exciting examples of boost-histogram.
And while it’s new to me, other members of our comunity have been trying them out already (the PyHF repo has had them on for over a month, for example).
What is that one place you describe, gitter? To me gitter does not seem suited for focused discussions - the history is hard to read, even more so when one comes back after a month and tries to find a topic discussed previously.
Yes, I was referring to Gitter as the place to communicate with users.
My histogram is having a
Regular and a
strCategory axis and I want to show the cumulative sum of the categories, but with the different components stacked on top of each other.
I found out I can just use
np.cumsum(axis=<category axis>) to calculate the cumulative sum and create a new histogram from that. In had also managed to draw a stacked histogram by plotting multiple
plt.bar with different
bottom=... arguments taken from the cumulative sums. But I dislike that visualy, because I want to have a black outline for my components, but no outlines for the individual bins, as seen in the screenshot.
Hi, I used to be able to modify histogram contents like this
import boost_histogram as bh import numpy as np bins = [0, 1, 2] hist = bh.Histogram(bh.axis.Variable(bins), storage=bh.storage.Weight()) yields = [3, 4] var = [0.1, 0.2] hist[...] = np.stack([yields, var], axis=-1) hist.view().value /= 2
That worked until
0.11.1. In the current master it does not anymore, I think scikit-hep/boost-histogram#475 changes the behavior:
Traceback (most recent call last): File "test.py", line 10, in <module> hist.view().value /= 2 File "[...]/boost_histogram/_internal/view.py", line 57, in fset self[name] = value File "[...]/boost_histogram/_internal/view.py", line 49, in __setitem__ raise ValueError("Needs matching ndarray or n+1 dim array") ValueError: Needs matching ndarray or n+1 dim array
Is there another way to achieve this now?
hist.view() /= 2.