Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Model_ROOT_3a3a_Experimental_3a3a_RNTuple' object is not subscriptable error while accessing event keys #1260

Open
giedrius2020 opened this issue Aug 1, 2024 · 3 comments
Assignees
Labels
feature New feature or request

Comments

@giedrius2020
Copy link
Contributor

giedrius2020 commented Aug 1, 2024

Uproot version: 5.3.10

We compared data loading for TTree and RNTuple structures.

We tried to use method:

# Loading the file:
with uproot.open(file) as f: # Remote TTree
    events = f["Events"]
# Getting array:
array = events["Electron_pt"].array()

Accessing "Electron_pt" key worked with TTree, but did not work with RNTuple. In RNTuple case we got this error:
'Model_ROOT_3a3a_Experimental_3a3a_RNTuple' object is not subscriptable

For now as a workaround we used this approach:
events.arrays()["Electron_pt"],
(NOTE: this approach is really slow when used with TTree).

If possible, we would like to :

  • use the same array = events["Electron_pt"].array() syntax for RNTuple as with TTree and get the same results.
@giedrius2020 giedrius2020 added the feature New feature or request label Aug 1, 2024
@giedrius2020
Copy link
Contributor Author

giedrius2020 commented Aug 1, 2024

Tags: @davidlange6, @ariostas

@giedrius2020 giedrius2020 changed the title " 'Model_ROOT_3a3a_Experimental_3a3a_RNTuple' object is not subscriptable " error while accessing event keys " 'Model_ROOT_3a3a_Experimental_3a3a_RNTuple' object is not subscriptable " error while accessing event keys Aug 1, 2024
@giedrius2020 giedrius2020 changed the title " 'Model_ROOT_3a3a_Experimental_3a3a_RNTuple' object is not subscriptable " error while accessing event keys 'Model_ROOT_3a3a_Experimental_3a3a_RNTuple' object is not subscriptable error while accessing event keys Aug 1, 2024
@alexander-held
Copy link
Member

Does events.arrays(["Electron_pt"])["Electron_pt"] work? I imagine events.arrays()["Electron_pt"] is slow because it will read the full file.

@giedrius2020
Copy link
Contributor Author

Does events.arrays(["Electron_pt"])["Electron_pt"] work? I imagine events.arrays()["Electron_pt"] is slow because it will read the full file.

I checked it. Yes it works and is way faster. Thanks, I will use this approach for loading from now.

@ariostas ariostas self-assigned this Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants