Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #482 from scikit-hep/jagged-assume
Browse files Browse the repository at this point in the history
Assumption about TBasket byte for JaggedArray was wrong
  • Loading branch information
jpivarski authored May 6, 2020
2 parents 820049c + 4f8a70a commit 773b6ef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion uproot/write/objects/TTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,9 @@ def newbasket(self, items, multidim=None):
key.write(cursor, self._branch.file._sink)
uproot.write.compress.write(self._branch.file, cursor, givenbytes, self._branch.compression, key, copy(keycursor))
if isinstance(items, awkward.array.jagged.JaggedArray):
offsetbytes = [items.shape[0] + 1, key.fKeylen]
# 3 looks like a harmless value for the first entry of offsetbytes
# Relevant code - https://github.com/root-project/root/blob/master/tree/tree/src/TBasket.cxx#L921-L954
offsetbytes = [3, key.fKeylen]
for i in range(items.shape[0] - 1):
offsetbytes += [(len(items[i]) * numpy.dtype(self._branch.type).itemsize) + offsetbytes[-1]]
offsetbytes += [0]
Expand Down

0 comments on commit 773b6ef

Please sign in to comment.