From b2a65836ab6f33299bcfb17bbacc325382050209 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Wed, 9 Mar 2022 14:39:23 -0500 Subject: Basic instrument handles channel config too --- qolab/hardware/basic.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/qolab/hardware/basic.py b/qolab/hardware/basic.py index 5a040a0..f9a4dee 100644 --- a/qolab/hardware/basic.py +++ b/qolab/hardware/basic.py @@ -49,6 +49,23 @@ class BasicInstrument: def tsdb_append(f): return tsdb_append_metric_for_class_setter_or_getter()(f) + def getChannelsConfig(self): + chconfig = {} + if not hasattr(self, 'numberOfChannels'): + return chconfig + + for chNum in range(1, self.numberOfChannels+1): + chNconfig = {} + for p in self.channelProperties: + getter = f'getChan{p}' + if not hasattr(self, getter): + print(f'warning no getter for {p}, i.e. {getter} is missing') + continue + res = getattr(self, getter)(chNum) + chNconfig[p] = res + chconfig[chNum] = chNconfig + return chconfig + def getConfig(self): config = self.config.copy() dconfig = {} @@ -63,6 +80,9 @@ class BasicInstrument: res = getattr(self, getter)() dconfig[p] = res config['DeviceConfig'] = dconfig + if not hasattr(self, 'numberOfChannels'): + return config + config['ChannelsConfig']=self.getChannelsConfig(); return config def setConfig(self, cfg): -- cgit v1.2.3