aboutsummaryrefslogtreecommitdiff
path: root/panel.py
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-04-08 23:44:11 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-04-08 23:44:11 -0400
commit9c09d346a0120241e1a99537b0b58768f95d1843 (patch)
tree5fc17fbdba81843e9c583d0d16f6f526b91ab142 /panel.py
parent783bb3fd149488282a57d850d8e1ac33d8bd49ff (diff)
downloadpyExpControl-9c09d346a0120241e1a99537b0b58768f95d1843.tar.gz
pyExpControl-9c09d346a0120241e1a99537b0b58768f95d1843.zip
added save capabilities
Diffstat (limited to 'panel.py')
-rw-r--r--panel.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/panel.py b/panel.py
index d660af4..23c611e 100644
--- a/panel.py
+++ b/panel.py
@@ -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: