legend-pydataobj 1.11.5__tar.gz → 1.11.6__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.5 → legend_pydataobj-1.11.6}/PKG-INFO +2 -1
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/pyproject.toml +1 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/legend_pydataobj.egg-info/PKG-INFO +2 -1
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/legend_pydataobj.egg-info/requires.txt +1 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/_version.py +2 -2
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/types/table.py +31 -19
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/types/test_table_eval.py +14 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/LICENSE +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/README.md +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/setup.cfg +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/legend_pydataobj.egg-info/SOURCES.txt +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/legend_pydataobj.egg-info/dependency_links.txt +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/legend_pydataobj.egg-info/entry_points.txt +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/legend_pydataobj.egg-info/not-zip-safe +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/legend_pydataobj.egg-info/top_level.txt +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/__init__.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/cli.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/compression/__init__.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/compression/base.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/compression/generic.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/compression/radware.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/compression/utils.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/compression/varlen.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lgdo_utils.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/__init__.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/__init__.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/read/__init__.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/read/array.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/read/composite.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/read/encoded.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/read/ndarray.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/read/scalar.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/read/utils.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/read/vector_of_vectors.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/write/__init__.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/write/array.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/write/composite.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/write/scalar.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/write/vector_of_vectors.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/core.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/datatype.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/exceptions.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/iterator.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/store.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/tools.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/utils.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5_store.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/logging.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/types/__init__.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/types/array.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/types/arrayofequalsizedarrays.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/types/encoded.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/types/fixedsizearray.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/types/histogram.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/types/lgdo.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/types/scalar.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/types/struct.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/types/vectorofvectors.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/types/vovutils.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/types/waveformtable.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/units.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/utils.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/compression/conftest.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/compression/sigcompress/LDQTA_r117_20200110T105115Z_cal_geds_raw-0.dat +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/compression/sigcompress/special-wf-clipped.dat +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/compression/test_compression.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/compression/test_radware_sigcompress.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/compression/test_str2wfcodec.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/compression/test_uleb128_zigzag_diff.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/conftest.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/lh5/conftest.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/lh5/test_core.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/lh5/test_exceptions.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/lh5/test_lh5_datatype.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/lh5/test_lh5_iterator.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/lh5/test_lh5_store.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/lh5/test_lh5_tools.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/lh5/test_lh5_utils.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/lh5/test_lh5_write.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/test_cli.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/test_lgdo_utils.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/types/test_array.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/types/test_arrayofequalsizedarrays.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/types/test_encoded.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/types/test_fixedsizearray.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/types/test_histogram.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/types/test_representations.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/types/test_scalar.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/types/test_struct.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/types/test_table.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/types/test_vectorofvectors.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/types/test_vovutils.py +0 -0
- {legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/tests/types/test_waveformtable.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: legend_pydataobj
|
3
|
-
Version: 1.11.
|
3
|
+
Version: 1.11.6
|
4
4
|
Summary: LEGEND Python Data Objects
|
5
5
|
Author: The LEGEND Collaboration
|
6
6
|
Maintainer: The LEGEND Collaboration
|
@@ -725,6 +725,7 @@ Requires-Dist: pre-commit; extra == "test"
|
|
725
725
|
Requires-Dist: pylegendtestdata; extra == "test"
|
726
726
|
Requires-Dist: pytest>=6.0; extra == "test"
|
727
727
|
Requires-Dist: pytest-cov; extra == "test"
|
728
|
+
Requires-Dist: dbetto; extra == "test"
|
728
729
|
|
729
730
|
# legend-pydataobj
|
730
731
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: legend_pydataobj
|
3
|
-
Version: 1.11.
|
3
|
+
Version: 1.11.6
|
4
4
|
Summary: LEGEND Python Data Objects
|
5
5
|
Author: The LEGEND Collaboration
|
6
6
|
Maintainer: The LEGEND Collaboration
|
@@ -725,6 +725,7 @@ Requires-Dist: pre-commit; extra == "test"
|
|
725
725
|
Requires-Dist: pylegendtestdata; extra == "test"
|
726
726
|
Requires-Dist: pytest>=6.0; extra == "test"
|
727
727
|
Requires-Dist: pytest-cov; extra == "test"
|
728
|
+
Requires-Dist: dbetto; extra == "test"
|
728
729
|
|
729
730
|
# legend-pydataobj
|
730
731
|
|
@@ -351,31 +351,39 @@ class Table(Struct):
|
|
351
351
|
msg = f"evaluating {expr!r} with locals={(self_unwrap | parameters)} and {has_ak=}"
|
352
352
|
log.debug(msg)
|
353
353
|
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
msg = f"...the result is {out_data!r}"
|
362
|
-
log.debug(msg)
|
363
|
-
|
364
|
-
# need to convert back to LGDO
|
365
|
-
# np.evaluate should always return a numpy thing?
|
366
|
-
if out_data.ndim == 0:
|
367
|
-
return Scalar(out_data.item())
|
368
|
-
if out_data.ndim == 1:
|
369
|
-
return Array(out_data)
|
370
|
-
if out_data.ndim == 2:
|
371
|
-
return ArrayOfEqualSizedArrays(nda=out_data)
|
354
|
+
def _make_lgdo(data):
|
355
|
+
if data.ndim == 0:
|
356
|
+
return Scalar(data.item())
|
357
|
+
if data.ndim == 1:
|
358
|
+
return Array(data)
|
359
|
+
if data.ndim == 2:
|
360
|
+
return ArrayOfEqualSizedArrays(nda=data)
|
372
361
|
|
373
362
|
msg = (
|
374
|
-
f"evaluation resulted in {
|
363
|
+
f"evaluation resulted in {data.ndim}-dimensional data, "
|
375
364
|
"I don't know which LGDO this corresponds to"
|
376
365
|
)
|
377
366
|
raise RuntimeError(msg)
|
378
367
|
|
368
|
+
# use numexpr if we are only dealing with numpy data types (and no global dictionary)
|
369
|
+
if not has_ak and modules is None:
|
370
|
+
try:
|
371
|
+
out_data = ne.evaluate(
|
372
|
+
expr,
|
373
|
+
local_dict=(self_unwrap | parameters),
|
374
|
+
)
|
375
|
+
|
376
|
+
msg = f"...the result is {out_data!r}"
|
377
|
+
log.debug(msg)
|
378
|
+
|
379
|
+
# need to convert back to LGDO
|
380
|
+
# np.evaluate should always return a numpy thing?
|
381
|
+
return _make_lgdo(out_data)
|
382
|
+
|
383
|
+
except Exception:
|
384
|
+
msg = f"Warning {expr} could not be evaluated with numexpr probably due to some not allowed characters, trying with eval()."
|
385
|
+
log.debug(msg)
|
386
|
+
|
379
387
|
# resort to good ol' eval()
|
380
388
|
globs = {"ak": ak, "np": np}
|
381
389
|
if modules is not None:
|
@@ -392,6 +400,10 @@ class Table(Struct):
|
|
392
400
|
return Array(out_data.to_numpy())
|
393
401
|
return VectorOfVectors(out_data)
|
394
402
|
|
403
|
+
# modules can still produce numpy array
|
404
|
+
if isinstance(out_data, np.ndarray):
|
405
|
+
return _make_lgdo(out_data)
|
406
|
+
|
395
407
|
if np.isscalar(out_data):
|
396
408
|
return Scalar(out_data)
|
397
409
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
+
import dbetto
|
3
4
|
import hist
|
4
5
|
import numpy as np
|
5
6
|
import pytest
|
@@ -85,6 +86,19 @@ def test_eval_dependency():
|
|
85
86
|
res = obj.eval("lgdo.Array([1,2,3])", {}, modules={"lgdo": lgdo})
|
86
87
|
assert res == lgdo.Array([1, 2, 3])
|
87
88
|
|
89
|
+
# test with module returning np.array
|
90
|
+
assert obj.eval("np.sum(a)", {}, modules={"np": np}).value == np.int64(10)
|
91
|
+
|
88
92
|
# check bad type
|
89
93
|
with pytest.raises(RuntimeError):
|
90
94
|
obj.eval("hist.Hist()", modules={"hist": hist})
|
95
|
+
|
96
|
+
# check impossible numexpr can still run
|
97
|
+
assert np.allclose(
|
98
|
+
obj.eval(
|
99
|
+
"a*args.value",
|
100
|
+
{"args": dbetto.AttrsDict({"value": 2})},
|
101
|
+
modules={"lgdo": lgdo},
|
102
|
+
).view_as("np"),
|
103
|
+
[2, 4, 6, 8],
|
104
|
+
)
|
File without changes
|
File without changes
|
File without changes
|
{legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/legend_pydataobj.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/legend_pydataobj.egg-info/entry_points.txt
RENAMED
File without changes
|
{legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/legend_pydataobj.egg-info/not-zip-safe
RENAMED
File without changes
|
{legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/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.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/read/__init__.py
RENAMED
File without changes
|
File without changes
|
{legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/read/composite.py
RENAMED
File without changes
|
{legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/read/encoded.py
RENAMED
File without changes
|
{legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/read/ndarray.py
RENAMED
File without changes
|
{legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/read/scalar.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/write/__init__.py
RENAMED
File without changes
|
{legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/write/array.py
RENAMED
File without changes
|
{legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/src/lgdo/lh5/_serializers/write/composite.py
RENAMED
File without changes
|
{legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/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.5 → legend_pydataobj-1.11.6}/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.5 → legend_pydataobj-1.11.6}/tests/compression/test_radware_sigcompress.py
RENAMED
File without changes
|
File without changes
|
{legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/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
|
File without changes
|
File without changes
|
{legend_pydataobj-1.11.5 → legend_pydataobj-1.11.6}/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
|