legend-pydataobj 1.11.1__tar.gz → 1.11.2__tar.gz
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 → legend_pydataobj-1.11.2}/PKG-INFO +1 -1
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/legend_pydataobj.egg-info/PKG-INFO +1 -1
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/_version.py +2 -2
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/read/vector_of_vectors.py +3 -2
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/types/table.py +15 -2
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/lh5/test_lh5_store.py +14 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/types/test_table_eval.py +11 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/LICENSE +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/README.md +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/pyproject.toml +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/setup.cfg +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/legend_pydataobj.egg-info/SOURCES.txt +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/legend_pydataobj.egg-info/dependency_links.txt +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/legend_pydataobj.egg-info/entry_points.txt +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/legend_pydataobj.egg-info/not-zip-safe +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/legend_pydataobj.egg-info/requires.txt +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/legend_pydataobj.egg-info/top_level.txt +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/__init__.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/cli.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/compression/__init__.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/compression/base.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/compression/generic.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/compression/radware.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/compression/utils.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/compression/varlen.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lgdo_utils.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/__init__.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/__init__.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/read/__init__.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/read/array.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/read/composite.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/read/encoded.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/read/ndarray.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/read/scalar.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/read/utils.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/write/__init__.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/write/array.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/write/composite.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/write/scalar.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/write/vector_of_vectors.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/core.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/datatype.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/exceptions.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/iterator.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/store.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/tools.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/utils.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5_store.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/logging.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/types/__init__.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/types/array.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/types/arrayofequalsizedarrays.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/types/encoded.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/types/fixedsizearray.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/types/histogram.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/types/lgdo.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/types/scalar.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/types/struct.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/types/vectorofvectors.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/types/vovutils.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/types/waveformtable.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/units.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/utils.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/compression/conftest.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/compression/sigcompress/LDQTA_r117_20200110T105115Z_cal_geds_raw-0.dat +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/compression/sigcompress/special-wf-clipped.dat +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/compression/test_compression.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/compression/test_radware_sigcompress.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/compression/test_str2wfcodec.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/compression/test_uleb128_zigzag_diff.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/conftest.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/lh5/conftest.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/lh5/test_core.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/lh5/test_lh5_datatype.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/lh5/test_lh5_iterator.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/lh5/test_lh5_tools.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/lh5/test_lh5_utils.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/lh5/test_lh5_write.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/test_cli.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/test_lgdo_utils.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/types/test_array.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/types/test_arrayofequalsizedarrays.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/types/test_encoded.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/types/test_fixedsizearray.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/types/test_histogram.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/types/test_representations.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/types/test_scalar.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/types/test_struct.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/types/test_table.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/types/test_vectorofvectors.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/types/test_vovutils.py +0 -0
- {legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/types/test_waveformtable.py +0 -0
@@ -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
|
|
@@ -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"
|
@@ -292,6 +292,10 @@ def test_read_table_fancy_idx(lh5_file):
|
|
292
292
|
assert isinstance(lh5_obj, types.Table)
|
293
293
|
assert n_rows == 2
|
294
294
|
|
295
|
+
lh5_obj, n_rows = store.read("/data/struct/table", lh5_file, idx=[])
|
296
|
+
assert isinstance(lh5_obj, types.Table)
|
297
|
+
assert n_rows == 0
|
298
|
+
|
295
299
|
|
296
300
|
def test_read_empty_struct(lh5_file):
|
297
301
|
store = lh5.LH5Store()
|
@@ -468,6 +472,16 @@ def test_read_lgnd_vov_fancy_idx(lgnd_file):
|
|
468
472
|
assert (lh5_obj.cumulative_length.nda == [1, 2, 3, 4, 5, 6, 7]).all()
|
469
473
|
assert (lh5_obj.flattened_data.nda == [40, 60, 64, 60, 64, 28, 60]).all()
|
470
474
|
|
475
|
+
lh5_obj, n_rows = store.read("/geds/raw/tracelist", lgnd_file, idx=[])
|
476
|
+
assert isinstance(lh5_obj, types.VectorOfVectors)
|
477
|
+
assert n_rows == 0
|
478
|
+
assert len(lh5_obj) == 0
|
479
|
+
|
480
|
+
lh5_obj, n_rows = store.read("/geds/raw/tracelist", [lgnd_file] * 3, idx=[250])
|
481
|
+
assert isinstance(lh5_obj, types.VectorOfVectors)
|
482
|
+
assert n_rows == 1
|
483
|
+
assert len(lh5_obj) == 1
|
484
|
+
|
471
485
|
|
472
486
|
def test_read_array_concatenation(lgnd_file):
|
473
487
|
store = lh5.LH5Store()
|
@@ -1,6 +1,8 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
+
import hist
|
3
4
|
import numpy as np
|
5
|
+
import pytest
|
4
6
|
|
5
7
|
import lgdo
|
6
8
|
|
@@ -31,6 +33,7 @@ def test_eval_dependency():
|
|
31
33
|
),
|
32
34
|
}
|
33
35
|
)
|
36
|
+
|
34
37
|
r = obj.eval("sum(a)")
|
35
38
|
assert isinstance(r, lgdo.Scalar)
|
36
39
|
|
@@ -77,3 +80,11 @@ def test_eval_dependency():
|
|
77
80
|
assert isinstance(r, lgdo.Scalar)
|
78
81
|
|
79
82
|
assert obj.eval("np.sum(a) + ak.sum(e)")
|
83
|
+
|
84
|
+
# test with modules argument, the simplest is using directly lgdo
|
85
|
+
res = obj.eval("lgdo.Array([1,2,3])", {}, modules={"lgdo": lgdo})
|
86
|
+
assert res == lgdo.Array([1, 2, 3])
|
87
|
+
|
88
|
+
# check bad type
|
89
|
+
with pytest.raises(RuntimeError):
|
90
|
+
obj.eval("hist.Hist()", modules={"hist": hist})
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/legend_pydataobj.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/legend_pydataobj.egg-info/entry_points.txt
RENAMED
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/legend_pydataobj.egg-info/not-zip-safe
RENAMED
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/legend_pydataobj.egg-info/requires.txt
RENAMED
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/legend_pydataobj.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/read/__init__.py
RENAMED
File without changes
|
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/read/composite.py
RENAMED
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/read/encoded.py
RENAMED
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/read/ndarray.py
RENAMED
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/read/scalar.py
RENAMED
File without changes
|
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/write/__init__.py
RENAMED
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/write/array.py
RENAMED
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/write/composite.py
RENAMED
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/lh5/_serializers/write/scalar.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/src/lgdo/types/arrayofequalsizedarrays.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/compression/test_radware_sigcompress.py
RENAMED
File without changes
|
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/compression/test_uleb128_zigzag_diff.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{legend_pydataobj-1.11.1 → legend_pydataobj-1.11.2}/tests/types/test_arrayofequalsizedarrays.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|