From c0539e98af760276c81f5a4dca43a4a24b3fb68a Mon Sep 17 00:00:00 2001 From: x07maop Date: Tue, 22 Nov 2016 15:01:46 +0100 Subject: [PATCH] Closedown --- script/EnergyScan.py | 14 +++++++------- script/HystScan.py | 14 +++++++++++--- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/script/EnergyScan.py b/script/EnergyScan.py index c5b2084..7bc331c 100644 --- a/script/EnergyScan.py +++ b/script/EnergyScan.py @@ -34,14 +34,14 @@ def update_plot(): i0 = idata.read() x = edata.read() #from operator import truediv - l = lambda x,y: (None if (y==0.0) else x/y) #truediv + l = lambda x,y: (0.0 if (y==0.0) else x/y) #truediv tey=map(l, teyr, i0) tfy=map(l, tfyr, i0) - p[0].getSeries(0).setData(x, tey) - p[1].getSeries(0).setData(x, tfy) - p[2].getSeries(0).setData(x, teyr) - p[3].getSeries(0).setData(x, tfyr) - p[4].getSeries(0).setData(x, i0) + p[0].getSeries(0).setData(x, to_array(tey,'d')) + p[1].getSeries(0).setData(x, to_array(tfy,'d')) + p[2].getSeries(0).setData(x, to_array(teyr,'d')) + p[3].getSeries(0).setData(x, to_array(tfyr,'d')) + p[4].getSeries(0).setData(x, to_array(i0,'d')) @@ -99,7 +99,7 @@ def plot_task(): if count.take() != pos: update_plot() pos = count.take() - time.sleep(0.1) + time.sleep(2.0) ret = fork(plot_task) try: diff --git a/script/HystScan.py b/script/HystScan.py index 939de85..8403476 100644 --- a/script/HystScan.py +++ b/script/HystScan.py @@ -1,5 +1,5 @@ #Parameters - +""" FIELD = "Hx" START_FIELD = -0.1 END_FIELD = 0.1 @@ -8,7 +8,7 @@ RAMP_RATE = 0.2 ENERGY_CHANGE_SLEEP = 0.5 MODE = 'CIRC +' OFFSET = -1.0 - +""" iPS = True @@ -45,11 +45,13 @@ scan.start() -print "SKIPPED Waiting for start field" +print "Waiting for start field" if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION: field.write(START_FIELD) if field_done is None: + ramp_rate.write(2.0) + ramp_rate.waitInPosition(2.0,10000) time.sleep(1.0) caput("X07MA-ES1-IPS:ACTION", 1) time.sleep(3.0) @@ -114,6 +116,12 @@ while(True): scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm]) #if field_done.read() == 1: #If not ramping #ramp_done.get() == 1: if abs(field_readback - END_FIELD) < 0.007: + if iPS==True: + print "Waiting field done..." + while caget("X07MA-ES1-IPS:OUTPUT_RBV", "i") != 0 : + time.sleep(0.1) + print "Done waiting" + print "Field has reached target, breaking execution." break index = index+1