Replies: 3 comments 3 replies
-
I did not get the correct shape using uproot3, so I very much doubt that your program is correct.Doing rigorous scientific research requires stable tools, not error-prone toys. |
Beta Was this translation helpful? Give feedback.
-
Both Uproot 3 and Uproot 4 return an array of the correct shape for this file/tree/branch. In Uproot 4, >>> import uproot
>>> tree = uproot.open("http://scikit-hep.org/uproot3/examples/nesteddirs.root")["one/two/tree"]
>>> tree["ArrayInt64"].array()
<Array [[0, 0, 0, 0, 0, ... 99, 99, 99, 99]] type='100 * 10 * int64'> or as a NumPy array, >>> tree["ArrayInt64"].array(library="np")
array([[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
...
[97, 97, 97, 97, 97, 97, 97, 97, 97, 97],
[98, 98, 98, 98, 98, 98, 98, 98, 98, 98],
[99, 99, 99, 99, 99, 99, 99, 99, 99, 99]]) which has shape Doing the same thing in ROOT, >>> import ROOT
>>> file = ROOT.TFile("nesteddirs.root")
TClass::Init:0: RuntimeWarning: no dictionary for class Event is available
TClass::Init:0: RuntimeWarning: no dictionary for class P3 is available
>>> tree = file.Get("one/two/tree")
>>> for x in tree:
... print(list(x.ArrayInt64))
...
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
...
[97, 97, 97, 97, 97, 97, 97, 97, 97, 97]
[98, 98, 98, 98, 98, 98, 98, 98, 98, 98]
[99, 99, 99, 99, 99, 99, 99, 99, 99, 99]
Really? If this had been a bug, I would have fixed it right away, added a test, and released a new version. The response is usually same-day. That way, the distribution of testing and maintenance conforms to the use-cases: the bugs people report get fixed and the tests ensure that they never regress—progress is always forward, though it is iterative. If we tried to guarantee perfection before each release, we would first have to define a domain of use-cases to test, but the users have a much better idea about what their own problems are than we do. This is, loosely speaking, the "agile" method, to be contrasted with "big design up-front," which has been disfavored for the past two decades because it never was very effective. (It's a guiding principle of the ROOT project as well: see the intro to the ROOT User's Guide. That intro was added in August 2000.) But, there was no bug. The above is the correct behavior. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I meet same problem fixed in uproot3, but i meet it again in uproot4!
https://github.com/scikit-hep/uproot3#multiple-values-per-event-fixed-size-arrays
Beta Was this translation helpful? Give feedback.
All reactions