legend-pydataobj 1.11.13__py3-none-any.whl → 1.12.0__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.11.13.dist-info → legend_pydataobj-1.12.0.dist-info}/METADATA +1 -1
- {legend_pydataobj-1.11.13.dist-info → legend_pydataobj-1.12.0.dist-info}/RECORD +25 -26
- {legend_pydataobj-1.11.13.dist-info → legend_pydataobj-1.12.0.dist-info}/WHEEL +1 -1
- lgdo/__init__.py +5 -4
- lgdo/_version.py +2 -2
- lgdo/lh5/__init__.py +1 -3
- lgdo/lh5/_serializers/read/composite.py +1 -3
- lgdo/lh5/_serializers/write/composite.py +2 -2
- lgdo/lh5/concat.py +3 -9
- lgdo/lh5/core.py +33 -32
- lgdo/lh5/iterator.py +48 -27
- lgdo/lh5/store.py +22 -75
- lgdo/lh5/tools.py +0 -111
- lgdo/lh5/utils.py +6 -4
- lgdo/types/array.py +84 -15
- lgdo/types/encoded.py +25 -20
- lgdo/types/histogram.py +1 -1
- lgdo/types/lgdo.py +50 -0
- lgdo/types/table.py +50 -28
- lgdo/types/vectorofvectors.py +132 -94
- lgdo/types/vovutils.py +14 -4
- lgdo/types/waveformtable.py +19 -21
- lgdo/lh5_store.py +0 -284
- {legend_pydataobj-1.11.13.dist-info → legend_pydataobj-1.12.0.dist-info}/entry_points.txt +0 -0
- {legend_pydataobj-1.11.13.dist-info → legend_pydataobj-1.12.0.dist-info}/licenses/LICENSE +0 -0
- {legend_pydataobj-1.11.13.dist-info → legend_pydataobj-1.12.0.dist-info}/top_level.txt +0 -0
lgdo/lh5_store.py
DELETED
@@ -1,284 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
.. warning::
|
3
|
-
This subpackage is deprecated, use :mod:`lgdo.lh5`.
|
4
|
-
"""
|
5
|
-
|
6
|
-
from __future__ import annotations
|
7
|
-
|
8
|
-
import sys
|
9
|
-
from collections.abc import Iterator
|
10
|
-
from typing import Union
|
11
|
-
from warnings import warn
|
12
|
-
|
13
|
-
import h5py
|
14
|
-
import numpy as np
|
15
|
-
import pandas as pd
|
16
|
-
|
17
|
-
from . import lh5
|
18
|
-
from .types import (
|
19
|
-
Array,
|
20
|
-
ArrayOfEncodedEqualSizedArrays, # noqa: F401
|
21
|
-
ArrayOfEqualSizedArrays, # noqa: F401
|
22
|
-
FixedSizeArray, # noqa: F401
|
23
|
-
Histogram, # noqa: F401
|
24
|
-
Scalar,
|
25
|
-
Struct,
|
26
|
-
Table, # noqa: F401
|
27
|
-
VectorOfEncodedVectors, # noqa: F401
|
28
|
-
VectorOfVectors,
|
29
|
-
WaveformTable, # noqa: F401
|
30
|
-
)
|
31
|
-
|
32
|
-
LGDO = Union[Array, Scalar, Struct, VectorOfVectors]
|
33
|
-
|
34
|
-
|
35
|
-
class LH5Iterator(lh5.LH5Iterator):
|
36
|
-
"""
|
37
|
-
.. warning::
|
38
|
-
This class is deprecated, use :class:`lgdo.lh5.iterator.LH5Iterator`.
|
39
|
-
|
40
|
-
"""
|
41
|
-
|
42
|
-
def __init__(
|
43
|
-
self,
|
44
|
-
lh5_files: str | list[str],
|
45
|
-
groups: str | list[str],
|
46
|
-
base_path: str = "",
|
47
|
-
entry_list: list[int] | list[list[int]] | None = None,
|
48
|
-
entry_mask: list[bool] | list[list[bool]] | None = None,
|
49
|
-
field_mask: dict[str, bool] | list[str] | tuple[str] | None = None,
|
50
|
-
buffer_len: int = 3200,
|
51
|
-
friend: Iterator | None = None,
|
52
|
-
) -> None:
|
53
|
-
warn(
|
54
|
-
"lgdo.lh5_store has moved to a subfolder lgdo.lh5 containing LH5Iterator."
|
55
|
-
"Please replace 'from lgdo.lh5_store import LH5Iterator' with 'from lgdo.lh5 import LH5Iterator'."
|
56
|
-
"lgdo.lh5_store will be removed in a future release.",
|
57
|
-
DeprecationWarning,
|
58
|
-
stacklevel=2,
|
59
|
-
)
|
60
|
-
super().__init__(
|
61
|
-
lh5_files,
|
62
|
-
groups,
|
63
|
-
base_path,
|
64
|
-
entry_list,
|
65
|
-
entry_mask,
|
66
|
-
field_mask,
|
67
|
-
buffer_len,
|
68
|
-
friend,
|
69
|
-
)
|
70
|
-
|
71
|
-
def write_object(
|
72
|
-
self,
|
73
|
-
obj: LGDO,
|
74
|
-
name: str,
|
75
|
-
lh5_file: str | h5py.File,
|
76
|
-
group: str | h5py.Group = "/",
|
77
|
-
start_row: int = 0,
|
78
|
-
n_rows: int | None = None,
|
79
|
-
wo_mode: str = "append",
|
80
|
-
write_start: int = 0,
|
81
|
-
**h5py_kwargs,
|
82
|
-
) -> None:
|
83
|
-
"""
|
84
|
-
.. warning::
|
85
|
-
This method is deprecated, use :meth:`lgdo.lh5.iterator.LH5Iterator.write`.
|
86
|
-
|
87
|
-
"""
|
88
|
-
warn(
|
89
|
-
"lgdo.lh5_store has moved to a subfolder lgdo.lh5 containing LH5Iterator. "
|
90
|
-
"The object you are calling this function from uses the old LH5Iterator class."
|
91
|
-
"Please replace 'from lgdo.lh5_store import LH5Iterator' with 'from lgdo.lh5 import LH5Iterator'."
|
92
|
-
"lgdo.lh5_store will be removed in a future release.",
|
93
|
-
DeprecationWarning,
|
94
|
-
stacklevel=2,
|
95
|
-
)
|
96
|
-
self.write(
|
97
|
-
obj,
|
98
|
-
name,
|
99
|
-
lh5_file,
|
100
|
-
group,
|
101
|
-
start_row,
|
102
|
-
n_rows,
|
103
|
-
wo_mode,
|
104
|
-
write_start,
|
105
|
-
h5py_kwargs,
|
106
|
-
)
|
107
|
-
|
108
|
-
def read_object(
|
109
|
-
self,
|
110
|
-
name: str,
|
111
|
-
lh5_file: str | h5py.File | list[str | h5py.File],
|
112
|
-
start_row: int = 0,
|
113
|
-
n_rows: int = sys.maxsize,
|
114
|
-
idx: np.ndarray | list | tuple | list[np.ndarray | list | tuple] = None,
|
115
|
-
field_mask: dict[str, bool] | list[str] | tuple[str] | None = None,
|
116
|
-
obj_buf: LGDO = None,
|
117
|
-
obj_buf_start: int = 0,
|
118
|
-
decompress: bool = True,
|
119
|
-
) -> tuple[LGDO, int]:
|
120
|
-
"""
|
121
|
-
.. warning::
|
122
|
-
This method is deprecated, use :meth:`lgdo.lh5.iterator.LH5Iterator.read`.
|
123
|
-
|
124
|
-
"""
|
125
|
-
warn(
|
126
|
-
"lgdo.lh5_store has moved to a subfolder lgdo.lh5 containing LH5Iterator. "
|
127
|
-
"The object you are calling this function from uses the old LH5Iterator class."
|
128
|
-
"Please replace 'from lgdo.lh5_store import LH5Iterator' with 'from lgdo.lh5 import LH5Iterator'."
|
129
|
-
"lgdo.lh5_store will be removed in a future release.",
|
130
|
-
DeprecationWarning,
|
131
|
-
stacklevel=2,
|
132
|
-
)
|
133
|
-
return self.read(
|
134
|
-
name,
|
135
|
-
lh5_file,
|
136
|
-
start_row,
|
137
|
-
n_rows,
|
138
|
-
idx,
|
139
|
-
field_mask,
|
140
|
-
obj_buf,
|
141
|
-
obj_buf_start,
|
142
|
-
decompress,
|
143
|
-
)
|
144
|
-
|
145
|
-
|
146
|
-
class LH5Store(lh5.LH5Store):
|
147
|
-
"""
|
148
|
-
.. warning::
|
149
|
-
This class is deprecated, use :class:`lgdo.lh5.iterator.LH5Store`.
|
150
|
-
|
151
|
-
"""
|
152
|
-
|
153
|
-
def __init__(self, base_path: str = "", keep_open: bool = False):
|
154
|
-
warn(
|
155
|
-
"lgdo.lh5_store has moved to a subfolder lgdo.lh5 containing LH5Store. "
|
156
|
-
"Please replace 'from lgdo.lh5_store import LH5Store' with 'from lgdo.lh5 import LH5Store'."
|
157
|
-
"lgdo.lh5_store will be removed in a future release.",
|
158
|
-
DeprecationWarning,
|
159
|
-
stacklevel=2,
|
160
|
-
)
|
161
|
-
super().__init__(base_path, keep_open)
|
162
|
-
|
163
|
-
def read_object(
|
164
|
-
self,
|
165
|
-
name: str,
|
166
|
-
lh5_file: str | h5py.File | list[str | h5py.File],
|
167
|
-
**kwargs,
|
168
|
-
) -> tuple[LGDO, int]:
|
169
|
-
"""
|
170
|
-
.. warning::
|
171
|
-
This method is deprecated, use :meth:`lgdo.lh5.store.LH5Store.read`.
|
172
|
-
|
173
|
-
"""
|
174
|
-
warn(
|
175
|
-
"LH5Store.read_object() has been renamed to LH5Store.read(), "
|
176
|
-
"Please update your code."
|
177
|
-
"LH5Store.read_object() will be removed in a future release.",
|
178
|
-
DeprecationWarning,
|
179
|
-
stacklevel=2,
|
180
|
-
)
|
181
|
-
return super().read(self, name, lh5_file, **kwargs)
|
182
|
-
|
183
|
-
def write_object(
|
184
|
-
self,
|
185
|
-
obj: LGDO,
|
186
|
-
name: str,
|
187
|
-
lh5_file: str | h5py.File,
|
188
|
-
**kwargs,
|
189
|
-
) -> tuple[LGDO, int]:
|
190
|
-
"""
|
191
|
-
.. warning::
|
192
|
-
This method is deprecated, use :meth:`lgdo.lh5.store.LH5Store.write`.
|
193
|
-
|
194
|
-
"""
|
195
|
-
warn(
|
196
|
-
"LH5Store.write_object() has been renamed to LH5Store.write(), "
|
197
|
-
"Please update your code."
|
198
|
-
"LH5Store.write_object() will be removed in a future release.",
|
199
|
-
DeprecationWarning,
|
200
|
-
stacklevel=2,
|
201
|
-
)
|
202
|
-
return super().read(self, obj, name, lh5_file, **kwargs)
|
203
|
-
|
204
|
-
|
205
|
-
def load_dfs(
|
206
|
-
f_list: str | list[str],
|
207
|
-
par_list: list[str],
|
208
|
-
lh5_group: str = "",
|
209
|
-
idx_list: list[np.ndarray | list | tuple] | None = None,
|
210
|
-
) -> pd.DataFrame:
|
211
|
-
"""
|
212
|
-
.. warning::
|
213
|
-
This function is deprecated, use :meth:`lgdo.types.lgdo.LGDO.view_as` to
|
214
|
-
view LGDO data as a Pandas data structure.
|
215
|
-
|
216
|
-
"""
|
217
|
-
warn(
|
218
|
-
"lgdo.lh5_store has moved to a subfolder lgdo.lh5. "
|
219
|
-
"Please replace 'from lgdo.lh5_store import load_dfs' with 'from lgdo.lh5 import load_dfs'. "
|
220
|
-
"lgdo.lh5_store will be removed in a future release.",
|
221
|
-
DeprecationWarning,
|
222
|
-
stacklevel=2,
|
223
|
-
)
|
224
|
-
return lh5.load_dfs(f_list, par_list, lh5_group, idx_list)
|
225
|
-
|
226
|
-
|
227
|
-
def load_nda(
|
228
|
-
f_list: str | list[str],
|
229
|
-
par_list: list[str],
|
230
|
-
lh5_group: str = "",
|
231
|
-
idx_list: list[np.ndarray | list | tuple] | None = None,
|
232
|
-
) -> dict[str, np.ndarray]:
|
233
|
-
"""
|
234
|
-
.. warning::
|
235
|
-
This function is deprecated, use :meth:`lgdo.types.lgdo.LGDO.view_as` to
|
236
|
-
view LGDO data as a NumPy data structure.
|
237
|
-
|
238
|
-
"""
|
239
|
-
warn(
|
240
|
-
"lgdo.lh5_store has moved to a subfolder lgdo.lh5. "
|
241
|
-
"Please replace 'from lgdo.lh5_store import load_nda' with 'from lgdo.lh5 import load_nda'. "
|
242
|
-
"lgdo.lh5_store will be removed in a future release.",
|
243
|
-
DeprecationWarning,
|
244
|
-
stacklevel=2,
|
245
|
-
)
|
246
|
-
return lh5.load_nda(f_list, par_list, lh5_group, idx_list)
|
247
|
-
|
248
|
-
|
249
|
-
def ls(lh5_file: str | h5py.Group, lh5_group: str = "") -> list[str]:
|
250
|
-
"""
|
251
|
-
.. warning::
|
252
|
-
This function is deprecated, import :func:`lgdo.lh5.tools.ls`.
|
253
|
-
|
254
|
-
"""
|
255
|
-
warn(
|
256
|
-
"lgdo.lh5_store has moved to a subfolder lgdo.lh5. "
|
257
|
-
"Please replace 'from lgdo.lh5_store import ls' with 'from lgdo.lh5 import ls'. "
|
258
|
-
"lgdo.lh5_store will be removed in a future release.",
|
259
|
-
DeprecationWarning,
|
260
|
-
stacklevel=2,
|
261
|
-
)
|
262
|
-
return lh5.ls(lh5_file, lh5_group)
|
263
|
-
|
264
|
-
|
265
|
-
def show(
|
266
|
-
lh5_file: str | h5py.Group,
|
267
|
-
lh5_group: str = "/",
|
268
|
-
attrs: bool = False,
|
269
|
-
indent: str = "",
|
270
|
-
header: bool = True,
|
271
|
-
) -> None:
|
272
|
-
"""
|
273
|
-
.. warning::
|
274
|
-
This function is deprecated, import :func:`lgdo.lh5.tools.show`.
|
275
|
-
|
276
|
-
"""
|
277
|
-
warn(
|
278
|
-
"lgdo.lh5_store has moved to a subfolder lgdo.lh5. "
|
279
|
-
"Please replace 'from lgdo.lh5_store import show' with 'from lgdo.lh5 import show'. "
|
280
|
-
"lgdo.lh5_store will be removed in a future release.",
|
281
|
-
DeprecationWarning,
|
282
|
-
stacklevel=2,
|
283
|
-
)
|
284
|
-
lh5.show(lh5_file, lh5_group, attrs, indent, header)
|
File without changes
|
File without changes
|
File without changes
|