legend-pydataobj 1.0.0__py3-none-any.whl → 1.1.1__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.0.0.dist-info → legend_pydataobj-1.1.1.dist-info}/METADATA +3 -2
- {legend_pydataobj-1.0.0.dist-info → legend_pydataobj-1.1.1.dist-info}/RECORD +11 -8
- legend_pydataobj-1.1.1.dist-info/entry_points.txt +2 -0
- lgdo/__init__.py +2 -1
- lgdo/_version.py +2 -2
- lgdo/cli.py +68 -0
- lgdo/lh5_store.py +12 -5
- lgdo/logging.py +40 -0
- {legend_pydataobj-1.0.0.dist-info → legend_pydataobj-1.1.1.dist-info}/LICENSE +0 -0
- {legend_pydataobj-1.0.0.dist-info → legend_pydataobj-1.1.1.dist-info}/WHEEL +0 -0
- {legend_pydataobj-1.0.0.dist-info → legend_pydataobj-1.1.1.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: legend-pydataobj
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.1.1
|
4
4
|
Summary: LEGEND Python Data Objects
|
5
5
|
Home-page: https://github.com/legend-exp/legend-pydataobj
|
6
6
|
Author: The LEGEND Collaboration
|
@@ -25,7 +25,8 @@ Classifier: Topic :: Software Development
|
|
25
25
|
Requires-Python: >=3.9
|
26
26
|
Description-Content-Type: text/markdown
|
27
27
|
License-File: LICENSE
|
28
|
-
Requires-Dist:
|
28
|
+
Requires-Dist: colorlog
|
29
|
+
Requires-Dist: h5py (>=3.2)
|
29
30
|
Requires-Dist: hdf5plugin
|
30
31
|
Requires-Dist: numba (!=0.53.*,!=0.54.*)
|
31
32
|
Requires-Dist: numexpr
|
@@ -1,7 +1,9 @@
|
|
1
|
-
lgdo/__init__.py,sha256=
|
2
|
-
lgdo/_version.py,sha256=
|
1
|
+
lgdo/__init__.py,sha256=mY6pUNy2yJ2MYzq_ZdhVZZ7xItBW1KJ8h9qA29bOECU,2878
|
2
|
+
lgdo/_version.py,sha256=YLzlJBLuVqQyUSlkA30f-5TxKHA1-kSXwKvyg5nAOSc,160
|
3
|
+
lgdo/cli.py,sha256=nYU1_igMTHoXw2H_jgyAW_2FzX1gdB_gnzf1LbsUYFE,1570
|
3
4
|
lgdo/lgdo_utils.py,sha256=i6zG4r5wnv2WHXfWv232C_ZxaET556Rft8315QnTTiQ,5596
|
4
|
-
lgdo/lh5_store.py,sha256=
|
5
|
+
lgdo/lh5_store.py,sha256=xGnCQ1NCSWiamfndf0w8Sxn-5AB1Y_RytFcGz0PEOyM,68396
|
6
|
+
lgdo/logging.py,sha256=Nu3wgIoWN7cyUxuzPom5rMwFvTlBu8p8d9uONHDquRg,965
|
5
7
|
lgdo/compression/__init__.py,sha256=oT9OXiDDxC7BZciWrQVfHZNkOxXfj4p8EpF2tF04w84,1091
|
6
8
|
lgdo/compression/base.py,sha256=82cQJujfvoAOKBFx761dEcx_xM02TBCBBuBo6i78tuI,838
|
7
9
|
lgdo/compression/generic.py,sha256=zWoZqR5H4x-xpbvBYKDZ0rnNqUh9pC9aZeoc8Z98OjI,2252
|
@@ -19,8 +21,9 @@ lgdo/types/struct.py,sha256=UxV0wnCHoQM5rSmzEC9EIKWYV6drHVyK5Ab7UQztuj4,2984
|
|
19
21
|
lgdo/types/table.py,sha256=h5E4Keu-a3l25WXf7m_hm2Yr4RRzGjS_WCQ_Pla7SAI,12531
|
20
22
|
lgdo/types/vectorofvectors.py,sha256=1oxKJDX8VVWpmvUUDHHEzEYw0RRWJrMjOB-jHRY12N4,21859
|
21
23
|
lgdo/types/waveform_table.py,sha256=52vqjGudX5_ZR1-b087jx3vuTxJ_yEPO-dO8Dpi0ceg,9407
|
22
|
-
legend_pydataobj-1.
|
23
|
-
legend_pydataobj-1.
|
24
|
-
legend_pydataobj-1.
|
25
|
-
legend_pydataobj-1.
|
26
|
-
legend_pydataobj-1.
|
24
|
+
legend_pydataobj-1.1.1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
25
|
+
legend_pydataobj-1.1.1.dist-info/METADATA,sha256=6E2XP7A3l3_mo-QqnOYyyHkPIH7lq8ctADfSkkzoMo0,3241
|
26
|
+
legend_pydataobj-1.1.1.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
27
|
+
legend_pydataobj-1.1.1.dist-info/entry_points.txt,sha256=j22HoS-1cVhTtKJkDnKB49uNH0nEVER2Tpw-lVh1aws,41
|
28
|
+
legend_pydataobj-1.1.1.dist-info/top_level.txt,sha256=KyR-EUloqiXcQ62IWnzBmtInDtvsHl4q2ZJAZgTcLXE,5
|
29
|
+
legend_pydataobj-1.1.1.dist-info/RECORD,,
|
lgdo/__init__.py
CHANGED
@@ -38,6 +38,7 @@ browsed easily in python like any `HDF5 <https://www.hdfgroup.org>`_ file using
|
|
38
38
|
`h5py <https://www.h5py.org>`_.
|
39
39
|
"""
|
40
40
|
|
41
|
+
from ._version import version as __version__
|
41
42
|
from .lh5_store import LH5Iterator, LH5Store, load_dfs, load_nda, ls, show
|
42
43
|
from .types import (
|
43
44
|
LGDO,
|
@@ -71,5 +72,5 @@ __all__ = [
|
|
71
72
|
"load_nda",
|
72
73
|
"ls",
|
73
74
|
"show",
|
74
|
-
"
|
75
|
+
"__version__",
|
75
76
|
]
|
lgdo/_version.py
CHANGED
lgdo/cli.py
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
"""Command line interface utilities."""
|
2
|
+
from __future__ import annotations
|
3
|
+
|
4
|
+
import argparse
|
5
|
+
import sys
|
6
|
+
|
7
|
+
from . import __version__, logging, show
|
8
|
+
|
9
|
+
|
10
|
+
def lh5ls():
|
11
|
+
"""``lh5ls`` console command.
|
12
|
+
|
13
|
+
To learn more, have a look at the help section:
|
14
|
+
|
15
|
+
.. code-block:: console
|
16
|
+
|
17
|
+
$ lh5ls --help
|
18
|
+
"""
|
19
|
+
|
20
|
+
parser = argparse.ArgumentParser(
|
21
|
+
prog="lh5ls", description="Inspect LEGEND HDF5 (LH5) file contents"
|
22
|
+
)
|
23
|
+
|
24
|
+
# global options
|
25
|
+
parser.add_argument(
|
26
|
+
"--version", action="store_true", help="""Print the program version and exit"""
|
27
|
+
)
|
28
|
+
parser.add_argument(
|
29
|
+
"--verbose",
|
30
|
+
"-v",
|
31
|
+
action="store_true",
|
32
|
+
help="""Increase the program verbosity""",
|
33
|
+
)
|
34
|
+
parser.add_argument(
|
35
|
+
"--debug",
|
36
|
+
"-d",
|
37
|
+
action="store_true",
|
38
|
+
help="""Increase the program verbosity to maximum""",
|
39
|
+
)
|
40
|
+
|
41
|
+
# show options
|
42
|
+
parser.add_argument(
|
43
|
+
"lh5_file",
|
44
|
+
help="""Input LH5 file.""",
|
45
|
+
)
|
46
|
+
parser.add_argument("lh5_group", nargs="?", help="""LH5 group.""", default="/")
|
47
|
+
parser.add_argument(
|
48
|
+
"--attributes",
|
49
|
+
"-a",
|
50
|
+
action="store_true",
|
51
|
+
default=False,
|
52
|
+
help="""Print HDF5 attributes too""",
|
53
|
+
)
|
54
|
+
|
55
|
+
args = parser.parse_args()
|
56
|
+
|
57
|
+
if args.verbose:
|
58
|
+
logging.setup(logging.DEBUG)
|
59
|
+
elif args.debug:
|
60
|
+
logging.setup(logging.DEBUG, logging.root)
|
61
|
+
else:
|
62
|
+
logging.setup()
|
63
|
+
|
64
|
+
if args.version:
|
65
|
+
print(__version__) # noqa: T201
|
66
|
+
sys.exit()
|
67
|
+
|
68
|
+
show(args.lh5_file, args.lh5_group, attrs=args.attributes)
|
lgdo/lh5_store.py
CHANGED
@@ -1287,9 +1287,11 @@ def show(
|
|
1287
1287
|
if dtype == "no datatype" and isinstance(val, h5py.Group):
|
1288
1288
|
dtype = "HDF5 group"
|
1289
1289
|
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1290
|
+
_attrs = ""
|
1291
|
+
if attrs:
|
1292
|
+
attrs_d = dict(val.attrs)
|
1293
|
+
attrs_d.pop("datatype", "")
|
1294
|
+
_attrs = "── " + str(attrs_d) if attrs_d else ""
|
1293
1295
|
|
1294
1296
|
# is this the last key?
|
1295
1297
|
killme = False
|
@@ -1301,11 +1303,16 @@ def show(
|
|
1301
1303
|
else:
|
1302
1304
|
char = "├──"
|
1303
1305
|
|
1304
|
-
print(f"{indent}{char} \033[1m{key}\033[0m · {dtype} {
|
1306
|
+
print(f"{indent}{char} \033[1m{key}\033[0m · {dtype} {_attrs}") # noqa: T201
|
1305
1307
|
|
1306
1308
|
# if it's a group, call this function recursively
|
1307
1309
|
if isinstance(val, h5py.Group):
|
1308
|
-
show(
|
1310
|
+
show(
|
1311
|
+
val,
|
1312
|
+
indent=indent + (" " if killme else "│ "),
|
1313
|
+
header=False,
|
1314
|
+
attrs=attrs,
|
1315
|
+
)
|
1309
1316
|
|
1310
1317
|
# break or move to next key
|
1311
1318
|
if killme:
|
lgdo/logging.py
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
"""This module implements some helpers for setting up logging."""
|
2
|
+
import logging
|
3
|
+
|
4
|
+
import colorlog
|
5
|
+
|
6
|
+
DEBUG = logging.DEBUG
|
7
|
+
INFO = logging.INFO
|
8
|
+
WARNING = logging.WARNING
|
9
|
+
ERROR = logging.ERROR
|
10
|
+
FATAL = logging.FATAL
|
11
|
+
CRITICAL = logging.CRITICAL
|
12
|
+
|
13
|
+
|
14
|
+
def setup(level: int = logging.INFO, logger: logging.Logger = None) -> None:
|
15
|
+
"""Setup a colorful logging output.
|
16
|
+
|
17
|
+
If `logger` is None, sets up only the ``pygama`` logger.
|
18
|
+
|
19
|
+
Parameters
|
20
|
+
----------
|
21
|
+
level
|
22
|
+
logging level (see :mod:`logging` module).
|
23
|
+
logger
|
24
|
+
if not `None`, setup this logger.
|
25
|
+
|
26
|
+
Examples
|
27
|
+
--------
|
28
|
+
>>> from pygama import logging
|
29
|
+
>>> logging.setup(level=logging.DEBUG)
|
30
|
+
"""
|
31
|
+
handler = colorlog.StreamHandler()
|
32
|
+
handler.setFormatter(
|
33
|
+
colorlog.ColoredFormatter("%(log_color)s%(name)s [%(levelname)s] %(message)s")
|
34
|
+
)
|
35
|
+
|
36
|
+
if logger is None:
|
37
|
+
logger = colorlog.getLogger("pygama")
|
38
|
+
|
39
|
+
logger.setLevel(level)
|
40
|
+
logger.addHandler(handler)
|
File without changes
|
File without changes
|
File without changes
|