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

feat: Optional support to add c++ typenames to parameters with ak_add_typename in uproot.dask #1375

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

prayagyadav
Copy link

Optional support to add c++ typenames to parameters with ak_add_typename in uproot.dask


Necessity:

  • Access to C++ typename info for each tree branch is essential in building COFFEA schema for files generated with EDM4HEP.

  • Similar to how ak_add_doc is used to add the __doc__ parameter to forms, ak_add_typename could be used to add the C++ typename of the branch in parameters.

  • This is an attempt to solve this feature request #1369 posted by @ianna in response to the discussions among @jpivarski @ianna @davidlange6 and @prayagyadav


Outcome/Example/Expected output:

Bash:

wget https://github.com/prayagyadav/coffea/raw/refs/heads/test-typenames-swan/tests/samples/p8_ee_WW_ecm240_edm4hep.root

Python:

file = "p8_ee_WW_ecm240_edm4hep.root"
tree = "events"
events = uproot.dask(file+":"+tree, open_files=False, ak_add_doc=True,  ak_add_typename=True)

events.Particle.form.parameters

Output:

{'__doc__': 'Particle_', 'typename': 'vector<edm4hep::MCParticleData>'}

Here is the live link to the notebook for the above example, where one can run these cells in real-time.


The bulk of the idea for these code changes was given by @davidlange6

Copy link
Collaborator

@ianna ianna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prayagyadav - Looks great, thanks! Could, please, add a test? There is a skhep_testdata package with a number of root files already in the repository. We usually name the tests with a corresponding PR number, for example:
tests/test_0652_dask_for_awkward.py

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants