diff --git a/script/EnergyScan.py b/script/EnergyScan.py index 98f7e8f..ab298f2 100644 --- a/script/EnergyScan.py +++ b/script/EnergyScan.py @@ -51,17 +51,15 @@ print E1,E2,TIME,DELAY,OFFSET1,OFFSET2,RUNTYPE#,ALPHA1,ALPHA2 # Plotting ############################################################################### +task = None running = False -quit_plot = False def _startPlot(type): - global running, quit_plot + global running print "Starting plot: type " + str(type) - quit_plot = False running = True - p = plot(None,name="")[0] - p.addSeries(LinePlotSeries("Energy")) - s= p.getSeries(1) + p = plot(None,name="Energy")[0] + s = p.getSeries(0) cur = 0 time.sleep(3.0) while running: @@ -71,24 +69,24 @@ def _startPlot(type): e = energy.read() if (abs(e-cur)) > 0.1: v = abs((keithley_2a.read() / ((keithley_1a if (type==1) else keithley_3a).read() ))) - p.getSeries(1).appendData(e,v) + s.appendData(e,v) cur = e time.sleep(0.2) except: pass - quit_plot = True print "Done Plotting" def startPlot(type = 1): - ret = fork((_startPlot,(type,)),) + global task + task = fork((_startPlot,(type,)),) def stopPlot(): - global running, quit_plot + global task, running running = False - while quit_plot==False: - time.sleep(0.001) + ret = join(task) + ############################PGM+ID1+ID2###################################################