diff --git a/script/tests/tests/Collimator Tests pro/Calibrate/.config b/script/tests/tests/Collimator Tests pro/Calibrate/.config
new file mode 100644
index 0000000..5e59d3d
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Calibrate/.config
@@ -0,0 +1,12 @@
+name=Calibrate
+description=Calibrates the device
+filename=Calibrate.xml
+help = \
+This test sends a command to the low level firmware which controls the collimators \n\
+requesting that it calibrates itself. \n\n\
+Calibration involves moving to the R1 and R2 reference positions and measuring the \n\
+number of steps required to do so. At the end of the sequence the default collimator \n\
+will be selected. \n\n\
+During the course of the expected calibration period (45-70 seconds) the test \n\
+procedure will plot the values of all critical system variables. \n\n\
+For further information please consult Valery Ovinnikov.
\
diff --git a/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.py b/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.py
new file mode 100644
index 0000000..b3b25c7
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.py
@@ -0,0 +1,79 @@
+#Script imported from: Calibrate.xml
+
+ret = 'Calibration failed'
+status = False
+
+try:
+ #Pre-actions: 1 = calibrate
+ caput(DEVICE+':COM:2', 1)
+ #Creating channels: dimension 1
+ #PseudoPositioner id000000
+ #ScalarDetector id000001
+ id000001 = Channel(DEVICE+':STA:1', type = 'd')
+ #ScalarDetector id000003
+ id000003 = Channel(DEVICE+':IST:2', type = 'd')
+ #ScalarDetector id000004
+ id000004 = Channel(DEVICE+':DIAM:2', type = 'd')
+ #ScalarDetector id000005
+ id000005 = Channel(DEVICE+':IST1:1', type = 'd')
+ #ScalarDetector id000006
+ id000006 = Channel(DEVICE+':IST1:2', type = 'd')
+ #ScalarDetector id000007
+ id000007 = Channel(DEVICE+':IST2:1', type = 'd')
+ #ScalarDetector id000008
+ id000008 = Channel(DEVICE+':IST2:2', type = 'd')
+ #ScalarDetector id000009
+ id000009 = Channel(DEVICE+':IST3:1', type = 'd')
+ #ScalarDetector id000010
+ id000010 = Channel(DEVICE+':IST3:2', type = 'd')
+except:
+ print "Unexpected error:", sys.exc_info()[0]
+ ret = 'Unable to create channel - ' + traceback.format_exc()
+ success = False
+ raise Exception('Unable to create channel - ' + traceback.format_exc())
+ sys.exit()
+
+#TODO: Set the diplay names of positioners and detectors
+scan = ManualScan(['id000000'], ['id000001', 'id000003', 'id000004', 'id000005', 'id000006', 'id000007', 'id000008', 'id000009', 'id000010'] , [0.0], [900.0], [900])
+scan.start()
+
+#Dimension 1
+#PseudoPositioner id000000
+for setpoint1 in range(0, 900):
+ readback1 = setpoint1
+ sleep( 0.1 ) # Settling time
+ #Detector id000001
+ detector1 = id000001.get()
+ #Detector id000003
+ detector2 = id000003.get()
+ #Detector id000004
+ detector3 = id000004.get()
+ #Detector id000005
+ detector4 = id000005.get()
+ #Detector id000006
+ detector5 = id000006.get()
+ #Detector id000007
+ detector6 = id000007.get()
+ #Detector id000008
+ detector7 = id000008.get()
+ #Detector id000009
+ detector8 = id000009.get()
+ #Detector id000010
+ detector9 = id000010.get()
+ scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9])
+
+#Closing channels
+id000001.close()
+id000003.close()
+id000004.close()
+id000005.close()
+id000006.close()
+id000007.close()
+id000008.close()
+id000009.close()
+id000010.close()
+
+scan.end()
+
+ret = 'Calibration done'
+status = True
diff --git a/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.xml b/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.xml
new file mode 100644
index 0000000..7e5028f
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+ 900
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/script/tests/tests/Collimator Tests pro/Drive Out/.config b/script/tests/tests/Collimator Tests pro/Drive Out/.config
new file mode 100644
index 0000000..3589d0d
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Drive Out/.config
@@ -0,0 +1,3 @@
+name=Drive Out
+description=Drives the Collimator to the Out Position
+filename=Drive Out.xml
\ No newline at end of file
diff --git a/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.py b/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.py
new file mode 100644
index 0000000..f197379
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.py
@@ -0,0 +1,82 @@
+#Script imported from: Drive Out.xml
+import traceback
+
+#by default, failed
+ret = 'Test failed'
+status = False
+
+try:
+ #Pre-actions: 2 = drive out
+ caput(DEVICE+':COM:2', 2)
+ #Creating channels: dimension 1
+ #PseudoPositioner id000000
+ #ScalarDetector id000001
+ id000001 = Channel(DEVICE+':STA:1', type = 'd')
+ #ScalarDetector id000003
+ id000003 = Channel(DEVICE+':IST:2', type = 'd')
+ #ScalarDetector id000004
+ id000004 = Channel(DEVICE+':DIAM:2', type = 'd')
+ #ScalarDetector id000005
+ id000005 = Channel(DEVICE+':IST1:1', type = 'd')
+ #ScalarDetector id000006
+ id000006 = Channel(DEVICE+':IST1:2', type = 'd')
+ #ScalarDetector id000007
+ id000007 = Channel(DEVICE+':IST2:1', type = 'd')
+ #ScalarDetector id000008
+ id000008 = Channel(DEVICE+':IST2:2', type = 'd')
+ #ScalarDetector id000009
+ id000009 = Channel(DEVICE+':IST3:1', type = 'd')
+ #ScalarDetector id000010
+ id000010 = Channel(DEVICE+':IST3:2', type = 'd')
+except:
+ print "Unexpected error:", sys.exc_info()[0]
+ ret = 'Unable to create channel - ' + traceback.format_exc()
+ success = False
+ raise Exception('Unable to create channel - ' + traceback.format_exc())
+ sys.exit()
+
+#TODO: Set the diplay names of positioners and detectors
+scan = ManualScan(['id000000'], ['id000001', 'id000003', 'id000004', 'id000005', 'id000006', 'id000007', 'id000008', 'id000009', 'id000010'] , [0.0], [3000.0], [3000])
+scan.start()
+
+#Dimension 1
+#PseudoPositioner id000000
+for setpoint1 in range(0, 3000):
+ readback1 = setpoint1
+ sleep( 0.1 ) # Settling time
+ #Detector id000001
+ detector1 = id000001.get()
+ #Detector id000003
+ detector2 = id000003.get()
+ #Detector id000004
+ detector3 = id000004.get()
+ #Detector id000005
+ detector4 = id000005.get()
+ #Detector id000006
+ detector5 = id000006.get()
+ #Detector id000007
+ detector6 = id000007.get()
+ #Detector id000008
+ detector7 = id000008.get()
+ #Detector id000009
+ detector8 = id000009.get()
+ #Detector id000010
+ detector9 = id000010.get()
+ scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9])
+
+#Closing channels
+id000001.close()
+id000003.close()
+id000004.close()
+id000005.close()
+id000006.close()
+id000007.close()
+id000008.close()
+id000009.close()
+id000010.close()
+
+scan.end()
+
+#return ok
+ret = 'Slides moved out'
+status = True
\ No newline at end of file
diff --git a/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.xml b/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.xml
new file mode 100644
index 0000000..5a1c925
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+ 3000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/script/tests/tests/Collimator Tests pro/Monitor movement/.config b/script/tests/tests/Collimator Tests pro/Monitor movement/.config
new file mode 100644
index 0000000..4d50992
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Monitor movement/.config
@@ -0,0 +1,7 @@
+name=Monitor Movement
+description=Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times
+
+
+#optional parameters. Description is compulsory. Syntax:
+#parameters=::[;::]
+parameters=repeatTimes:1:Repeat N times;midPoint:41.0:Middle point A;spanFromMidPoint:2.0:B steps around middle point A
diff --git a/script/tests/tests/Collimator Tests pro/Monitor movement/Monitor Movement.py b/script/tests/tests/Collimator Tests pro/Monitor movement/Monitor Movement.py
new file mode 100644
index 0000000..9a4f2d3
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Monitor movement/Monitor Movement.py
@@ -0,0 +1,91 @@
+
+###### DO NOT MODIFY THE CODE BELOW ######
+def startTest(testName, DEVICE, params):
+ #get the path of this script
+ testPath = inspect.getfile(inspect.currentframe())
+ #by default, failed
+ ret = 'Test failed'
+ status = False
+ #plot name to be given to the scan. Use: scan.setPlotName(plotName)
+ plotName = DEVICE + ' - ' + testName
+###### WRITE YOUR CODE HERE BELOW #######
+ #get parameters from the calling interface
+ print_log(testName, DEVICE, 'testpath: ' + testPath )
+ print_log(testName, DEVICE, 'parameters:' + str( params) )
+ print_log(testName, DEVICE, 'device: ' + DEVICE )
+ scan = ManualScan(['time'], ['idMotorStep', 'idPotiPosition', 'idPotiRef1Position','idMotorStep-idPotiPosition'] , [0.0], [30.0], [20])
+ scan.setPlotName(plotName)
+ scan.start()
+
+ #Creating channels: dimension 1
+ try:
+ idCom = Channel(DEVICE+':COM:2', type = 'd') #current position as from motor step counter [mm]
+ idMotorStep = Channel(DEVICE+':IST3:2', type = 'd') #current position as from motor step counter [mm]
+ idPotiPosFromBeam = Channel(DEVICE+':IST1:2', type = 'd') #current position from beam as from potentiometer [mm]
+ idPotiPosition = Channel(DEVICE+':IST2:1', type = 'd') #current position as from potentiometer [mm]
+ idPotiRef1Position = Channel(DEVICE+':REF1:1', type = 'd') #R1 position as from potentiometer [mm]
+ idPotiRef2Position = Channel(DEVICE+':REF2:1', type = 'd') #R2 position as from potentiometer [mm]
+
+ except:
+ sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
+ #raise Exception('Unable to create channel - ' + traceback.format_exc())
+ return
+
+ monitorTime=40 #seconds
+ print_log(testName, DEVICE, 'Monitoring movement for ' + str(monitorTime) + 's')
+ #scan quickly the output during some seconds
+ detector4 = idPotiPosition.get()
+ detector6 = idPotiRef2Position.get()
+ timeElapsed=0
+ while timeElapsed<(monitorTime*10):
+ #Detector time
+ detector1 = float(java.lang.System.currentTimeMillis())
+
+ detector2 = idMotorStep.get()
+ detector3 = idPotiPosFromBeam.get()
+ detector4 = idPotiPosition.get()
+ detector5 = idPotiRef1Position.get()
+ detector6 = idPotiRef2Position.get()
+ diff1 = detector2-detector4
+ scan.append ([detector1], [detector1], [detector2, detector4, detector5, diff1])
+ sleep( 0.1 ) # Settling time
+ timeElapsed=timeElapsed+1
+
+ #Closing channels
+ idCom.close()
+ idMotorStep.close()
+ idPotiPosFromBeam.close()
+ idPotiPosition.close()
+ idPotiRef1Position.close()
+ idPotiRef2Position.close()
+ print_log(testName, DEVICE, 'End of Monitoring')
+ ret = 'End of Monitoring'
+ status = True
+########## END OF YOUR CODE ###########
+
+###### DO NOT MODIFY THE CODE BELOW ######
+ sendFeedback(testPath, testName, DEVICE, ret, status)
+
+#prepare and send feedback to calling tool
+def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
+ print_log(testName, DEVICE, 'End of test. Result:')
+ print_log(testName, DEVICE, 'Test path: ' + testPath)
+ print_log(testName, DEVICE, 'Test name: ' + testName )
+ print_log(testName, DEVICE, 'Device: ' + DEVICE)
+ print_log(testName, DEVICE, 'Test passed: ' + str(testPassed))
+ print_log(testName, DEVICE, 'Return string: ' + returnString)
+ ret = [testPath, DEVICE, returnString, testPassed]
+ set_return(ret)
+
+def print_log(testName, DEVICE, text):
+ time.ctime()
+ now = time.strftime('%Y.%m.%d %H:%M:%S')
+ print now + ' ' + DEVICE + ' - ' + testName + ': ' + text
+
+import sys, inspect, os, traceback
+#get test arguments
+DEVICE = device
+testName = test
+params = parameters
+#launch the test
+startTest(testName, DEVICE, params)
diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 2/.config b/script/tests/tests/Collimator Tests pro/Motor Test 2/.config
new file mode 100644
index 0000000..f71f808
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Motor Test 2/.config
@@ -0,0 +1,7 @@
+name=Motor Test 2 pro
+description=Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times
+
+
+#optional parameters. Description is compulsory. Syntax:
+#parameters=::[;::]
+parameters=repeatTimes:1:Repeat N times;midPoint:41.0:Middle point A;spanFromMidPoint:2.0:B steps around middle point A
diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 2/Motor Test 2.py b/script/tests/tests/Collimator Tests pro/Motor Test 2/Motor Test 2.py
new file mode 100644
index 0000000..19fb145
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Motor Test 2/Motor Test 2.py
@@ -0,0 +1,160 @@
+#Script Motor Test 2 for production system
+#Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times
+import sys, inspect, os, traceback, time
+
+###### DO NOT MODIFY THE CODE BELOW ######
+def startTest(testName, DEVICE, params):
+ #get the path of this script
+ testPath = inspect.getfile(inspect.currentframe())
+ #by default, failed
+ ret = 'Test failed'
+ status = False
+ #plot name to be given to the scan. Use: scan.setPlotName(plotName)
+ plotName = DEVICE + ' - ' + testName
+###### WRITE YOUR CODE HERE BELOW #######
+
+ #get parameters from the calling interface
+ try:
+ print_log(testName, DEVICE, "Running test Motor Test 2 for device " + DEVICE + " with the following parameters:\n" + str(params))
+ middle = float(params["midPoint"]["value"])
+ loopTimes = int(params["repeatTimes"]["value"])
+ span = float(params["spanFromMidPoint"]["value"])
+ except:
+ ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
+ success = False
+ sendFeedback(testPath, testName, DEVICE, ret, status)
+ return
+
+ #scan = ManualScan(['idX', 'idInkr'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idPotiPosFromBeam', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idMotorStep', 'idDiff01', 'idDiff02'] , [-0.5, 0.0], [4.0, 3000.0], [3000, 20])
+ #scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idPotiPosFromBeam', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idMotorStep', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20])
+ scan = ManualScan(['idX'], ['idInkr', 'idInkrRb', 'idMotorStep', 'idPotiPosFromBeam', 'idPotiPosition', 'idPotiRef1Position', 'idPotiRef2Position', 'idDiameter', 'idPotiPosition-idInkrRb', 'idPortPosition-idMotorStep'] , [ 0.0], [ 3000.0], [20])
+ scan.setPlotName(plotName)
+ scan.start()
+
+ #Creating channels: dimension 1
+ try:
+ idInkr = Channel(DEVICE+':INKR:2', type = 'd') #move relative distance (positive means towards R2) [mm]
+ idInkrRb = Channel(DEVICE+':INKRRB:2', type = 'd') #readback of move relative distance (positive means towards R2) [mm]
+ idMotorStep = Channel(DEVICE+':IST3:2', type = 'd') #current position as from motor step counter [mm]
+ idPotiPosFromBeam = Channel(DEVICE+':IST1:2', type = 'd') #current position from beam as from potentiometer [mm]
+ idPotiPosition = Channel(DEVICE+':IST2:1', type = 'd') #current position as from potentiometer [mm]
+ idPotiRef1Position = Channel(DEVICE+':REF1:1', type = 'd') #R1 position as from potentiometer [mm]
+ idPotiRef2Position = Channel(DEVICE+':REF2:1', type = 'd') #R2 position as from potentiometer [mm]
+ idDiameter = Channel(DEVICE+':DIAM:2', type = 'd') #collimator diameter [mm]
+ except:
+ ret = 'Unable to create channel - ' + traceback.format_exc()
+ success = False
+ sendFeedback(testPath, testName, DEVICE, ret, status)
+ return
+
+ direction = 1.0
+ startDefault = middle - span
+ endDefault = middle + span
+ end = endDefault+1
+ #find position: it will be the middle point of the test
+ print_log(testName, DEVICE, 'Moving to middle point ' + str(middle) )
+ idInkr.put(middle, timeout=None) # TODO: Set appropriate timeout
+ readback2 = idInkr.get()
+ if abs(readback2 - middle) > 5 : # TODO: Check accuracy
+ ret = 'Actor idInkr could not be set to the value ' + str(middle) + ' (current value: ' + str(readback2) + ')'
+ success = False
+ sendFeedback(testPath, testName, DEVICE, ret, status)
+ return
+ start = readback2+direction
+ countSteps = 0
+ count = 0
+ print_log(testName, DEVICE, 'Moving around middle point (+-' + str(span) + ')' )
+ for setpoint1 in range(0, loopTimes*2):
+ count = count + 1
+ sleep( 5 ) # Settling time
+ #RegionPositioner idInkr
+ for setpoint2 in frange(start, end, direction):
+ readback1 = setpoint1
+ idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
+ sleep( 0.2 ) # Settling time
+ readback2 = idInkr.get()
+ if abs(readback2 - setpoint2) > 1 : # TODO: Check accuracy
+ ret = 'Actor idInkr could not be set to the value ' + str(setpoint2) + ' (current value: ' + str(readback2) + ')'
+ success = False
+ sendFeedback(testPath, testName, DEVICE, ret, status)
+ return
+ #Detector idMotorStatus
+ detector1 = idInkrRb.get()
+ #Detector idLogicalPosition
+ detector2 = idMotorStep.get()
+ #Detector idDiameter
+ detector3 = idPotiPosFromBeam.get()
+ #Detector idPotiPosFromBeam
+ detector4 = idPotiPosition.get()
+ #Detector idPotiRaw
+ detector5 = idPotiRef1Position.get()
+ #Detector idPotiProc
+ detector6 = idPotiRef2Position.get()
+ #Detector idBtvsRaw
+ detector7 = idDiameter.get()
+ #Manipulation idDiff02
+ #Variable Mappings
+ idDiff02 = detector4-detector2
+ #Manipulation idDiff01
+ #Variable Mappings
+ idDiff01 = detector4-detector1
+ countSteps = countSteps + 1
+ scan.append ([countSteps], [countSteps], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01])
+ if (direction > 0.0 and setpoint2 >= end -1):
+ #invert direction and swap start with end of translation
+ end = startDefault-1
+ start = setpoint2 - direction
+ direction = -1.0
+ print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction) )
+ break
+ if ( direction < 0.0 and setpoint2 <= end +1):
+ #invert direction and swap start with end of translation
+ end = endDefault+1
+ start = setpoint2 - direction
+ direction = 1.0
+ print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction) )
+ break
+
+
+ #Closing channels
+ idInkr.close()
+ idInkrRb.close()
+ idMotorStep.close()
+ idPotiPosFromBeam.close()
+ idPotiPosition.close()
+ idPotiRef1Position.close()
+ idPotiRef2Position.close()
+ idDiameter.close()
+
+ scan.end()
+ ret = 'Slide moved back and forth (' + str(count) + ' runs)'
+ status = True
+
+########## END OF YOUR CODE ###########
+
+###### DO NOT MODIFY THE CODE BELOW ######
+ sendFeedback(testPath, testName, DEVICE, ret, status)
+
+#prepare and send feedback to calling tool
+def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
+ print_log(testName, DEVICE, 'End of test. Result:')
+ print_log(testName, DEVICE, 'Test path: ' + testPath)
+ print_log(testName, DEVICE, 'Test name: ' + testName)
+ print_log(testName, DEVICE, 'Device: ' + DEVICE)
+ print_log(testName, DEVICE, 'Test passed: ' + str(testPassed))
+ print_log(testName, DEVICE, 'Return string: ' + returnString)
+ ret = [testPath, DEVICE, returnString, testPassed]
+ set_return(ret)
+
+def print_log(testName, DEVICE, text):
+ time.ctime()
+ now = time.strftime('%Y.%m.%d %H:%M:%S')
+ print now + ' ' + DEVICE + ' - ' + testName + ': ' + text
+
+
+#get test arguments
+DEVICE = device
+testName = test
+params = parameters
+#launch the test
+startTest(testName, DEVICE, params)
diff --git a/script/tests/tests/Collimator Tests pro/Move Ref 1/.config b/script/tests/tests/Collimator Tests pro/Move Ref 1/.config
new file mode 100644
index 0000000..895fbd5
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Move Ref 1/.config
@@ -0,0 +1,3 @@
+name=Move Ref 1
+description=Moves to the Reference 1 Position
+filename=Move Ref 1.xml
\ No newline at end of file
diff --git a/script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1.py b/script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1.py
new file mode 100644
index 0000000..5042996
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1.py
@@ -0,0 +1,90 @@
+
+###### DO NOT MODIFY THE CODE BELOW ######
+def startTest(testName, DEVICE, params):
+ #get the path of this script
+ testPath = inspect.getfile(inspect.currentframe())
+ #by default, failed
+ ret = 'Test failed'
+ status = False
+ #plot name to be given to the scan. Use: scan.setPlotName(plotName)
+ plotName = DEVICE + ' - ' + testName
+###### WRITE YOUR CODE HERE BELOW #######
+ #get parameters from the calling interface
+ print_log(testName, DEVICE, 'testpath: ' + testPath )
+ print_log(testName, DEVICE, 'parameters:' + str( params) )
+ print_log(testName, DEVICE, 'device: ' + DEVICE )
+ scan = ManualScan(['time'], ['idMotorStep', 'idPotiPosition', 'idPotiRef1Position','idMotorStep-idPotiPosition'] , [0.0], [30.0], [20])
+ scan.setPlotName(plotName)
+ scan.start()
+
+ #Creating channels: dimension 1
+ try:
+ idCom = Channel(DEVICE+':COM:2', type = 'd') #current position as from motor step counter [mm]
+ idMotorStep = Channel(DEVICE+':IST3:2', type = 'd') #current position as from motor step counter [mm]
+ idPotiPosFromBeam = Channel(DEVICE+':IST1:2', type = 'd') #current position from beam as from potentiometer [mm]
+ idPotiPosition = Channel(DEVICE+':IST2:1', type = 'd') #current position as from potentiometer [mm]
+ idPotiRef1Position = Channel(DEVICE+':REF1:1', type = 'd') #R1 position as from potentiometer [mm]
+ idPotiRef2Position = Channel(DEVICE+':REF2:1', type = 'd') #R2 position as from potentiometer [mm]
+
+ except:
+ sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
+ #raise Exception('Unable to create channel - ' + traceback.format_exc())
+ return
+
+ idCom.put('3', timeout=None) # go to R1
+ print_log(testName, DEVICE, 'Moving to reference point')
+ #scan quickly the output during some seconds
+ detector4 = idPotiPosition.get()
+ detector6 = idPotiRef2Position.get()
+ timeElapsed=0
+ while detector4>detector6 and timeElapsed<600:
+ #Detector time
+ detector1 = float(java.lang.System.currentTimeMillis())
+
+ detector2 = idMotorStep.get()
+ detector3 = idPotiPosFromBeam.get()
+ detector4 = idPotiPosition.get()
+ detector5 = idPotiRef1Position.get()
+ detector6 = idPotiRef2Position.get()
+ diff1 = detector2-detector4
+ scan.append ([detector1], [detector1], [detector2, detector4, detector5, diff1])
+ sleep( 0.1 ) # Settling time
+ timeElapsed=timeElapsed+1
+
+ #Closing channels
+ idCom.close()
+ idMotorStep.close()
+ idPotiPosFromBeam.close()
+ idPotiPosition.close()
+ idPotiRef1Position.close()
+ idPotiRef2Position.close()
+ print_log(testName, DEVICE, ' Reference point reached')
+
+########## END OF YOUR CODE ###########
+
+###### DO NOT MODIFY THE CODE BELOW ######
+ sendFeedback(testPath, testName, DEVICE, ret, status)
+
+#prepare and send feedback to calling tool
+def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
+ print_log(testName, DEVICE, 'End of test. Result:')
+ print_log(testName, DEVICE, 'Test path: ' + testPath)
+ print_log(testName, DEVICE, 'Test name: ' + testName )
+ print_log(testName, DEVICE, 'Device: ' + DEVICE)
+ print_log(testName, DEVICE, 'Test passed: ' + str(testPassed))
+ print_log(testName, DEVICE, 'Return string: ' + returnString)
+ ret = [testPath, DEVICE, returnString, testPassed]
+ set_return(ret)
+
+def print_log(testName, DEVICE, text):
+ time.ctime()
+ now = time.strftime('%Y.%m.%d %H:%M:%S')
+ print now + ' ' + DEVICE + ' - ' + testName + ': ' + text
+
+import sys, inspect, os, traceback
+#get test arguments
+DEVICE = device
+testName = test
+params = parameters
+#launch the test
+startTest(testName, DEVICE, params)
diff --git a/script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1.xml b/script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1.xml
new file mode 100644
index 0000000..5b81083
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+ 3000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/script/tests/tests/Collimator Tests pro/Move Ref 2/.config b/script/tests/tests/Collimator Tests pro/Move Ref 2/.config
new file mode 100644
index 0000000..2b6e946
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Move Ref 2/.config
@@ -0,0 +1,3 @@
+name=Move Ref 2
+description=Moves to the Reference 2 Position
+filename=Move Ref 2.xml
\ No newline at end of file
diff --git a/script/tests/tests/Collimator Tests pro/Move Ref 2/Move Ref 2.py b/script/tests/tests/Collimator Tests pro/Move Ref 2/Move Ref 2.py
new file mode 100644
index 0000000..a356685
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Move Ref 2/Move Ref 2.py
@@ -0,0 +1,90 @@
+
+###### DO NOT MODIFY THE CODE BELOW ######
+def startTest(testName, DEVICE, params):
+ #get the path of this script
+ testPath = inspect.getfile(inspect.currentframe())
+ #by default, failed
+ ret = 'Test failed'
+ status = False
+ #plot name to be given to the scan. Use: scan.setPlotName(plotName)
+ plotName = DEVICE + ' - ' + testName
+###### WRITE YOUR CODE HERE BELOW #######
+ #get parameters from the calling interface
+ print_log(testName, DEVICE, 'testpath: ' + testPath )
+ print_log(testName, DEVICE, 'parameters:' + str( params) )
+ print_log(testName, DEVICE, 'device: ' + DEVICE )
+ scan = ManualScan(['time'], ['idMotorStep', 'idPotiPosition', 'idPotiRef2Position','idMotorStep-idPotiPosition'] , [0.0], [30.0], [20])
+ scan.setPlotName(plotName)
+ scan.start()
+
+ #Creating channels: dimension 1
+ try:
+ idCom = Channel(DEVICE+':COM:2', type = 'd') #current position as from motor step counter [mm]
+ idMotorStep = Channel(DEVICE+':IST3:2', type = 'd') #current position as from motor step counter [mm]
+ idPotiPosFromBeam = Channel(DEVICE+':IST1:2', type = 'd') #current position from beam as from potentiometer [mm]
+ idPotiPosition = Channel(DEVICE+':IST2:1', type = 'd') #current position as from potentiometer [mm]
+ idPotiRef1Position = Channel(DEVICE+':REF1:1', type = 'd') #R1 position as from potentiometer [mm]
+ idPotiRef2Position = Channel(DEVICE+':REF2:1', type = 'd') #R2 position as from potentiometer [mm]
+
+ except:
+ sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
+ #raise Exception('Unable to create channel - ' + traceback.format_exc())
+ return
+
+ idCom.put(4.0, timeout=None) # go to R2
+ print_log(testName, DEVICE, 'Moving to reference point')
+ #scan quickly the output during some seconds
+ detector4 = idPotiPosition.get()
+ detector5 = idPotiRef1Position.get()
+ timeElapsed=0
+ while detector4
+
+
+
+
+
+
+
+
+
+ 3000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/script/tests/tests/Collimator Tests pro/Stop/.config b/script/tests/tests/Collimator Tests pro/Stop/.config
new file mode 100644
index 0000000..89d5a5f
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Stop/.config
@@ -0,0 +1,3 @@
+name=Stop
+description=Sends the STOP command
+filename=Stop.xml
\ No newline at end of file
diff --git a/script/tests/tests/Collimator Tests pro/Stop/Stop.xml b/script/tests/tests/Collimator Tests pro/Stop/Stop.xml
new file mode 100644
index 0000000..27228d3
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/Stop/Stop.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+ 3000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/script/tests/tests/Collimator Tests pro/what is on damir test tool.txt b/script/tests/tests/Collimator Tests pro/what is on damir test tool.txt
new file mode 100644
index 0000000..3135979
--- /dev/null
+++ b/script/tests/tests/Collimator Tests pro/what is on damir test tool.txt
@@ -0,0 +1,8 @@
+Test 1 plotted curves
+
+CCWsteps
+CCWpoti
+CWsteps
+CWpoti
+
+
diff --git a/script/tests/tests/Collimator Tests/Go to specific position/.config b/script/tests/tests/Collimator Tests/Go to specific position/.config
new file mode 100644
index 0000000..7945108
--- /dev/null
+++ b/script/tests/tests/Collimator Tests/Go to specific position/.config
@@ -0,0 +1,7 @@
+name=Go to specific position
+description=Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times
+
+
+#optional parameters. Description is compulsory. Syntax:
+#parameters=::[;::]
+parameters=repeatTimes:2:Repeat N times;midPoint:41.0:Middle point A;spanFromMidPoint:3.0:B steps around middle point A;delayS:0:Delay between each oscillation [s]
diff --git a/script/tests/tests/Collimator Tests/Go to specific position/Go to specific position.py b/script/tests/tests/Collimator Tests/Go to specific position/Go to specific position.py
new file mode 100644
index 0000000..261ab72
--- /dev/null
+++ b/script/tests/tests/Collimator Tests/Go to specific position/Go to specific position.py
@@ -0,0 +1,162 @@
+
+#Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times
+
+
+###### DO NOT MODIFY THE CODE BELOW ######
+global print_log, sendFeedback, inspect
+import sys, inspect, os, traceback
+
+def print_log(testName, DEVICE, text):
+ time.ctime()
+ now = time.strftime('%Y.%m.%d %H:%M:%S')
+ print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text)
+
+#prepare and send feedback to calling tool
+def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
+ print_log(testName, DEVICE, 'End of test. Result:')
+ print_log(testName, DEVICE, 'Device: ' + DEVICE)
+ print_log(testName, DEVICE, 'Test name: ' + testName)
+ print_log(testName, DEVICE, 'Test path: ' + testPath)
+ print_log(testName, DEVICE, 'Test passed: ' + str(testPassed))
+ print_log(testName, DEVICE, 'Return string: ' + returnString)
+ ret = [testPath, DEVICE, returnString, testPassed]
+ set_return(ret)
+
+def startTest(testName, DEVICE, params):
+ try:
+ import traceback
+ #get the path of this script
+ testPath = inspect.getfile(inspect.currentframe())
+ #by default, failed
+ ret = 'Test failed'
+ success = False
+ #plot name to be given to the scan. Use: scan.setPlotName(plotName)
+ plotName = DEVICE + ' - ' + testName
+
+###### WRITE YOUR CODE HERE BELOW #######
+
+ #get parameters from the calling interface
+ try:
+ print_log(testName, DEVICE, "Running test Motor Test 2 for device " + DEVICE + " with the following parameters:\n" + str(params))
+ middle = float(params["midPoint"]["value"])
+ loopTimes = int(params["repeatTimes"]["value"])
+ delayS = int(params["delayS"]["value"])
+ if(delayS<1): delayS=1
+ span = float(params["spanFromMidPoint"]["value"])
+ except:
+ ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
+ success = False
+ sendFeedback(testPath, testName, DEVICE, ret, success)
+ return
+
+ #scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idEncoderPosition', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20])
+ scan = ManualScan(['idX'], ['idMotorStatus', 'idMotorPosition', 'idEncoderPosition', 'idError'])
+ scan.setPlotName(plotName)
+ scan.start()
+
+ #Creating channels: dimension 1
+ try:
+ idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd')
+ idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd')
+ idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd')
+ idEncoderPosition = Channel(DEVICE+':ENCODER', type = 'd')
+ idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd')
+ idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd')
+ idLimitH = Channel(DEVICE+':MOTOR.HLM', type = 'd')
+ idLimitL = Channel(DEVICE+':MOTOR.LLM', type = 'd')
+ except:
+ ret = 'Unable to create channel - ' + traceback.format_exc()
+ success = False
+ sendFeedback(testPath, testName, DEVICE, ret, success)
+ return
+
+ #remove limits
+ idLimitH.put(999999.9, timeout=None)
+ idLimitL.put(-999999.9, timeout=None)
+
+ direction = 1.0
+ startDefault = middle - span
+ endDefault = middle + span
+ end = endDefault+1
+ #find position: it will be the middle point of the test
+ print_log(testName, DEVICE, 'Moving to middle point ' + str(middle) )
+ idInkr.put(middle, timeout=None) # TODO: Set appropriate timeout
+ readback2 = idInkr.get()
+ if abs(readback2 - middle) > 1 : # TODO: Check accuracy
+ ret = 'Actor idInkr could not be set to the value ' + str(middle) + ' (current value: ' + str(readback2) + ')'
+ success = False
+ sendFeedback(testPath, testName, DEVICE, ret, success)
+ return
+ start = readback2+direction
+ countSteps = 0
+ count = 0
+ print_log(testName, DEVICE, 'Moving around middle point (+-' + str(span) + ')' )
+ for setpoint1 in range(0, loopTimes*2):
+ count = count + 1
+ print_log(testName, DEVICE, 'Pausing ' + str(delayS) + 's' )
+ sleep( delayS ) # Settling time
+ #RegionPositioner idInkr
+ for setpoint2 in frange(start, end, direction):
+ readback1 = setpoint1
+ idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
+ sleep( 0.2 ) # Settling time
+ readback2 = idInkr.get()
+ if abs(readback2 - setpoint2) > 1 : # TODO: Check accuracy
+ ret = 'Actor idInkr could not be set to the value ' + str(setpoint2) + ' (current value: ' + str(readback2) + ')'
+ success = False
+ sendFeedback(testPath, testName, DEVICE, ret, success)
+ return
+ #Detector idMotorStatus
+ detector1 = idMotorStatus.get()
+ detector4 = idMotorPosition.get()
+ detector6 = idEncoderPosition.get()
+ endH = idEndSwitchH.get()
+ endL = idEndSwitchL.get()
+ #Manipulation idDiff01
+ #Variable Mappings
+ a = detector4
+ b = detector6
+ idDiff01 = a-b
+ countSteps = countSteps + 1
+ scan.append ([countSteps], [countSteps], [detector1, detector4, detector6, idDiff01])
+ if endH>0.0 or (direction > 0.0 and setpoint2 >= end -1):
+ #invert direction and swap start with end of translation
+ end = startDefault-1
+ start = setpoint2 - direction
+ direction = -1.0
+ print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction) )
+ break
+ if endL>0.0 or ( direction < 0.0 and setpoint2 <= end +1):
+ #invert direction and swap start with end of translation
+ end = endDefault+1
+ start = setpoint2 - direction
+ direction = 1.0
+ print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction) )
+ break
+
+ #set limits back
+ idLimitH.put(145.0, timeout=None)
+ idLimitL.put(0.0, timeout=None)
+
+ #Closing channels
+ idInkr.close()
+ idMotorStatus.close()
+ idMotorPosition.close()
+ idEncoderPosition.close()
+ idLimitH.close()
+ idLimitL.close()
+ scan.end()
+ ret = 'Slide moved back and forth (' + str(count) + ' runs)'
+ success = True
+
+############# END OF YOUR CODE ###########
+###### DO NOT MODIFY THE CODE BELOW ######
+ sendFeedback(testPath, testName, DEVICE, ret, success)
+ except:
+ ret = traceback.format_exc()
+ success = False
+ sendFeedback(testPath, testName, DEVICE, ret, success)
+ return
+
+#launch the test
+startTest(test, device, parameters)
diff --git a/script/tests/tests/Collimator Tests/Go to specific position/help.html b/script/tests/tests/Collimator Tests/Go to specific position/help.html
new file mode 100644
index 0000000..1433f32
--- /dev/null
+++ b/script/tests/tests/Collimator Tests/Go to specific position/help.html
@@ -0,0 +1,16 @@
+
+
+Short Description
+Oscillate around a specific position
+Details
+Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times
+Parameters
+midPoint Middle point A around which it will oscillate
+spanFromMidPoint B stepst to oscillate around A
+repeatTimes Repeat the moving N times
+delayS Pause delay (>0s) between each oscillation [s]
+Contact
+Marco Boccioli
+
+
+