aboutsummaryrefslogtreecommitdiff
path: root/panel.py
diff options
context:
space:
mode:
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: