legend-pydataobj 1.11.1__py3-none-any.whl → 1.11.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {legend_pydataobj-1.11.1.dist-info → legend_pydataobj-1.11.2.dist-info}/METADATA +1 -1
- {legend_pydataobj-1.11.1.dist-info → legend_pydataobj-1.11.2.dist-info}/RECORD +9 -9
- lgdo/_version.py +2 -2
- lgdo/lh5/_serializers/read/vector_of_vectors.py +3 -2
- lgdo/types/table.py +15 -2
- {legend_pydataobj-1.11.1.dist-info → legend_pydataobj-1.11.2.dist-info}/LICENSE +0 -0
- {legend_pydataobj-1.11.1.dist-info → legend_pydataobj-1.11.2.dist-info}/WHEEL +0 -0
- {legend_pydataobj-1.11.1.dist-info → legend_pydataobj-1.11.2.dist-info}/entry_points.txt +0 -0
- {legend_pydataobj-1.11.1.dist-info → legend_pydataobj-1.11.2.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
lgdo/__init__.py,sha256=1YUuAFQHNrOOkr3ZfrtEJOpYqgzbHRYA81ssbQZitQE,3196
|
2
|
-
lgdo/_version.py,sha256=
|
2
|
+
lgdo/_version.py,sha256=bDTqFh70ehioLDtrFoQMAZrx_nk6Lp2-C5J8Rwl7BYA,413
|
3
3
|
lgdo/cli.py,sha256=Qm2EPmoIVxENAR8BeW7oWpTdHT4GbV-owfzM5NkgjvM,9353
|
4
4
|
lgdo/lgdo_utils.py,sha256=6a2YWEwpyEMXlAyTHZMO01aqxy6SxJzPZkGNWKNWuS0,2567
|
5
5
|
lgdo/lh5_store.py,sha256=5BzbJA9sLcqjp8bJDc2olwOiw0VS6rmfg3cfh1kQkRY,8512
|
@@ -28,7 +28,7 @@ lgdo/lh5/_serializers/read/encoded.py,sha256=Q98c08d8LkZq2AlY4rThYECVaEqwbv4T2Ur
|
|
28
28
|
lgdo/lh5/_serializers/read/ndarray.py,sha256=lFCXD6bSzmMOH7cVmvRYXakkfMCI8EoqTPNONRJ1F0s,3690
|
29
29
|
lgdo/lh5/_serializers/read/scalar.py,sha256=kwhWm1T91pXf86CqtUUD8_qheSR92gXZrQVtssV5YCg,922
|
30
30
|
lgdo/lh5/_serializers/read/utils.py,sha256=USacxDA0eY-u9lDOZDuJHcScoSVMNeAYljmRvW0T1Jk,7587
|
31
|
-
lgdo/lh5/_serializers/read/vector_of_vectors.py,sha256=
|
31
|
+
lgdo/lh5/_serializers/read/vector_of_vectors.py,sha256=Fqh2gXFqeR2y0ofQn4GoSdSAATPvHiuBzzcgL16e6ss,7205
|
32
32
|
lgdo/lh5/_serializers/write/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
33
|
lgdo/lh5/_serializers/write/array.py,sha256=eyVPwwddVOR9TNNyliCNYlS-XYXsdTEA8QoTnnOYJbw,2943
|
34
34
|
lgdo/lh5/_serializers/write/composite.py,sha256=I6lH0nWFIpAfZyG4-0rLxzg3mfazZ_FEhQVp1FZ0aA4,9254
|
@@ -43,13 +43,13 @@ lgdo/types/histogram.py,sha256=XuE81aRXgIY-g-rFgr9Jo7KZ-0tsNpq1lRVRyA4uTSQ,19679
|
|
43
43
|
lgdo/types/lgdo.py,sha256=UnJDi1emQYVgH_H29Vipfs4LelPopxG5pgZUu1eKOlw,2761
|
44
44
|
lgdo/types/scalar.py,sha256=c5Es2vyDqyWTPV6mujzfIzMpC1jNWkEIcvYyWQUxH3Q,1933
|
45
45
|
lgdo/types/struct.py,sha256=Q0OWLVd4B0ciLb8t6VsxU3MPbmGLZ7WfQNno1lSQS0Q,4918
|
46
|
-
lgdo/types/table.py,sha256=
|
46
|
+
lgdo/types/table.py,sha256=oJfUmRsjP4Q1k4f-nae3xSQQuGrMcLPGbY7UxMlXMCU,18596
|
47
47
|
lgdo/types/vectorofvectors.py,sha256=cic9PsZ5EptQ6RMsykYeVHA8T7fh_KBZCcqeTP4i1wU,24395
|
48
48
|
lgdo/types/vovutils.py,sha256=7BWPP0BSj-92ifbCIUBcfqxG5-TS8uxujTyJJuDFI04,10302
|
49
49
|
lgdo/types/waveformtable.py,sha256=f2tS4f1OEoYaTM5ldCX9zmw8iSISCT3t3wS1SrPdu_o,9901
|
50
|
-
legend_pydataobj-1.11.
|
51
|
-
legend_pydataobj-1.11.
|
52
|
-
legend_pydataobj-1.11.
|
53
|
-
legend_pydataobj-1.11.
|
54
|
-
legend_pydataobj-1.11.
|
55
|
-
legend_pydataobj-1.11.
|
50
|
+
legend_pydataobj-1.11.2.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
51
|
+
legend_pydataobj-1.11.2.dist-info/METADATA,sha256=HmjRC4KWBKPaWMGAjKEiufOsmFikbbBG2oZkkEVAWHo,44382
|
52
|
+
legend_pydataobj-1.11.2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
53
|
+
legend_pydataobj-1.11.2.dist-info/entry_points.txt,sha256=Uu5MTlppBZxB4QGlLv-oX8FqACWjAZDNii__TBDJwLQ,72
|
54
|
+
legend_pydataobj-1.11.2.dist-info/top_level.txt,sha256=KyR-EUloqiXcQ62IWnzBmtInDtvsHl4q2ZJAZgTcLXE,5
|
55
|
+
legend_pydataobj-1.11.2.dist-info/RECORD,,
|
lgdo/_version.py
CHANGED
@@ -189,8 +189,9 @@ def _h5_read_vector_of_vectors(
|
|
189
189
|
# if the buffer is partially filled, cumulative_length will be invalid
|
190
190
|
# (i.e. non monotonically increasing). Let's fix that but filling the
|
191
191
|
# rest of the array with the length of flattened_data
|
192
|
-
|
193
|
-
|
192
|
+
if n_rows_read > 0:
|
193
|
+
end = obj_buf_start + n_rows_read
|
194
|
+
obj_buf.cumulative_length.nda[end:] = obj_buf.cumulative_length.nda[end - 1]
|
194
195
|
|
195
196
|
return obj_buf, n_rows_read
|
196
197
|
|
lgdo/types/table.py
CHANGED
@@ -7,6 +7,7 @@ from __future__ import annotations
|
|
7
7
|
|
8
8
|
import logging
|
9
9
|
from collections.abc import Mapping
|
10
|
+
from types import ModuleType
|
10
11
|
from typing import Any
|
11
12
|
from warnings import warn
|
12
13
|
|
@@ -266,6 +267,7 @@ class Table(Struct):
|
|
266
267
|
self,
|
267
268
|
expr: str,
|
268
269
|
parameters: Mapping[str, str] | None = None,
|
270
|
+
modules: Mapping[str, ModuleType] | None = None,
|
269
271
|
) -> LGDO:
|
270
272
|
"""Apply column operations to the table and return a new LGDO.
|
271
273
|
|
@@ -299,6 +301,10 @@ class Table(Struct):
|
|
299
301
|
a dictionary of function parameters. Passed to
|
300
302
|
:func:`numexpr.evaluate`` as `local_dict` argument or to
|
301
303
|
:func:`eval` as `locals` argument.
|
304
|
+
modules
|
305
|
+
a dictionary of additional modules used by the expression. If this is not `None`
|
306
|
+
then :func:`eval`is used and the expression can depend on any modules from this dictionary in
|
307
|
+
addition to awkward and numpy. These are passed to :func:`eval` as `globals` argument.
|
302
308
|
|
303
309
|
Examples
|
304
310
|
--------
|
@@ -339,8 +345,8 @@ class Table(Struct):
|
|
339
345
|
msg = f"evaluating {expr!r} with locals={(self_unwrap | parameters)} and {has_ak=}"
|
340
346
|
log.debug(msg)
|
341
347
|
|
342
|
-
# use numexpr if we are only dealing with numpy data types
|
343
|
-
if not has_ak:
|
348
|
+
# use numexpr if we are only dealing with numpy data types (and no global dictionary)
|
349
|
+
if not has_ak and modules is None:
|
344
350
|
out_data = ne.evaluate(
|
345
351
|
expr,
|
346
352
|
local_dict=(self_unwrap | parameters),
|
@@ -366,6 +372,9 @@ class Table(Struct):
|
|
366
372
|
|
367
373
|
# resort to good ol' eval()
|
368
374
|
globs = {"ak": ak, "np": np}
|
375
|
+
if modules is not None:
|
376
|
+
globs = globs | modules
|
377
|
+
|
369
378
|
out_data = eval(expr, globs, (self_unwrap | parameters))
|
370
379
|
|
371
380
|
msg = f"...the result is {out_data!r}"
|
@@ -380,6 +389,10 @@ class Table(Struct):
|
|
380
389
|
if np.isscalar(out_data):
|
381
390
|
return Scalar(out_data)
|
382
391
|
|
392
|
+
# if out_data is already an LGDO just return it
|
393
|
+
if isinstance(out_data, LGDO):
|
394
|
+
return out_data
|
395
|
+
|
383
396
|
msg = (
|
384
397
|
f"evaluation resulted in a {type(out_data)} object, "
|
385
398
|
"I don't know which LGDO this corresponds to"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|