diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-06-25 10:47:31 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-06-25 10:47:31 -0400 |
commit | 47eaa89f1deb366f3d3202eea8c99197ac109406 (patch) | |
tree | 6976e56968946bc1dc25680001973d04010281dc /eitControl.py | |
parent | 8aa493ca2659fcea172360f07f1c6403715f74f2 (diff) | |
download | qolab-47eaa89f1deb366f3d3202eea8c99197ac109406.tar.gz qolab-47eaa89f1deb366f3d3202eea8c99197ac109406.zip |
added config parser
Diffstat (limited to 'eitControl.py')
-rw-r--r-- | eitControl.py | 66 |
1 files changed, 42 insertions, 24 deletions
diff --git a/eitControl.py b/eitControl.py index c35780f..4deaea2 100644 --- a/eitControl.py +++ b/eitControl.py @@ -6,6 +6,7 @@ import pyqtgraph.exporters import platform import os import argparse +import ast from threading import Thread @@ -33,7 +34,7 @@ frequency_export_name = rfFreq # channels to grab and their meaning ain0 = transmission ain1 = lockin -ain2 = DAVLL +ain2 = davll ain3 = ain3_undefined # commented out channels will not be processed or stored # dac0 = dac0_undefined @@ -42,10 +43,21 @@ ain3 = ain3_undefined [Plot] x_axis_data = rfFreq -[Plot channels visibility] +[Plot_channels_visibility] transmission = yes lockin = yes -DAVLL = yes +davll = yes + +[Plot_channels_colors] +# color specification will be evaluated and should match PyQtGraph.mkColor(args) +# for example +# (R,G,B,Alpha) tuple: example_trace = (255,0,255,100) +# or color name: example_trace = 'g' +transmission = (20,20,20,100) +lockin = (85,170,255,100) +davll = (255,0,255,100) +ain3_undefined = (0,85,255,100) + [Save] save_prefix = eit @@ -75,14 +87,7 @@ class Experiment: self.save_cnt = 0 self.tic = 0 self.newDataIsReady = False - self.channelsNames2grab={'tic', 'x','rfFreq','dac0', 'dac1', 'ain0', 'ain1', 'ain2', 'ain3'} alpha=100 - self.channelsColor = { 'ain0': (20,20,20,alpha), 'ain1': (85,170,255,alpha), 'ain2': (255,0,255,alpha), 'ain3': (0,85,255,alpha), 'dac0': 'r', 'dac1': 'g'} - #self.channelsNames2plot={'dac0', 'dac1', 'ain0', 'ain1', 'ain2', 'ain3'} - if args.test: - self.channelsNames2plot={'ain0', 'ain1', 'ain2', 'ain3'} - else: - self.channelsNames2plot={'ain0', 'ain1', 'ain2'} self.xChannelName='rfFreq' # can be also 'tic' or any of above self.xlabel='' self.channelGraph={} @@ -209,8 +214,17 @@ class Experiment: def clearData(self): self.data = {} - for ch in self.channelsNames2grab: - self.data[ch] = [] + # RF generator channels + rf_freq_Name = self.config['RF'].get('frequency_export_name') + self.data[rf_freq_Name] = [] + # DAQ channels + for ch in self.config['DAQ']: + ch_meaning = self.config['DAQ'][ch] + self.data[ch_meaning] = [] + # special channels + self.data['tic'] = [] + self.data['x'] = [] + def stop(self): self.sweeper.cmdStop() @@ -310,25 +324,26 @@ class Experiment: # dac0 # dac0 = self.funcGen.getValue(swp) - dac0 = 0 - dac0 = self.funcGen.getValue(swp) - daq0.setOutputCh(0, dac0) - self.data['dac0'].append(dac0) + # dac0 = 0 + # dac0 = self.funcGen.getValue(swp) + # daq0.setOutputCh(0, dac0) + # self.data['dac0'].append(dac0) # dac1 # dac1 = PulseGen(ampl=5, sweeper=swp).getValue() - dac1 = 0 - daq0.setOutputCh(1, dac1) - self.data['dac1'].append(dac1) + # dac1 = 0 + # daq0.setOutputCh(1, dac1) + # self.data['dac1'].append(dac1) for ch in self.config['DAQ']: if ch[0:3] == 'ain': n=int(ch[3:]) vIn = daq0.getInputCh(n) - self.data[ch].append( vIn ) + ch_meaning = self.config['DAQ'][ch] + self.data[ch_meaning].append( vIn ) # X-axis (i.e. independent variable) - x=self.data[self.xChannelName] + x=self.data[self.config['Plot']['x_axis_data']] x=np.array(x) fCent = self.rfGenFunc.getCenter() x=(x-fCent) @@ -352,13 +367,16 @@ class Experiment: start = datetime.now() x = self.data['x'] - for name in self.channelsNames2plot: + for name in self.config['Plot_channels_visibility']: + if not self.config['Plot_channels_visibility'].getboolean(name): + continue if name not in self.data: continue y = self.data[name] if name not in self.channelGraph: - if name in self.channelsColor: - color = self.channelsColor[name] + if name in self.config['Plot_channels_colors']: + color_str = self.config['Plot_channels_colors'][name] + color = ast.literal_eval(color_str) else: color = (255,0,0) self.channelGraph[name]=self.dataPlot.plot(x,y, pen=None, symbol='o', symbolPen=None, symbolBrush=color, symbolSize=5, name=name) |