legend-daq2lh5 1.6.1__py3-none-any.whl → 1.6.2__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.
- daq2lh5/_version.py +2 -2
- daq2lh5/cli.py +12 -0
- daq2lh5/fc/fc_config_decoder.py +6 -0
- daq2lh5/fc/fc_eventheader_decoder.py +2 -2
- daq2lh5/fc/fc_fsp_decoder.py +14 -9
- daq2lh5/fc/fc_status_decoder.py +1 -1
- daq2lh5/fc/fc_streamer.py +2 -1
- daq2lh5/orca/orca_fcio.py +122 -83
- {legend_daq2lh5-1.6.1.dist-info → legend_daq2lh5-1.6.2.dist-info}/METADATA +2 -2
- {legend_daq2lh5-1.6.1.dist-info → legend_daq2lh5-1.6.2.dist-info}/RECORD +14 -14
- {legend_daq2lh5-1.6.1.dist-info → legend_daq2lh5-1.6.2.dist-info}/WHEEL +0 -0
- {legend_daq2lh5-1.6.1.dist-info → legend_daq2lh5-1.6.2.dist-info}/entry_points.txt +0 -0
- {legend_daq2lh5-1.6.1.dist-info → legend_daq2lh5-1.6.2.dist-info}/licenses/LICENSE +0 -0
- {legend_daq2lh5-1.6.1.dist-info → legend_daq2lh5-1.6.2.dist-info}/top_level.txt +0 -0
daq2lh5/_version.py
CHANGED
daq2lh5/cli.py
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
5
|
import argparse
|
6
|
+
import json
|
6
7
|
import os
|
7
8
|
import sys
|
8
9
|
|
@@ -78,6 +79,13 @@ def daq2lh5_cli():
|
|
78
79
|
parser.add_argument(
|
79
80
|
"--overwrite", "-w", action="store_true", help="""Overwrite output files"""
|
80
81
|
)
|
82
|
+
parser.add_argument(
|
83
|
+
"--kwargs",
|
84
|
+
"-k",
|
85
|
+
type=str,
|
86
|
+
default="{}",
|
87
|
+
help="""Any additional kwargs to pass to build_raw, will be parsed as a JSON string""",
|
88
|
+
)
|
81
89
|
|
82
90
|
args = parser.parse_args()
|
83
91
|
|
@@ -92,6 +100,9 @@ def daq2lh5_cli():
|
|
92
100
|
print(__version__) # noqa: T201
|
93
101
|
sys.exit()
|
94
102
|
|
103
|
+
if args.kwargs:
|
104
|
+
kwargs = json.loads(args.kwargs)
|
105
|
+
|
95
106
|
for stream in args.in_stream:
|
96
107
|
basename = os.path.splitext(os.path.basename(stream))[0]
|
97
108
|
build_raw(
|
@@ -102,4 +113,5 @@ def daq2lh5_cli():
|
|
102
113
|
n_max=args.max_rows,
|
103
114
|
overwrite=args.overwrite,
|
104
115
|
orig_basename=basename,
|
116
|
+
**kwargs,
|
105
117
|
)
|
daq2lh5/fc/fc_config_decoder.py
CHANGED
@@ -66,6 +66,7 @@ class FCConfigDecoder(DataDecoder):
|
|
66
66
|
def __init__(self, *args, **kwargs) -> None:
|
67
67
|
super().__init__(*args, **kwargs)
|
68
68
|
self.decoded_values = copy.deepcopy(fc_config_decoded_values)
|
69
|
+
self.key_list = []
|
69
70
|
|
70
71
|
def decode_packet(
|
71
72
|
self,
|
@@ -126,7 +127,12 @@ class FCConfigDecoder(DataDecoder):
|
|
126
127
|
ntraces = fcio.config.adcs + fcio.config.triggers
|
127
128
|
tbl.add_field("tracemap", lgdo.Array(fcio.config.tracemap[:ntraces]))
|
128
129
|
|
130
|
+
self.key_list.append(f"fcid_{fcio.config.streamid & 0xFFFF}/config")
|
131
|
+
|
129
132
|
return tbl
|
130
133
|
|
134
|
+
def get_key_lists(self) -> list[list[int | str]]:
|
135
|
+
return [copy.deepcopy(self.key_list)]
|
136
|
+
|
131
137
|
def get_decoded_values(self, key: int | str = None) -> dict[str, dict[str, Any]]:
|
132
138
|
return self.decoded_values
|
@@ -212,7 +212,7 @@ class FCEventHeaderDecoder(DataDecoder):
|
|
212
212
|
self.decoded_values["baseline"]["length_guess"] = n_traces
|
213
213
|
self.decoded_values["daqenergy"]["length_guess"] = n_traces
|
214
214
|
|
215
|
-
self.key_list = [
|
215
|
+
self.key_list = [f"fcid_{fcio_stream.config.streamid & 0xFFFF}/evt_hdr"]
|
216
216
|
|
217
217
|
def get_key_lists(self) -> list[list[int | str]]:
|
218
218
|
return [copy.deepcopy(self.key_list)]
|
@@ -232,7 +232,7 @@ class FCEventHeaderDecoder(DataDecoder):
|
|
232
232
|
) -> bool:
|
233
233
|
|
234
234
|
# only one key available: this streamid
|
235
|
-
key =
|
235
|
+
key = f"fcid_{fcio.config.streamid & 0xFFFF}/evt_hdr"
|
236
236
|
if key not in evt_hdr_rbkd:
|
237
237
|
return False
|
238
238
|
|
daq2lh5/fc/fc_fsp_decoder.py
CHANGED
@@ -8,7 +8,6 @@ import numpy as np
|
|
8
8
|
from fcio import FCIO, Limits
|
9
9
|
|
10
10
|
from ..data_decoder import DataDecoder
|
11
|
-
from .fc_eventheader_decoder import get_key
|
12
11
|
|
13
12
|
fsp_config_decoded_values = {
|
14
13
|
"packet_id": {
|
@@ -183,7 +182,7 @@ class FSPConfigDecoder(DataDecoder):
|
|
183
182
|
self.key_list = []
|
184
183
|
|
185
184
|
def set_fcio_stream(self, fcio_stream: FCIO) -> None:
|
186
|
-
self.key_list = [f"
|
185
|
+
self.key_list = [f"swtid_{fcio_stream.config.streamid & 0xFFFF}/config"]
|
187
186
|
if fcio_stream.fsp is not None:
|
188
187
|
wps_n_traces = fcio_stream.fsp.config.wps["tracemap"]["n_mapped"]
|
189
188
|
hwm_n_traces = fcio_stream.fsp.config.hwm["tracemap"]["n_mapped"]
|
@@ -229,6 +228,9 @@ class FSPConfigDecoder(DataDecoder):
|
|
229
228
|
def get_decoded_values(self, key: int = None) -> dict[str, dict[str, Any]]:
|
230
229
|
return self.decoded_values
|
231
230
|
|
231
|
+
def get_key_lists(self) -> list[list[int | str]]:
|
232
|
+
return [copy.deepcopy(self.key_list)]
|
233
|
+
|
232
234
|
def decode_packet(
|
233
235
|
self,
|
234
236
|
fcio: FCIO,
|
@@ -659,6 +661,9 @@ class FSPConfigDecoder(DataDecoder):
|
|
659
661
|
"dsp_ct_thresholds",
|
660
662
|
lgdo.Array(np.array(ct["thresholds"], dtype="uint16")[:ct_n_traces]),
|
661
663
|
)
|
664
|
+
|
665
|
+
self.key_list.append(f"swtid_{fcio.config.streamid & 0xFFFF}/config")
|
666
|
+
|
662
667
|
return self.fsp_config
|
663
668
|
|
664
669
|
def make_lgdo(self, key: int | str = None, size: int = None) -> lgdo.Struct:
|
@@ -694,7 +699,7 @@ class FSPStatusDecoder(DataDecoder):
|
|
694
699
|
self.key_list = []
|
695
700
|
|
696
701
|
def set_fcio_stream(self, fcio_stream: FCIO) -> None:
|
697
|
-
self.key_list = [f"
|
702
|
+
self.key_list = [f"swtid_{fcio_stream.config.streamid & 0xFFFF}/status"]
|
698
703
|
|
699
704
|
def get_key_lists(self) -> list[list[int | str]]:
|
700
705
|
return [copy.deepcopy(self.key_list)]
|
@@ -709,7 +714,7 @@ class FSPStatusDecoder(DataDecoder):
|
|
709
714
|
packet_id: int,
|
710
715
|
) -> bool:
|
711
716
|
|
712
|
-
key = f"
|
717
|
+
key = f"swtid_{fcio.config.streamid & 0xFFFF}/status"
|
713
718
|
if key not in fsp_status_rbkd:
|
714
719
|
return False
|
715
720
|
fsp_status_rb = fsp_status_rbkd[key]
|
@@ -796,8 +801,8 @@ class FSPEventDecoder(DataDecoder):
|
|
796
801
|
def set_fcio_stream(self, fcio_stream: FCIO) -> None:
|
797
802
|
|
798
803
|
self.key_list = [
|
799
|
-
f"
|
800
|
-
f"
|
804
|
+
f"swtid_{fcio_stream.config.streamid & 0xFFFF}/event",
|
805
|
+
f"swtid_{fcio_stream.config.streamid & 0xFFFF}/evt_hdr",
|
801
806
|
]
|
802
807
|
|
803
808
|
def get_decoded_values(self, key: int = None) -> dict[str, dict[str, Any]]:
|
@@ -815,9 +820,9 @@ class FSPEventDecoder(DataDecoder):
|
|
815
820
|
) -> bool:
|
816
821
|
|
817
822
|
if is_header:
|
818
|
-
key = f"
|
823
|
+
key = f"swtid_{fcio.config.streamid & 0xFFFF}/evt_hdr"
|
819
824
|
else:
|
820
|
-
key = f"
|
825
|
+
key = f"swtid_{fcio.config.streamid & 0xFFFF}/event"
|
821
826
|
|
822
827
|
if key not in fsp_evt_rbkd:
|
823
828
|
return False
|
@@ -877,7 +882,7 @@ class FSPEventDecoder(DataDecoder):
|
|
877
882
|
if lens > 0:
|
878
883
|
tbl["obs_ps_hwm_prescaled_trace_idx"].flattened_data.nda[
|
879
884
|
start:end
|
880
|
-
] = fcio.fsp.event.
|
885
|
+
] = fcio.fsp.event.obs_ps_hwm_prescaled_trace_idx
|
881
886
|
tbl["obs_ps_hwm_prescaled_trace_idx"].cumulative_length[loc] = end
|
882
887
|
|
883
888
|
fsp_evt_rb.loc += 1
|
daq2lh5/fc/fc_status_decoder.py
CHANGED
daq2lh5/fc/fc_streamer.py
CHANGED
@@ -148,7 +148,8 @@ class FCStreamer(DataStreamer):
|
|
148
148
|
if len(config_rb_list) != 1:
|
149
149
|
log.warning(
|
150
150
|
f"config_rb_list for {config_decoder} had length {len(config_rb_list)}, "
|
151
|
-
"ignoring all but the first"
|
151
|
+
"ignoring all but the first. "
|
152
|
+
f"{config_rb_list}"
|
152
153
|
)
|
153
154
|
rb = config_rb_list[0]
|
154
155
|
else:
|
daq2lh5/orca/orca_fcio.py
CHANGED
@@ -15,7 +15,7 @@ from daq2lh5.fc.fc_fsp_decoder import (
|
|
15
15
|
FSPStatusDecoder,
|
16
16
|
)
|
17
17
|
from daq2lh5.fc.fc_status_decoder import FCStatusDecoder
|
18
|
-
from daq2lh5.fc.fc_status_decoder import get_key as
|
18
|
+
from daq2lh5.fc.fc_status_decoder import get_key as get_fc_status_key
|
19
19
|
|
20
20
|
from ..raw_buffer import RawBufferList
|
21
21
|
from .orca_base import OrcaDecoder
|
@@ -126,23 +126,30 @@ class ORFCIOConfigDecoder(OrcaDecoder):
|
|
126
126
|
def set_header(self, header: OrcaHeader) -> None:
|
127
127
|
self.header = header
|
128
128
|
self.fc_hdr_info = extract_header_information(header)
|
129
|
-
self.decoded_values = copy.deepcopy(self.decoder.get_decoded_values())
|
129
|
+
self.decoded_values["fcid"] = copy.deepcopy(self.decoder.get_decoded_values())
|
130
130
|
|
131
131
|
for fcid in self.fc_hdr_info["fsp_enabled"]:
|
132
|
-
|
133
|
-
self.key_list["fc_config"].append(key)
|
132
|
+
self.key_list["fc_config"].append(f"fcid_{fcid}/config")
|
134
133
|
if self.fc_hdr_info["fsp_enabled"][fcid]:
|
135
134
|
self.fsp_decoder = FSPConfigDecoder()
|
136
|
-
self.key_list["fsp_config"].append(f"
|
135
|
+
self.key_list["fsp_config"].append(f"swtid_{fcid}/config")
|
136
|
+
self.decoded_values["swtid"] = copy.deepcopy(
|
137
|
+
self.fsp_decoder.get_decoded_values()
|
138
|
+
)
|
137
139
|
self.max_rows_in_packet = 1
|
138
140
|
|
139
|
-
def get_key_lists(self) -> list[list[
|
141
|
+
def get_key_lists(self) -> list[list[str]]:
|
140
142
|
return list(self.key_list.values())
|
141
143
|
|
142
|
-
def get_decoded_values(self, key:
|
143
|
-
if
|
144
|
-
|
145
|
-
|
144
|
+
def get_decoded_values(self, key: str = None) -> dict[str, Any]:
|
145
|
+
if (
|
146
|
+
isinstance(key, str)
|
147
|
+
and key.startswith("swtid_")
|
148
|
+
and self.fsp_decoder is not None
|
149
|
+
):
|
150
|
+
return self.decoded_values["swtid"]
|
151
|
+
elif (isinstance(key, str) and key.startswith("fcid_")) or key is None:
|
152
|
+
return self.decoded_values["fcid"]
|
146
153
|
raise KeyError(f"no decoded values for key {key}")
|
147
154
|
|
148
155
|
def decode_packet(
|
@@ -159,18 +166,21 @@ class ORFCIOConfigDecoder(OrcaDecoder):
|
|
159
166
|
|
160
167
|
if fcio_stream.config.streamid != packet[2]:
|
161
168
|
log.warning(
|
162
|
-
f"The expected stream id {packet[2]} does not match the contained stream id
|
169
|
+
f"The expected stream id {packet[2]} does not match the contained stream id "
|
170
|
+
f"{fcio_stream.config.streamid}"
|
163
171
|
)
|
164
172
|
|
165
173
|
config_rbkd = rbl.get_keyed_dict()
|
166
174
|
|
175
|
+
fcid = fcio_stream.config.streamid & 0xFFFF
|
176
|
+
|
167
177
|
# TODO: the decoders could fetch lgdo's using it's key_list
|
168
|
-
fc_key =
|
178
|
+
fc_key = f"fcid_{fcid}/config"
|
169
179
|
any_full = self.decoder.decode_packet(
|
170
180
|
fcio_stream, config_rbkd[fc_key], packet_id
|
171
181
|
)
|
172
|
-
if self.fsp_decoder is not None:
|
173
|
-
fsp_key = f"
|
182
|
+
if self.fsp_decoder is not None and self.fc_hdr_info["fsp_enabled"][fcid]:
|
183
|
+
fsp_key = f"swtid_{fcid}/config"
|
174
184
|
any_full |= self.fsp_decoder.decode_packet(
|
175
185
|
fcio_stream, config_rbkd[fsp_key], packet_id
|
176
186
|
)
|
@@ -184,7 +194,7 @@ class ORFCIOStatusDecoder(OrcaDecoder):
|
|
184
194
|
self.decoder = FCStatusDecoder()
|
185
195
|
self.fsp_decoder = None
|
186
196
|
self.decoded_values = {}
|
187
|
-
self.key_list =
|
197
|
+
self.key_list = []
|
188
198
|
self.max_rows_in_packet = 0
|
189
199
|
super().__init__(header=header, **kwargs)
|
190
200
|
|
@@ -192,44 +202,43 @@ class ORFCIOStatusDecoder(OrcaDecoder):
|
|
192
202
|
"""Setter for headers. Overload to set card parameters, etc."""
|
193
203
|
self.header = header
|
194
204
|
self.fc_hdr_info = extract_header_information(header)
|
195
|
-
self.decoded_values = copy.deepcopy(self.decoder.get_decoded_values())
|
196
205
|
|
197
206
|
for fcid in self.fc_hdr_info["n_card"]:
|
198
207
|
# If the data was taken without a master distribution module,
|
199
208
|
# i.e. only one ADC Module the decoder will just not write to the buffer.
|
200
209
|
|
201
210
|
# MDB key
|
202
|
-
|
211
|
+
key_list_fcid = [get_fc_status_key(fcid, 0)]
|
203
212
|
# ADC module keys
|
204
|
-
|
205
|
-
|
213
|
+
key_list_fcid += [
|
214
|
+
get_fc_status_key(fcid, 0x2000 + i)
|
206
215
|
for i in range(self.fc_hdr_info["n_card"][fcid])
|
207
216
|
]
|
208
|
-
|
217
|
+
self.key_list.append(key_list_fcid)
|
218
|
+
self.decoded_values["fcid"] = copy.deepcopy(
|
219
|
+
self.decoder.get_decoded_values()
|
220
|
+
)
|
209
221
|
if self.fc_hdr_info["fsp_enabled"][fcid]:
|
210
|
-
key = get_key(fcid, 0, 0)
|
211
|
-
self.key_list["fsp_status"].append(f"fsp_status_{key}")
|
212
222
|
self.fsp_decoder = FSPStatusDecoder()
|
223
|
+
self.key_list.append([f"swtid_{fcid}/status"])
|
224
|
+
self.decoded_values["swtid"] = copy.deepcopy(
|
225
|
+
self.fsp_decoder.get_decoded_values()
|
226
|
+
)
|
213
227
|
self.max_rows_in_packet = max(self.fc_hdr_info["n_card"].values()) + 1
|
214
228
|
|
215
|
-
def get_key_lists(self) -> list[list[
|
216
|
-
return
|
229
|
+
def get_key_lists(self) -> list[list[str]]:
|
230
|
+
return copy.deepcopy(self.key_list)
|
217
231
|
|
218
|
-
def get_decoded_values(self, key:
|
219
|
-
if key is None:
|
220
|
-
dec_vals_list = list(self.decoded_values)
|
221
|
-
if len(dec_vals_list) > 0:
|
222
|
-
return {dec_vals_list[0]: self.decoded_values[dec_vals_list[0]]}
|
223
|
-
raise RuntimeError("decoded_values not built")
|
232
|
+
def get_decoded_values(self, key: str = None) -> dict[str, Any]:
|
224
233
|
|
225
234
|
if (
|
226
235
|
isinstance(key, str)
|
227
|
-
and key.startswith("
|
236
|
+
and key.startswith("swtid_")
|
228
237
|
and self.fsp_decoder is not None
|
229
238
|
):
|
230
|
-
return
|
231
|
-
elif isinstance(key,
|
232
|
-
return
|
239
|
+
return self.decoded_values["swtid"]
|
240
|
+
elif (isinstance(key, str) and key.startswith("fcid_")) or key is None:
|
241
|
+
return self.decoded_values["fcid"]
|
233
242
|
else:
|
234
243
|
raise KeyError(f"no decoded values for key {key}")
|
235
244
|
|
@@ -245,15 +254,25 @@ class ORFCIOStatusDecoder(OrcaDecoder):
|
|
245
254
|
fcio_stream.set_mem_field(memoryview(packet[3:]))
|
246
255
|
|
247
256
|
any_full = False
|
248
|
-
|
249
|
-
|
250
|
-
|
257
|
+
|
258
|
+
if not fcio_stream.get_record():
|
259
|
+
raise OSError(
|
260
|
+
f"Missing record in FCIO stream {fcio_stream.config.streamid & 0xFFFF}."
|
261
|
+
)
|
262
|
+
|
263
|
+
if fcio_stream.tag == Tags.FSPStatus:
|
264
|
+
if self.fsp_decoder is not None:
|
265
|
+
any_full |= self.fsp_decoder.decode_packet(
|
251
266
|
fcio_stream, status_rbkd, packet_id
|
252
267
|
)
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
268
|
+
|
269
|
+
if not fcio_stream.get_record():
|
270
|
+
raise OSError(
|
271
|
+
f"Missing record in FCIO stream {fcio_stream.config.streamid & 0xFFFF}."
|
272
|
+
)
|
273
|
+
|
274
|
+
if fcio_stream.tag == Tags.Status:
|
275
|
+
any_full |= self.decoder.decode_packet(fcio_stream, status_rbkd, packet_id)
|
257
276
|
|
258
277
|
return bool(any_full)
|
259
278
|
|
@@ -276,35 +295,31 @@ class ORFCIOEventHeaderDecoder(OrcaDecoder):
|
|
276
295
|
|
277
296
|
key_list = self.fc_hdr_info["key_list"]
|
278
297
|
for fcid in key_list:
|
279
|
-
|
280
|
-
self.
|
281
|
-
|
298
|
+
self.key_list["fc_eventheader"].append(f"fcid_{fcid}/evt_hdr")
|
299
|
+
self.decoded_values["fcid"] = copy.deepcopy(
|
300
|
+
self.decoder.get_decoded_values()
|
301
|
+
)
|
282
302
|
if self.fc_hdr_info["fsp_enabled"][fcid]:
|
283
303
|
self.fsp_decoder = FSPEventDecoder()
|
284
|
-
self.key_list["fsp_eventheader"].append(f"
|
304
|
+
self.key_list["fsp_eventheader"].append(f"swtid_{fcid}/evt_hdr")
|
305
|
+
self.decoded_values["swtid"] = copy.deepcopy(
|
306
|
+
self.fsp_decoder.get_decoded_values()
|
307
|
+
)
|
285
308
|
|
286
309
|
self.max_rows_in_packet = 1
|
287
310
|
|
288
|
-
def get_key_lists(self) -> list[list[
|
311
|
+
def get_key_lists(self) -> list[list[str]]:
|
289
312
|
return list(self.key_list.values())
|
290
313
|
|
291
|
-
def get_decoded_values(self, key:
|
314
|
+
def get_decoded_values(self, key: str = None) -> dict[str, Any]:
|
292
315
|
if (
|
293
316
|
isinstance(key, str)
|
294
|
-
and key.startswith("
|
317
|
+
and key.startswith("swtid_")
|
295
318
|
and self.fsp_decoder is not None
|
296
319
|
):
|
297
|
-
return
|
298
|
-
elif isinstance(key,
|
299
|
-
fcid
|
300
|
-
if fcid in self.decoded_values:
|
301
|
-
return self.decoded_values[fcid]
|
302
|
-
elif key is None and self.fsp_decoder is None:
|
303
|
-
dec_vals_list = list(self.decoded_values.values())
|
304
|
-
if len(dec_vals_list) > 0:
|
305
|
-
return dec_vals_list[0]
|
306
|
-
raise RuntimeError("decoded_values not built")
|
307
|
-
|
320
|
+
return self.decoded_values["swtid"]
|
321
|
+
elif (isinstance(key, str) and key.startswith("fcid_")) or key is None:
|
322
|
+
return self.decoded_values["fcid"]
|
308
323
|
raise KeyError(f"no decoded values for key {key}")
|
309
324
|
|
310
325
|
def decode_packet(
|
@@ -315,15 +330,25 @@ class ORFCIOEventHeaderDecoder(OrcaDecoder):
|
|
315
330
|
fcio_stream.set_mem_field(memoryview(packet[3:]))
|
316
331
|
|
317
332
|
any_full = False
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
333
|
+
|
334
|
+
if not fcio_stream.get_record():
|
335
|
+
raise OSError(
|
336
|
+
f"Missing record in FCIO stream {fcio_stream.config.streamid & 0xFFFF}."
|
337
|
+
)
|
338
|
+
|
339
|
+
if fcio_stream.tag == Tags.FSPEvent:
|
340
|
+
if self.fsp_decoder is not None:
|
341
|
+
any_full |= self.fsp_decoder.decode_packet(
|
342
|
+
fcio_stream, evthdr_rbkd, packet_id, is_header=True
|
322
343
|
)
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
344
|
+
|
345
|
+
if not fcio_stream.get_record():
|
346
|
+
raise OSError(
|
347
|
+
f"Missing record in FCIO stream {fcio_stream.config.streamid & 0xFFFF}."
|
348
|
+
)
|
349
|
+
|
350
|
+
if fcio_stream.tag == Tags.EventHeader:
|
351
|
+
any_full |= self.decoder.decode_packet(fcio_stream, evthdr_rbkd, packet_id)
|
327
352
|
|
328
353
|
return bool(any_full)
|
329
354
|
|
@@ -335,7 +360,7 @@ class ORFCIOEventDecoder(OrcaDecoder):
|
|
335
360
|
self.decoder = FCEventDecoder()
|
336
361
|
self.fsp_decoder = None
|
337
362
|
|
338
|
-
self.key_list =
|
363
|
+
self.key_list = []
|
339
364
|
self.decoded_values = {}
|
340
365
|
self.max_rows_in_packet = 0
|
341
366
|
|
@@ -347,24 +372,26 @@ class ORFCIOEventDecoder(OrcaDecoder):
|
|
347
372
|
self.fc_hdr_info = extract_header_information(header)
|
348
373
|
key_list = self.fc_hdr_info["key_list"]
|
349
374
|
for fcid in key_list:
|
350
|
-
self.key_list
|
375
|
+
self.key_list.append(key_list[fcid])
|
351
376
|
self.decoded_values[fcid] = copy.deepcopy(self.decoder.get_decoded_values())
|
352
377
|
self.decoded_values[fcid]["waveform"]["wf_len"] = self.fc_hdr_info[
|
353
378
|
"wf_len"
|
354
379
|
][fcid]
|
355
380
|
if self.fc_hdr_info["fsp_enabled"][fcid]:
|
356
|
-
key = get_key(fcid, 0, 0)
|
357
|
-
self.key_list["fsp_event"].append(f"fsp_event_{key}")
|
358
381
|
self.fsp_decoder = FSPEventDecoder()
|
382
|
+
self.key_list.append([f"swtid_{fcid}/event"])
|
383
|
+
self.decoded_values["swtid"] = copy.deepcopy(
|
384
|
+
self.fsp_decoder.get_decoded_values()
|
385
|
+
)
|
359
386
|
self.max_rows_in_packet = max(self.fc_hdr_info["n_adc"].values())
|
360
387
|
|
361
|
-
def get_key_lists(self) -> list[list[int]]:
|
362
|
-
return
|
388
|
+
def get_key_lists(self) -> list[list[int | str]]:
|
389
|
+
return copy.deepcopy(self.key_list)
|
363
390
|
|
364
391
|
def get_max_rows_in_packet(self) -> int:
|
365
392
|
return self.max_rows_in_packet
|
366
393
|
|
367
|
-
def get_decoded_values(self, key: int = None) -> dict[str, Any]:
|
394
|
+
def get_decoded_values(self, key: int | str = None) -> dict[str, Any]:
|
368
395
|
if key is None:
|
369
396
|
dec_vals_list = list(self.decoded_values.values())
|
370
397
|
if len(dec_vals_list) > 0:
|
@@ -373,10 +400,10 @@ class ORFCIOEventDecoder(OrcaDecoder):
|
|
373
400
|
|
374
401
|
if (
|
375
402
|
isinstance(key, str)
|
376
|
-
and key.startswith("
|
403
|
+
and key.startswith("swtid_")
|
377
404
|
and self.fsp_decoder is not None
|
378
405
|
):
|
379
|
-
return
|
406
|
+
return self.decoded_values["swtid"]
|
380
407
|
elif isinstance(key, int):
|
381
408
|
fcid = get_fcid(key)
|
382
409
|
if fcid in self.decoded_values:
|
@@ -394,12 +421,24 @@ class ORFCIOEventDecoder(OrcaDecoder):
|
|
394
421
|
fcio_stream.set_mem_field(memoryview(packet[3:]))
|
395
422
|
|
396
423
|
any_full = False
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
424
|
+
|
425
|
+
if not fcio_stream.get_record():
|
426
|
+
raise OSError(
|
427
|
+
f"Missing record in FCIO stream {fcio_stream.config.streamid & 0xFFFF}."
|
428
|
+
)
|
429
|
+
|
430
|
+
if fcio_stream.tag == Tags.FSPEvent:
|
431
|
+
if self.fsp_decoder is not None:
|
432
|
+
any_full |= self.fsp_decoder.decode_packet(
|
433
|
+
fcio_stream, evt_rbkd, packet_id
|
434
|
+
)
|
435
|
+
|
436
|
+
if not fcio_stream.get_record():
|
437
|
+
raise OSError(
|
438
|
+
f"Missing record in FCIO stream {fcio_stream.config.streamid & 0xFFFF}."
|
439
|
+
)
|
440
|
+
|
441
|
+
if fcio_stream.tag == Tags.Event or fcio_stream.tag == Tags.SparseEvent:
|
442
|
+
any_full |= self.decoder.decode_packet(fcio_stream, evt_rbkd, packet_id)
|
404
443
|
|
405
444
|
return bool(any_full)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: legend-daq2lh5
|
3
|
-
Version: 1.6.
|
3
|
+
Version: 1.6.2
|
4
4
|
Summary: Convert digitizer data to LH5
|
5
5
|
Author-email: Jason Detwiler <jasondet@uw.edu>
|
6
6
|
Maintainer: The LEGEND collaboration
|
@@ -23,7 +23,7 @@ Requires-Python: >=3.9
|
|
23
23
|
Description-Content-Type: text/markdown
|
24
24
|
License-File: LICENSE
|
25
25
|
Requires-Dist: dspeed>=1.3
|
26
|
-
Requires-Dist: fcio>=0.7.
|
26
|
+
Requires-Dist: fcio>=0.7.9
|
27
27
|
Requires-Dist: h5py>=3.2.0
|
28
28
|
Requires-Dist: hdf5plugin
|
29
29
|
Requires-Dist: legend-pydataobj>=1.6
|
@@ -1,7 +1,7 @@
|
|
1
1
|
daq2lh5/__init__.py,sha256=VPmwKuZSA0icpce05ojhnsKWhR4_QUgD0oVXUoN9wks,975
|
2
|
-
daq2lh5/_version.py,sha256=
|
2
|
+
daq2lh5/_version.py,sha256=0l_x32-zDcY9aQqQSs0LtsRx42EjkEfyXdUn9HtFgXU,511
|
3
3
|
daq2lh5/build_raw.py,sha256=wehR1jADL_ponguOMfAsMTxsebE-qdztFw4Txm76fpw,10716
|
4
|
-
daq2lh5/cli.py,sha256=
|
4
|
+
daq2lh5/cli.py,sha256=yCLshhXZdXpeaVElqLYwGHR1uN7fcPDRnsrFQgGdwYM,3210
|
5
5
|
daq2lh5/data_decoder.py,sha256=45ckhpfqKh6_FfPUn_iETZLjRFd4VtvQhet4l2KvldA,10606
|
6
6
|
daq2lh5/data_streamer.py,sha256=-uns1Y9iReVSJTXGCXD05QQLfqjbQn-VodEmDj7uSJo,16016
|
7
7
|
daq2lh5/logging.py,sha256=rYNeToaZBTCaIiC42a4CUroAo1PCOreTXbpEZyMO8Fo,987
|
@@ -16,12 +16,12 @@ daq2lh5/compass/compass_event_decoder.py,sha256=kiPOaEu8SgLD2wbSPbBahcbTBBRAIw35
|
|
16
16
|
daq2lh5/compass/compass_header_decoder.py,sha256=AA-Md2FIT3nD4mXX9CrWvbbfmKiA436-BTmzcU3_XOY,2823
|
17
17
|
daq2lh5/compass/compass_streamer.py,sha256=zSl7IqO0ID0wcixkLE9QVEG3bF9hfGVITVPomCeOFTM,8841
|
18
18
|
daq2lh5/fc/__init__.py,sha256=bB1j6r-bDmylNi0iutQeAJGjsDSjLSoXMqFfXWwfb8I,141
|
19
|
-
daq2lh5/fc/fc_config_decoder.py,sha256=
|
19
|
+
daq2lh5/fc/fc_config_decoder.py,sha256=f-WqmvfDDDnx4ho2q4w5Hmzu55yvweHsi1hgM2X4RbM,4654
|
20
20
|
daq2lh5/fc/fc_event_decoder.py,sha256=c2CQSiNxlOEGOZNSgqM3eM-26EUW6MIfK48Am9CHfro,7887
|
21
|
-
daq2lh5/fc/fc_eventheader_decoder.py,sha256=
|
22
|
-
daq2lh5/fc/fc_fsp_decoder.py,sha256
|
23
|
-
daq2lh5/fc/fc_status_decoder.py,sha256=
|
24
|
-
daq2lh5/fc/fc_streamer.py,sha256=
|
21
|
+
daq2lh5/fc/fc_eventheader_decoder.py,sha256=zY8uNVs16U6qu4_x9vD8850t031fy_py91kxXFoKY38,12337
|
22
|
+
daq2lh5/fc/fc_fsp_decoder.py,sha256=sCv3YfZ0QnN7LAS2msYo9XbMeEIFuKmyLp3SiB4fQ9M,35074
|
23
|
+
daq2lh5/fc/fc_status_decoder.py,sha256=o3DjpXtx3VIk3hWrodWopYczfXiJr-ekSUx_HqW2cyc,8818
|
24
|
+
daq2lh5/fc/fc_streamer.py,sha256=iJSd2OiOYAjFtBg-Yr9D64_kp3xO_9Jt5XpO9q0sFpE,9208
|
25
25
|
daq2lh5/llama/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
26
|
daq2lh5/llama/llama_base.py,sha256=B-NCBjE_FQE1WxijWi4Z1XBy4rqLHm2XhkC40s7Sdms,290
|
27
27
|
daq2lh5/llama/llama_event_decoder.py,sha256=DVULTX7JzlRe23HZYXn79VkoU2_z03o7nxWc33bGK8U,14981
|
@@ -30,7 +30,7 @@ daq2lh5/llama/llama_streamer.py,sha256=lrK73JIXjpogPrkP_tpFQQGSyWxFhivSpU1YEfRMH
|
|
30
30
|
daq2lh5/orca/__init__.py,sha256=Xf6uOIOzk_QkKH_7VizGlCo3iuiAgLtUE3A07x_HXC0,175
|
31
31
|
daq2lh5/orca/orca_base.py,sha256=-XIolXsHj-1EdewaGxyvJTZvRGZsDyZe-5PzVOd-LFY,1333
|
32
32
|
daq2lh5/orca/orca_digitizers.py,sha256=Vu05xQO3XYqybjLhzk-XJG41wyeVFSIoXOjvdltDoUw,20865
|
33
|
-
daq2lh5/orca/orca_fcio.py,sha256=
|
33
|
+
daq2lh5/orca/orca_fcio.py,sha256=WDaWp4JkUDOUvrMCxKWI-kXXrZNQNAakDCdNyFaqL3k,16091
|
34
34
|
daq2lh5/orca/orca_flashcam.py,sha256=klGWxME2QS3eOBgb5mD3IrPHXXzb1Zz4B7YDvZvaGD8,33291
|
35
35
|
daq2lh5/orca/orca_header.py,sha256=2WlB8rFXwzD89lX51JXYiOlop0-C4pWEEsIWKq2ouDM,4403
|
36
36
|
daq2lh5/orca/orca_header_decoder.py,sha256=ORIIyfx22ybyKc-uyWy5ER49-dl3BGpHdfV8OCDmjIw,1632
|
@@ -38,9 +38,9 @@ daq2lh5/orca/orca_packet.py,sha256=LtKEAcH2VGzY8AQEqAokZTHonShACsKisGdQR0AMDAM,2
|
|
38
38
|
daq2lh5/orca/orca_run_decoder.py,sha256=61gghgjqD1ovH3KoHFJuKJp0GLJn4X0MIuoYrsIzMfQ,2059
|
39
39
|
daq2lh5/orca/orca_streamer.py,sha256=sLM5PPLOxJ_aJckJOl9UCjyOaPmNxUKDnrLw22fSNbE,16622
|
40
40
|
daq2lh5/orca/skim_orca_file.py,sha256=ESWfbv9yDRGaPf3Ptlw6Dxnc4uwhJoagb_aYlWNyrq0,1954
|
41
|
-
legend_daq2lh5-1.6.
|
42
|
-
legend_daq2lh5-1.6.
|
43
|
-
legend_daq2lh5-1.6.
|
44
|
-
legend_daq2lh5-1.6.
|
45
|
-
legend_daq2lh5-1.6.
|
46
|
-
legend_daq2lh5-1.6.
|
41
|
+
legend_daq2lh5-1.6.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
42
|
+
legend_daq2lh5-1.6.2.dist-info/METADATA,sha256=mMmyM0yX1XPih67NgaGQab1q1z519EuA8BTqksnxDsM,4005
|
43
|
+
legend_daq2lh5-1.6.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
44
|
+
legend_daq2lh5-1.6.2.dist-info/entry_points.txt,sha256=RPm2GPw2YADil9tWgvZsIysmJz9KuktBWH_1P38PWoc,119
|
45
|
+
legend_daq2lh5-1.6.2.dist-info/top_level.txt,sha256=MJQVLyLqMgMKBdVfNXFaCKCjHKakAs19VLbC9ctXZ7A,8
|
46
|
+
legend_daq2lh5-1.6.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|