aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2022-03-09 14:39:23 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2022-03-09 14:39:23 -0500
commitb2a65836ab6f33299bcfb17bbacc325382050209 (patch)
tree87fb754190d01fb3acf68eabf1f35bef9b5478e6
parent95926a516fac100ca6e0b1c8620d46762006f5f7 (diff)
downloadqolab-b2a65836ab6f33299bcfb17bbacc325382050209.tar.gz
qolab-b2a65836ab6f33299bcfb17bbacc325382050209.zip
Basic instrument handles channel config too
-rw-r--r--qolab/hardware/basic.py20
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):