Skip to content

Commit

Permalink
Merge pull request #35 from legend-exp/dev
Browse files Browse the repository at this point in the history
Support for latest legend-pydataobj version
  • Loading branch information
gipert authored Apr 15, 2024
2 parents a5f67cb + f3d3414 commit f1e12e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ install_requires =
dspeed>=1.3.0a4
h5py>=3.2.0
hdf5plugin
legend-pydataobj>=1.5.0a1
legend-pydataobj>=1.6
numpy>=1.21
pyfcutils
tqdm>=4.27
Expand Down
9 changes: 5 additions & 4 deletions src/daq2lh5/data_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import numpy as np
from lgdo import LGDO
from lgdo.lh5 import LH5Store
from lgdo.lh5 import datatype as dtypeutils


class DataDecoder:
Expand Down Expand Up @@ -206,10 +207,10 @@ def make_lgdo(self, key: int | str = None, size: int = None) -> LGDO:
continue

# Parse datatype for remaining lgdos
datatype, shape, elements = lgdo.lh5.utils.parse_datatype(datatype)
lgdotype = dtypeutils.datatype(datatype)

# ArrayOfEqualSizedArrays
if datatype == "array_of_equalsized_arrays":
if lgdotype is lgdo.ArrayOfEqualSizedArrays:
length = attrs.pop("length")
# only arrays of 1D arrays are supported at present
dims = (1, 1)
Expand All @@ -220,7 +221,7 @@ def make_lgdo(self, key: int | str = None, size: int = None) -> LGDO:
continue

# VectorOfVectors
if elements.startswith("array"):
if lgdotype is lgdo.VectorOfVectors:
length_guess = size
if "length_guess" in attrs:
length_guess = attrs.pop("length_guess")
Expand All @@ -234,7 +235,7 @@ def make_lgdo(self, key: int | str = None, size: int = None) -> LGDO:
raise RuntimeError(
type(self).__name__,
": do not know how to make a",
datatype,
lgdotype.__name__,
"for",
field,
)
Expand Down

0 comments on commit f1e12e9

Please sign in to comment.