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

Can't filter_typename in uproot.dask #1363

Open
jpivarski opened this issue Jan 17, 2025 · 1 comment
Open

Can't filter_typename in uproot.dask #1363

jpivarski opened this issue Jan 17, 2025 · 1 comment
Labels
bug (unverified) The problem described would be a bug, but needs to be triaged

Comments

@jpivarski
Copy link
Member

Some types of branches can't be interpreted, but we should be able to skip them and read everything else. Here's a file that has a branch named "PARAMETERS/_intMap/_intMap.first" whose interpretation is Unknown: https://cernbox.cern.ch/rootjs/public/dIbBvBgjhm1swNO/events_000189367.root?contextRouteName=files-public-link&contextRouteParams.driveAliasAndItem=public%2FdIbBvBgjhm1swNO&items-per-page=100

You can skip the unknown branches with uproot.concatenate (the eager equivalent of uproot.dask):

>>> uproot.concatenate("events_000189367.root:events", filter_typename=lambda x: x != "unknown", entry_stop=1)
<Array [{'Muon#0.index': [30], ...}, ...] type='100000 * {"Muon#0.index": v...'>

but you can't delay that read with Dask:

>>> uproot.dask("events_000189367.root:events", filter_typename=lambda x: x != "unknown", entry_stop=1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jpivarski/irishep/uproot5/src/uproot/_dask.py", line 277, in dask
    return _get_dak_array(
           ^^^^^^^^^^^^^^^
  File "/Users/jpivarski/irishep/uproot5/src/uproot/_dask.py", line 1542, in _get_dak_array
    base_form = _get_ttree_form(
                ^^^^^^^^^^^^^^^^
  File "/Users/jpivarski/irishep/uproot5/src/uproot/_dask.py", line 1385, in _get_ttree_form
    content_form = branch.interpretation.awkward_form(ttree.file)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jpivarski/irishep/uproot5/src/uproot/interpretation/grouped.py", line 105, in awkward_form
    fields.append(y.awkward_form(file, context))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jpivarski/irishep/uproot5/src/uproot/interpretation/grouped.py", line 105, in awkward_form
    fields.append(y.awkward_form(file, context))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jpivarski/irishep/uproot5/src/uproot/interpretation/identify.py", line 1203, in awkward_form
    raise self
  File "/Users/jpivarski/irishep/uproot5/src/uproot/behaviors/TBranch.py", line 1945, in interpretation
    self._interpretation = uproot.interpretation.identify.interpretation_of(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jpivarski/irishep/uproot5/src/uproot/interpretation/identify.py", line 507, in interpretation_of
    raise UnknownInterpretation(
uproot.interpretation.identify.UnknownInterpretation: none of the rules matched
in file events_000189367.root
in object /events;34:PARAMETERS/_intMap/_intMap.first

It seems like uproot.dask is ignoring the filter_name argument. That's an important argument for work-arounds like this!

@jpivarski jpivarski added the bug (unverified) The problem described would be a bug, but needs to be triaged label Jan 17, 2025
@jpivarski
Copy link
Member Author

Cc: @davidlange6

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

1 participant