-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/legend-exp/legend-pydataobj …
…into issue_3_lh5_store_refactor
- Loading branch information
Showing
9 changed files
with
456 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
"""legend-pydataobj's command line interface utilities.""" | ||
import argparse | ||
import logging | ||
import sys | ||
|
||
import lgdo | ||
import lgdo.logging | ||
from lgdo import show | ||
|
||
|
||
def lh5ls(): | ||
""":func:`.show` command line interface.""" | ||
parser = argparse.ArgumentParser( | ||
prog="lh5ls", description="Inspect LEGEND HDF5 (LH5) file contents" | ||
) | ||
|
||
# global options | ||
parser.add_argument( | ||
"--version", action="store_true", help="""Print lgdo version and exit""" | ||
) | ||
parser.add_argument( | ||
"--verbose", | ||
"-v", | ||
action="store_true", | ||
help="""Increase the program verbosity""", | ||
) | ||
parser.add_argument( | ||
"--debug", | ||
"-d", | ||
action="store_true", | ||
help="""Increase the program verbosity to maximum""", | ||
) | ||
|
||
parser.add_argument( | ||
"lh5_file", | ||
help="""Input LH5 file.""", | ||
) | ||
parser.add_argument("lh5_group", nargs="?", help="""LH5 group.""", default="/") | ||
parser.add_argument( | ||
"--attributes", "-a", action="store_true", help="""Print HDF5 attributes too""" | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
if args.verbose: | ||
lgdo.logging.setup(logging.DEBUG) | ||
elif args.debug: | ||
lgdo.logging.setup(logging.DEBUG, logging.root) | ||
else: | ||
lgdo.logging.setup() | ||
|
||
if args.version: | ||
print(lgdo.__version__) # noqa: T201 | ||
sys.exit() | ||
|
||
show(args.lh5_file, args.lh5_group, attrs=args.attributes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.