From 69f71b9bfdf10fa20c6507974eae10f02fa84875 Mon Sep 17 00:00:00 2001 From: boccioli_m Date: Fri, 12 Jun 2015 09:21:14 +0200 Subject: [PATCH] Script execution --- script/Motor Test 3.py | 81 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 script/Motor Test 3.py diff --git a/script/Motor Test 3.py b/script/Motor Test 3.py new file mode 100644 index 0000000..a773e27 --- /dev/null +++ b/script/Motor Test 3.py @@ -0,0 +1,81 @@ +#Script imported from: Motor Test 3.xml + +#TODO: Set the diplay names of positioners and detectors +scan = ManualScan(['idX', 'idInkr'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [0.0, 0.0], [3000.0, 10.0], [3000, 20]) +scan.start() + +#Creating channels: dimension 1 +#PseudoPositioner idX +#RegionPositioner idInkr +idInkr = Channel('{DEVICE}:INKR:2', type = 'd') +#ScalarDetector idMotorStatus +idMotorStatus = Channel('{DEVICE}:STA:1', type = 'd') +#ScalarDetector idLogicalPosition +idLogicalPosition = Channel('{DEVICE}:IST:2', type = 'd') +#ScalarDetector idDiameter +idDiameter = Channel('{DEVICE}:DIAM:2', type = 'd') +#ScalarDetector idMotorPosition +idMotorPosition = Channel('{DEVICE}:IST1:2', type = 'd') +#ScalarDetector idPotiRaw +idPotiRaw = Channel('{DEVICE}:POSA:1', type = 'd') +#ScalarDetector idPotiProc +idPotiProc = Channel('{DEVICE}:POSA:2', type = 'd') +#ScalarDetector idBtvsRaw +idBtvsRaw = Channel('{DEVICE}:IST3:1', type = 'd') +#ScalarDetector idBtvsProc +idBtvsProc = Channel('{DEVICE}:IST3:2', type = 'd') + +#Dimension 1 +#PseudoPositioner idX +for setpoint1 in range(0, 3000): + readback1 = setpoint1 + sleep( 0.1 ) # Settling time + #RegionPositioner idInkr + for setpoint2 in frange(0.0, 10.0, 1.0, True) + frange(11.0, 0.0, -1.0, True): + idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout + readback2 = idInkr.get() + if abs(readback2 - setpoint2) > -0.5 : # TODO: Check accuracy + raise Exception('Actor idInkr could not be set to the value ' + str(setpoint2)) + sleep( 5.0 ) # Settling time + #Detector idMotorStatus + detector1 = idMotorStatus.get() + #Detector idLogicalPosition + detector2 = idLogicalPosition.get() + #Detector idDiameter + detector3 = idDiameter.get() + #Detector idMotorPosition + detector4 = idMotorPosition.get() + #Detector idPotiRaw + detector5 = idPotiRaw.get() + #Detector idPotiProc + detector6 = idPotiProc.get() + #Detector idBtvsRaw + detector7 = idBtvsRaw.get() + #Detector idBtvsProc + detector8 = idBtvsProc.get() + #Manipulation idDiff02 + #Variable Mappings + a = detector4 + b = detector8 + count = setpoint1 + idDiff02 = a-b + #Manipulation idDiff01 + #Variable Mappings + a = detector4 + b = detector6 + count = setpoint1 + idDiff01 = a-b + scan.append ([setpoint1, setpoint2], [readback1, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) + +#Closing channels +idInkr.close() +idMotorStatus.close() +idLogicalPosition.close() +idDiameter.close() +idMotorPosition.close() +idPotiRaw.close() +idPotiProc.close() +idBtvsRaw.close() +idBtvsProc.close() + +scan.end()