diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-06-24 23:20:58 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-06-24 23:20:58 -0400 |
commit | 07190b7d0172968519a3d432cf1b4b7b118fee08 (patch) | |
tree | a4e00e6969051140dea1411631afd83ab9add87f /eitControl.py | |
parent | c23dd0ad6586e67e5bf10d5694d4456a01cb9b3c (diff) | |
download | pyExpControl-07190b7d0172968519a3d432cf1b4b7b118fee08.tar.gz pyExpControl-07190b7d0172968519a3d432cf1b4b7b118fee08.zip |
added default config and ability to save it
Diffstat (limited to 'eitControl.py')
-rw-r--r-- | eitControl.py | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/eitControl.py b/eitControl.py index 8b69d2f..19d5e19 100644 --- a/eitControl.py +++ b/eitControl.py @@ -18,11 +18,51 @@ import csv import ue9qol from funcGenerator import Sweeper, SinGen, TriangleGen, RampGen, PulseGen import rfGen + +from configparser import ConfigParser, ExtendedInterpolation +config = ConfigParser(interpolation=ExtendedInterpolation(), + converters = {'list': lambda x: [i.strip() for i in x.strip().split('\n')]}) +default_config = """ +[RF] +central_frequency = 6.83468e9 +frequency_span = 100e3 +initial_frequency = 6.834e9 +frequency_export_name = rfFreq + +[DAQ] +# channels to grab and their meaning +ain0 = transmission +ain1 = lockin +ain2 = DAVLL +# commented out channels will not be processed or storred +# ain3 = ain3_undefined +# dac0 = dac0_undefined +# dac1 = dac1_undefined2 + +[Plot] +x_axis_data = rfFreq + +[Plot channels visibility] +transmission = yes +lockin = yes +DAVLL = yes + +[Save] +save_prefix = eit +data_dir = z:\data.VAMPIRE + +""" + +config.read_string(default_config) +# additional config +config.read("config.ini") + class Experiment: - def __init__(self, root, args): + def __init__(self, root, config, args): self.root = root + self.config = config if args.save_prefix: self.save_prefix = args.save_prefix else: @@ -127,11 +167,15 @@ class Experiment: bExit = QtGui.QPushButton('&Exit') bExit.clicked.connect(exit) self.buttons["Exit"] = bExit + bSaveConfig = QtGui.QPushButton('Save Con&fig') + bSaveConfig.clicked.connect(self.saveConfigCmd) + self.buttons["SaveConfig"] = bSaveConfig w1.addWidget(bAutoZoom, row=0, col=0) w1.addWidget(bRestart, row=0, col=1) w1.addWidget(bStartStopToggle, row=0, col=2) w1.addWidget(bSave, row=0, col=3) - w1.addWidget(bExit, row=0, col=4) + w1.addWidget(bSaveConfig, row=0, col=4) + w1.addWidget(bExit, row=0, col=5) d1.addWidget(w1) ## status line @@ -236,6 +280,10 @@ class Experiment: # beware this is bad workaround!!! plot data is misplaced ex.export(png_file) + def saveConfigCmd(self): + with open('config.ini', 'w') as configfile: + self.config.write(configfile) + def onTic(self,swp=None): start = datetime.now() if swp is None: @@ -359,7 +407,7 @@ if __name__ == '__main__': args.save_prefix="eit" args.data_dir="z:\data.VAMPIRE" - experiment=Experiment(l, args) + experiment=Experiment(l, config, args) app.exec() |