From bfe0860fa9c3b33929d5cb05e1d14d19afc5f968 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Tue, 6 Apr 2021 16:09:18 -0400 Subject: some plotting speed up --- panel.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/panel.py b/panel.py index d1f7232..f96c751 100644 --- a/panel.py +++ b/panel.py @@ -177,6 +177,9 @@ class Experiment: self.cntrlPannel=ttk.LabelFrame(root, text='controls') self.cntrlPannel.pack() + self.bAutoZoom=Button(self.cntrlPannel,text="AutoZoom",command=self.autoZoom,font=('Arial','24')) + self.bAutoZoom.pack(side='left') + self.bRestart=Button(self.cntrlPannel,text="RESTART",command=self.restart,font=('Arial','24')) self.bRestart.pack(side='left') @@ -248,16 +251,22 @@ class Experiment: runTime = (stop-start).seconds + float((stop-start).microseconds)/1000000 # print("onTic DAQ took %s seconds." % (runTime) ) - def updatePlot(self,swp=None): - start = datetime.now() + def autoZoom(self): self.ax.cla() self.line, = self.ax.plot(self.data['tic'], self.data['ch1'], '.') + self.canvas.draw() + + def updatePlot(self,swp=None): + start = datetime.now() + # self.ax.cla() + # self.line, = self.ax.plot(self.data['tic'], self.data['ch1'], '.') # t = Thread(target=self.canvas.draw) - # self.line.set_data([1, 2, 3], [1, 2, 3]) - # self.ax.draw_artist(self.line) + # self.line.set_data([.1, .2, .3], [.1, .2, .3]) + self.line.set_data(self.data['tic'], self.data['ch1']) + self.ax.draw_artist(self.line) # self.canvas.update() - self.canvas.draw() - # self.fig.canvas.flush_events() + # self.canvas.draw() + self.fig.canvas.flush_events() stop = datetime.now() runTime = (stop-start).seconds + float((stop-start).microseconds)/1000000 print("Replot took %s seconds to plot %s points." % (runTime, len(self.data['ch1'])) ) -- cgit v1.2.3