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

bugs with uproot and Delphes interactions #438

Closed
kratsg opened this issue Sep 10, 2021 · 0 comments · Fixed by #454
Closed

bugs with uproot and Delphes interactions #438

kratsg opened this issue Sep 10, 2021 · 0 comments · Fixed by #454
Labels
bug The problem described is something that must be fixed

Comments

@kratsg
Copy link
Contributor

kratsg commented Sep 10, 2021

>>> import uproot
>>> uproot.__version__
'4.1.1'

A simple script like the following will confirm bugs on both of these files:

import uproot
with uproot.open('test.root:Delphes') as tree:
  tree.arrays(entry_stop=1)

which either results in one of two different errors (depends on Delphes versions... and what process is generated...)

bug in AsGroup interpretation not handling TCloneArrays
Traceback (most recent call last):
  File "inout.py", line 5, in 
    events = tree.arrays(entry_stop=1)
  File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/behaviors/TBranch.py", line 1130, in arrays
    False,
  File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/behaviors/TBranch.py", line 3494, in _ranges_or_baskets_to_arrays
    uproot.source.futures.delayed_raise(*obj)
  File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/source/futures.py", line 46, in delayed_raise
    raise exception_value.with_traceback(traceback)
  File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/behaviors/TBranch.py", line 3470, in basket_to_array
    branch,
  File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/interpretation/objects.py", line 228, in final_array
    output = library.finalize(output, branch, self, entry_start, entry_stop)
  File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/interpretation/library.py", line 570, in finalize
    (_object_to_awkward_json(form, x) for x in array), highlevel=False
  File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/awkward/operations/convert.py", line 885, in from_iter
    for x in iterable:
  File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/interpretation/library.py", line 570, in 
    (_object_to_awkward_json(form, x) for x in array), highlevel=False
  File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/interpretation/library.py", line 315, in _object_to_awkward_json
    return [_object_to_awkward_json(subform, x) for x in obj]
  File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/interpretation/library.py", line 315, in 
    return [_object_to_awkward_json(subform, x) for x in obj]
  File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/interpretation/library.py", line 292, in _object_to_awkward_json
    if obj.has_member(name):
AttributeError: 'numpy.ndarray' object has no attribute 'has_member'
bug in fBits counting, but might be a header interpretation issue somehow
Traceback (most recent call last):
  File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/interpretation/numerical.py", line 328, in basket_array
    output = data.view(dtype).reshape((-1,) + shape)
ValueError: When changing to a larger dtype, its size must be a divisor of the total size in bytes of the last axis of the array.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "inout.py", line 3, in
for events in uproot.iterate("test.root:Delphes", entry_stop=1):
File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/behaviors/TBranch.py", line 218, in iterate
report=report,
File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/behaviors/TBranch.py", line 1364, in iterate
True,
File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/behaviors/TBranch.py", line 3494, in _ranges_or_baskets_to_arrays
uproot.source.futures.delayed_raise(*obj)
File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/source/futures.py", line 46, in delayed_raise
raise exception_value.with_traceback(traceback)
File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/behaviors/TBranch.py", line 3445, in basket_to_array
library,
File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/interpretation/jagged.py", line 176, in basket_array
data, None, basket, branch, context, cursor_offset, library
File "/tank/scratch/kratsg/py3/lib64/python3.6/site-packages/uproot/interpretation/numerical.py", line 338, in basket_array
branch.file.file_path,
ValueError: basket 2 in tree/branch /Delphes;1:Particle/Particle.fBits has the wrong number of bytes (53382) for interpretation AsDtype('>u4')
in file test.root

Two files are uploaded with names to clarify which bug is raised by each one.

@kratsg kratsg added the bug The problem described is something that must be fixed label Sep 10, 2021
jpivarski added a commit that referenced this issue Sep 28, 2021
@jpivarski jpivarski linked a pull request Sep 28, 2021 that will close this issue
jpivarski added a commit that referenced this issue Sep 28, 2021
* Fixes first bug in issue #438.

* Works around the second bug in issue #438.
This was referenced Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The problem described is something that must be fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant