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

TypeError: Model_ROOT_3a3a_RNTuple.keys() got an unexpected keyword argument 'filter_branch' #1350

Open
oshadura opened this issue Dec 13, 2024 · 2 comments
Labels
bug (unverified) The problem described would be a bug, but needs to be triaged

Comments

@oshadura
Copy link
Collaborator

oshadura commented Dec 13, 2024

Trying https://github.com/iris-hep/calver-coffea-agc-demo with one of RNTuple file (v1) - to reproduce it, change in cell 5

ttbar_file = "https://xrootd-local.unl.edu:1094//store/user/AGC/rntuple/rntuple-v1-128MiB/nanoAOD/ST_s-channel_4f_InclusiveDecays_13TeV-amcatnlo-pythia8/cmsopendata2015_single_top_s_chan_19394_PU25nsData2015v1_76X_mcRun2_asymptotic_v12-v1_00000_0000.root"

we see next error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[5], line 3
      1 ttbar_file = "https://xrootd-local.unl.edu:1094//store/user/AGC/rntuple/rntuple-v1-128MiB/nanoAOD/ST_s-channel_4f_InclusiveDecays_13TeV-amcatnlo-pythia8/cmsopendata2015_single_top_s_chan_19394_PU25nsData2015v1_76X_mcRun2_asymptotic_v12-v1_00000_0000.root"
----> 3 events = NanoEventsFactory.from_root({ttbar_file: "Events"}, schemaclass=NanoAODSchema).events()
      5 # create the task graph to build a histogram
      6 reconstructed_top_mass = calculate_trijet_mass(events)

File /usr/local/lib/python3.10/site-packages/coffea/nanoevents/factory.py:684, in NanoEventsFactory.events(self)
    682 """Build events"""
    683 if self._is_dask:
--> 684     events = self._mapping(form_mapping=self._schema)
    685     report = None
    686     if isinstance(events, tuple):

File /usr/local/lib/python3.10/site-packages/uproot/_dask.py:296, in dask(files, filter_name, filter_typename, filter_branch, recursive, full_paths, step_size, steps_per_file, library, ak_add_doc, custom_classes, allow_missing, open_files, form_mapping, allow_read_errors_with_report, known_base_form, decompression_executor, interpretation_executor, **options)
    277         return _get_dak_array(
    278             files,
    279             filter_name,
   (...)
    293             interpretation_executor,
    294         )
    295     else:
--> 296         return _get_dak_array_delay_open(
    297             files,
    298             filter_name,
    299             filter_typename,
    300             filter_branch,
    301             recursive,
    302             full_paths,
    303             custom_classes,
    304             allow_missing,
    305             real_options,
    306             interp_options,
    307             form_mapping,
    308             steps_per_file,
    309             allow_read_errors_with_report,
    310             known_base_form,
    311             decompression_executor,
    312             interpretation_executor,
    313         )
    314 else:
    315     raise NotImplementedError()

File /usr/local/lib/python3.10/site-packages/uproot/_dask.py:1598, in _get_dak_array_delay_open(files, filter_name, filter_typename, filter_branch, recursive, full_paths, custom_classes, allow_missing, real_options, interp_options, form_mapping, steps_per_file, allow_read_errors_with_report, known_base_form, decompression_executor, interpretation_executor)
   1594 else:
   1595     obj = uproot._util.regularize_object_path(
   1596         ffile_path, fobject_path, custom_classes, allow_missing, real_options
   1597     )
-> 1598     common_keys = obj.keys(
   1599         recursive=recursive,
   1600         filter_name=filter_name,
   1601         filter_typename=filter_typename,
   1602         filter_branch=filter_branch,
   1603         full_paths=full_paths,
   1604         ignore_duplicates=True,
   1605     )
   1606     base_form = _get_ttree_form(
   1607         awkward, obj, common_keys, interp_options.get("ak_add_doc")
   1608     )
   1610 divisions = [0]

TypeError: Model_ROOT_3a3a_RNTuple.keys() got an unexpected keyword argument 'filter_branch'

cc: @alexander-held

[cms-jovyan@jupyter-oksana-2eshadura-40cern-2ech calver-coffea-agc-demo]$ pip list | grep uproot
uproot                             5.5.1
@oshadura oshadura added the bug (unverified) The problem described would be a bug, but needs to be triaged label Dec 13, 2024
@jpivarski
Copy link
Member

@ariostas, it sounds like the TTree (HasBranches) keys method was copied without enough modification. HasBranches.keys has a filter_branches to select branches, but maybe the equivalent is called "fields" for RNTuple? Or it doesn't exist (filter_branches takes a function on TBranch objects, which maybe aren't objects for fields?)?

@ariostas
Copy link
Collaborator

Yeah, the filter_branches keyword argument doesn't make sense for RNTuples, but it would make sense to have a filter_fields now that there are field objects.

The current implementation of keys is not fully-featured yet. Here's how it looks.

def keys(
self,
*,
filter_name=None,
filter_typename=None,
recursive=False,
full_paths=True,
# TODO: some arguments might be missing when compared with TTree. Solve when blocker is present in dask/coffea.
):

The filter_typename, recursive, and full_paths don't do anything yet. I'll have to check how recursive, and full_paths work for TTrees because I'm not sure how they translate to RNTuples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug (unverified) The problem described would be a bug, but needs to be triaged
Projects
None yet
Development

No branches or pull requests

3 participants