-
Notifications
You must be signed in to change notification settings - Fork 8
KeyError: 'sumw2' #29
Comments
Here is where it's supposed to come from: aghast/python/aghast/interface.py Lines 5101 to 5108 in 2a57c6c
The bit of code you've quoted checks for the difference between a Notice from the commit history that Aghast hasn't been touched in months. It will probably be summer or later when I can cycle back to it and do any development on it. If this method failed, then apparently it was inadequately tested and should be fixed. If you investigate this problem and fix it (probably just an object or a name out of place), then submit a PR and I'll accept it. |
@jpivarski I have found why it doesn't work. Actually, it's not aghast's mistakes, it has something to do with boost-histogram's storage -- boost-histogram issue #289. We don' need to worry about that because @henryiii is working on it -- boost-histogram PR #290. I will deep into that issue and this would be solved by the way. + h = bh.Histogram(bh.axis.Regular(20, -5, 5))
+ h.fill(np.random.normal(0, 1, int(10e3)))
+ w, data = h.to_numpy()
+ numpy_hist = (w.astype(int), data) # this works
- numpy_hist = (w, data). # this is broken
+ ghastly_hist = aghast.from_numpy(numpy_hist)
+ root_hist = aghast.to_root(ghastly_hist, "bh_root_hist") Btw, do you think aghast should support double or float storage, or we should add some tests for boost-histogram histograms (rather than just ROOT histograms) at "test_root.py"? |
Aghast's version of "storage" is a buffer, defined in the Flatbuffers specification here: Lines 29 to 130 in 2a57c6c
There are simplified versions for Lines 100 to 106 in 2a57c6c
But these complicating optimizations should go away when the Flatbuffers part is lowered into C++. (Right now, it's dominated by performance issues in Python.) |
Yep, the boost-histogram is thinking about to deprecate the 'float' storage in the PR I mentioned above, so can this be a problem?
I think we don't need to make some changes for aghast now, the
If you really want to tolerant 'float' storage for now, maybe we only need to judge and add |
Aghast has to be able to express a superset of what each library is capable of—it can be able to express more. If boost-histogram discontinues |
@jpivarski I just realized that THIS IS A BUG because boost_histogram should be able to support float storage (the issue and PR I mentioned are to solve float to int by default). Anyway, I have fixed it (not only for |
Merged. This issue has completed its mission! |
@jpivarski There might be a bug: when I run the code
A KeyError is thrown. It says no key "sumw2" is found. I search <"sumw2"> in this file and find this is the only one.
aghast/python/aghast/_connect/_root.py
Lines 160 to 165 in 2a57c6c
P.S., I am using
pip install aghast
, so the package I'm using might be a little out of date. But I check the latest code and the latest PR #24 , there are no changes with respect toto_root()
in this file.The text was updated successfully, but these errors were encountered: