diff options
Diffstat (limited to 'qolab')
-rw-r--r-- | qolab/hardware/basic.py | 20 |
1 files changed, 20 insertions, 0 deletions
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): |