diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-04-08 23:44:11 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-04-08 23:44:11 -0400 |
commit | 9c09d346a0120241e1a99537b0b58768f95d1843 (patch) | |
tree | 5fc17fbdba81843e9c583d0d16f6f526b91ab142 | |
parent | 783bb3fd149488282a57d850d8e1ac33d8bd49ff (diff) | |
download | pyExpControl-9c09d346a0120241e1a99537b0b58768f95d1843.tar.gz pyExpControl-9c09d346a0120241e1a99537b0b58768f95d1843.zip |
added save capabilities
-rw-r--r-- | panel.py | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -12,6 +12,8 @@ import matplotlib.pyplot as plt from matplotlib.figure import Figure from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2Tk) +import csv + import ue9qol class SinGen: @@ -210,6 +212,9 @@ class Experiment: self.bStop=Button(self.cntrlPannel,text="STOP",command=self.stop,font=('Arial','24')) self.bStop.pack(side='left') + self.bSave=Button(self.cntrlPannel,text="SAVE",command=self.saveCmd,font=('Arial','24')) + self.bSave.pack(side='left') + self.bExit=Button(self.cntrlPannel,text="EXIT",command=exit,font=('Arial','24')) self.bExit.pack(side='left') @@ -258,6 +263,17 @@ class Experiment: self.clearData() self.sweeper.cmdRestart() + def saveCmd(self): + csv_file = 'data.csv' + data = self.data + try: + with open(csv_file, 'w') as csvfile: + writer = csv.writer(csvfile) + writer.writerow(data.keys()) + writer.writerows(zip(*data.values())) + except IOError: + print('I/O error') + def onTic(self,swp=None): start = datetime.now() if swp is None: |