2

back with another quick question in learning how to use uproot correctly. I am trying to load a Delphes output .root file and I am trying to transition from using uproot.open to using uproot.lazyarrays in order to use split MC files, and when I naively tried to approach this I had trouble getting some of the information from the .root file.

I can properly open any file with uproot.open and get all contents, and the "show" command lists them all.

Track                      TStreamerInfo              asdtype('>i4')
Track.PT                   TStreamerBasicType         asjagged(asdtype('>f4'))

LargeJet                   TStreamerInfo              asdtype('>i4')
LargeJet.PT                TStreamerBasicType         asjagged(asdtype('>f4'))


events = uproot.lazyarrays("*.root","Delphes")
print(len(events))                      # correct merged event number

print(events._contents["Track.PT"])     # shows correctly
print(events._contents["LargeJet.PT"])  # shows ([] [] [] ... [])

events = uproot.open("tag_1_delphes_events.root")["Delphes"]
events = events.arrays(["LargeJet.PT"],outputtype=tuple)
print(events)                           # shows correctly

I'd expect the lazyarrays to be loaded correctly for all contents, however it seems that I can't get some of the contents, and I can't understand which and by what rule. I'm using PyCharm and I can access the content of the loaded files and see which arrays are loaded and which are not.

What could be the reason for and/or how do I handle this?

John Karkas
  • 113
  • 1
  • 7
  • 1
    Do you mean that you see different content if you view `"LargeJet.PT"` with `arrays` vs `lazyarrays`? That sounds like a bug, which will require the original file to debug (on the [GitHub issues](https://github.com/scikit-hep/uproot/issues) page). – Jim Pivarski Oct 19 '19 at 18:59
  • 1
    One thing, though: don't access data through attributes that [begin with an underscore](https://dbader.org/blog/meaning-of-underscores-in-python). Use `events["LargeJet.PT"]`, not `events._contents["LargeJet.PT"]`. – Jim Pivarski Oct 19 '19 at 19:01
  • Working on it a bit more, I'm able to narrow down the problem to the fact that lazyarrays won't manage to read jaggedarrays with many entries, whereas uproot.open reads everything correctly. I've tried playing with and without cache sizes (even big big ones) and the same "value too large" exception is spat out. Is this a known issue (something like [this](https://github.com/scikit-hep/uproot/issues/296) )? Maybe a separate post there is better. – John Karkas Oct 20 '19 at 01:03
  • 1
    The "value too large" case isn't a bug (though the text of the error message could be better), but if it's returning wrong values without an error, that is a bug and it belongs on the GitHub Issues page. Thanks! – Jim Pivarski Oct 20 '19 at 07:21

0 Answers0