Skip to content

Commit 8ac8ef3

Browse files
authored
Merge branch 'main' into jpivarski/dont-compare-big-endian-in-awkward
2 parents ed346ce + d7d9d30 commit 8ac8ef3

15 files changed

+664
-128
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,15 @@
596596
"contributions": [
597597
"code"
598598
]
599+
},
600+
{
601+
"login": "rossodisera",
602+
"name": "Andrea Serafini",
603+
"avatar_url": "https://avatars.githubusercontent.com/u/46961664?v=4",
604+
"profile": "https://github.com/rossodisera",
605+
"contributions": [
606+
"code"
607+
]
599608
}
600609
],
601610
"contributorsPerLine": 7,

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ Thanks especially to the gracious help of Uproot contributors (including the [or
192192
</tr>
193193
<tr>
194194
<td align="center" valign="top" width="14.28%"><a href="https://github.com/MatousVozak"><img src="https://avatars.githubusercontent.com/u/33348191?v=4?s=100" width="100px;" alt="MatousVozak"/><br /><sub><b>MatousVozak</b></sub></a><br /><a href="https://github.com/scikit-hep/uproot5/commits?author=MatousVozak" title="Code">💻</a></td>
195+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rossodisera"><img src="https://avatars.githubusercontent.com/u/46961664?v=4?s=100" width="100px;" alt="Andrea Serafini"/><br /><sub><b>Andrea Serafini</b></sub></a><br /><a href="https://github.com/scikit-hep/uproot5/commits?author=rossodisera" title="Code">💻</a></td>
195196
</tr>
196197
</tbody>
197198
</table>

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ test = [
8383
]
8484
test-pyodide = [
8585
"pytest>=6",
86+
"selenium<=4.25.0", # unpin once >4.26.0 is available
8687
"pytest-pyodide",
8788
"pytest-timeout",
8889
"scikit-hep-testdata"

src/uproot/behaviors/TBranch.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,16 @@ def iterate(
210210
arrays, report = item
211211
arrays = library.global_index(arrays, global_offset)
212212
report = report.to_global(global_offset)
213-
yield arrays, report
213+
popper = [arrays]
214+
del arrays
215+
del item
216+
yield popper.pop(), report
217+
214218
else:
215-
arrays = library.global_index(item, global_offset)
216-
yield arrays
219+
popper = [library.global_index(item, global_offset)]
220+
del item
221+
yield popper.pop()
222+
217223
except uproot.exceptions.KeyInFileError:
218224
if allow_missing:
219225
continue
@@ -1111,6 +1117,9 @@ def iterate(
11111117
ak_add_doc,
11121118
)
11131119

1120+
# no longer needed; save memory
1121+
del output
1122+
11141123
next_baskets = {}
11151124
for branch, basket_num, basket in ranges_or_baskets:
11161125
basket_entry_start, basket_entry_stop = basket.entry_start_stop
@@ -1119,10 +1128,14 @@ def iterate(
11191128

11201129
previous_baskets = next_baskets
11211130

1131+
# no longer needed; save memory
1132+
popper = [out]
1133+
del out
1134+
11221135
if report:
1123-
yield out, Report(self, sub_entry_start, sub_entry_stop)
1136+
yield popper.pop(), Report(self, sub_entry_start, sub_entry_stop)
11241137
else:
1125-
yield out
1138+
yield popper.pop()
11261139

11271140
def keys(
11281141
self,

src/uproot/const.py

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""
66
from __future__ import annotations
77

8-
import struct
8+
from enum import IntEnum
99

1010
import numpy
1111

@@ -118,8 +118,6 @@
118118
kStreamedMemberWise = numpy.uint16(1 << 14)
119119

120120
############ RNTuple https://github.com/root-project/root/blob/master/tree/ntuple/v7/doc/specifications.md
121-
_rntuple_frame_format = struct.Struct("<Q")
122-
rntuple_env_header = _rntuple_frame_format.pack(0) # TODO: need to check this
123121
rntuple_col_num_to_dtype_dict = {
124122
1: "uint64",
125123
2: "uint32",
@@ -149,6 +147,8 @@
149147
26: "int64", # split + zigzag encoding
150148
27: "int32", # split + zigzag encoding
151149
28: "int16", # split + zigzag encoding
150+
29: "float32trunc",
151+
30: "float32quant",
152152
}
153153
rntuple_col_num_to_size_dict = {
154154
1: 64,
@@ -179,6 +179,8 @@
179179
26: 64, # split + zigzag encoding
180180
27: 32, # split + zigzag encoding
181181
28: 16, # split + zigzag encoding
182+
29: 32, # TODO: variable size
183+
30: 32, # TODO: variable size
182184
}
183185

184186
rntuple_col_type_to_num_dict = {
@@ -212,7 +214,49 @@
212214
"splitzigzagint16": 28,
213215
}
214216

215-
rntuple_role_leaf = 0
216-
rntuple_role_vector = 1
217-
rntuple_role_struct = 2
218-
rntuple_role_union = 3
217+
218+
class RNTupleLocatorType(IntEnum):
219+
STANDARD = 0x00
220+
LARGE = 0x01
221+
DAOS = 0x02
222+
223+
224+
class RNTupleEnvelopeType(IntEnum):
225+
RESERVED = 0x00
226+
HEADER = 0x01
227+
FOOTER = 0x02
228+
PAGELIST = 0x03
229+
230+
231+
class RNTupleFieldRole(IntEnum):
232+
LEAF = 0x00
233+
VECTOR = 0x01
234+
STRUCT = 0x02
235+
UNION = 0x03
236+
UNSPLIT = 0x04
237+
238+
239+
class RNTupleFieldFlag(IntEnum):
240+
REPETITIVE = 0x01
241+
PROJECTED = 0x02
242+
CHECKSUM = 0x04
243+
244+
245+
class RNTupleColumnFlag(IntEnum):
246+
DEFERRED = 0x08
247+
RANGE = 0x10
248+
249+
250+
class RNTupleExtraTypeIdentifier(IntEnum):
251+
ROOT = 0x00
252+
253+
254+
class RNTupleUserMetadataType(IntEnum):
255+
INT = 0x01
256+
BOOL = 0x02
257+
DOUBLE = 0x03
258+
STRING = 0x04
259+
260+
261+
class RNTupleClusterFlag(IntEnum):
262+
SHARDED = 0x01

src/uproot/containers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,7 @@ def __eq__(self, other):
15411541
return False
15421542

15431543
def __array__(self, *args, **kwargs):
1544-
return numpy.asarray(self._vector, *args, **kwargs)
1544+
return numpy.asarray(self._values, *args, **kwargs)
15451545

15461546
def tolist(self):
15471547
return [
@@ -1656,7 +1656,7 @@ def __eq__(self, other):
16561656
return False
16571657

16581658
def __array__(self, *args, **kwargs):
1659-
return numpy.asarray(self._vector, *args, **kwargs)
1659+
return numpy.asarray(self._values, *args, **kwargs)
16601660

16611661
def tolist(self):
16621662
return [

src/uproot/language/python.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,10 @@ def getter(name):
516516
else:
517517
output[name] = output[name][cut]
518518

519+
# clear dicts to get rid of big arrays.
520+
# note: without this these arrays are not properly released from memory!
521+
values.clear()
522+
scope.clear()
519523
return output
520524

521525

0 commit comments

Comments
 (0)