From 14d37c3e67f3c721015e0c0829905023fdcfd3ba Mon Sep 17 00:00:00 2001 From: Philipp Dijkstal Date: Tue, 10 Jun 2025 14:46:18 +0200 Subject: [PATCH] Handle missing channels in data --- ext/bscacquisition.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ext/bscacquisition.py b/ext/bscacquisition.py index 06774d9..c1bdd02 100644 --- a/ext/bscacquisition.py +++ b/ext/bscacquisition.py @@ -21,9 +21,7 @@ class BSCAcquisition(Acquisition): self.bscache.flush() data = [] for i in range(n_pulses): - #print('Requested %i' % i) data.append(next(self.bscache)) - #print('Received %i' % i) # write out the data file use_channels = self.use_channels or self.bscache.channels.keys() @@ -33,7 +31,12 @@ class BSCAcquisition(Acquisition): pidname = 'pulse_id/group%d' % self.grp hid.create_dataset(pidname, data=singledata) for chn in use_channels: - singledata = [ele[chn] for ele in data] + singledata = [] + for ele in data: + if chn in ele: + singledata.append(ele[chn]) + else: + print('%s not in data!' % chn) if not chn == 'pid': dname = chn.replace(':','/')+'/data' hid.create_dataset(dname, data=singledata)