lh5 package

Subpackages

Submodules

lh5.cli module

legend-lh5io’s command line interface utilities.

lh5.cli.lh5concat_cli(args=None)

Command line interface for concatenating array-like LGDOs in LH5 files.

lh5.cli.lh5ls(args=None)

io.show() command line interface.

lh5.cli.lh5truncate_cli(args=None)

Command line interface for truncating LH5 files.

lh5.numba_utils module

Implements utilities for LEGEND LH5.

class lh5.numba_utils.NumbaDefaults

Bases: MutableMapping

Bare-bones class to store some Numba default options. Default values are set from environment variables.

Examples

Set all default option values for a processor at once by expanding the provided dictionary:

>>> from numba import guvectorize
>>> from lh5.numba_utils import numba_defaults_kwargs as nb_kwargs
>>> @guvectorize([], "", **nb_kwargs(nopython=True))  # def proc(...): ...

Customize one argument but still set defaults for the others:

>>> from lh5.numba_utils import numba_defaults_kwargs as nb_kwargs
>>> @guvectorize([], "", **nb_kwargs(cache=False))  # def proc(...): ...

Override global options at runtime:

>>> from lh5.numba_utils import numba_defaults
>>> # must set options before explicitly importing lh5 modules!
>>> numba_defaults.cache = False
>>> numba_defaults.boundscheck = True
>>> from lh5 import compression  # imports of numba-compiled functions happen here
>>> compression.encode(...)
lh5.numba_utils.getenv_bool(name, default=False)

Get environment variable value as a boolean.

Returns True for 1, t and true (case-insensitive), False for any other value, and default if the variable is undefined.

Return type:

bool