From 15ced50640ff79956f26a965db5d51913a8910ff Mon Sep 17 00:00:00 2001 From: Sebastian Goscik Date: Mon, 21 Mar 2016 10:59:42 +0000 Subject: [PATCH] daq: Fixed channel merging Fixed channel merging when setting merge to True. Channel merges done by setting a mapping manually were not affected by this bug. --- wlauto/instrumentation/daq/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wlauto/instrumentation/daq/__init__.py b/wlauto/instrumentation/daq/__init__.py index 2d35c2ad..7eb51020 100644 --- a/wlauto/instrumentation/daq/__init__.py +++ b/wlauto/instrumentation/daq/__init__.py @@ -310,7 +310,10 @@ class Daq(Instrument): if isinstance(self.merge_channels, bool): if self.merge_channels: # Create a dict of potential prefixes and a list of their suffixes - grouped_suffixes = {label[:-1]: label for label in sorted(self.labels) if len(label) > 1} + grouped_suffixes = defaultdict(list) + for label in sorted(self.labels): + if len(label) > 1: + grouped_suffixes[label[:-1]].append(label) # Only merge channels if more than one channel has the same prefix and the prefixes # are consecutive letters starting with 'a'. self.label_map = {}