Startup
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
<h2>Short Description</h2>
|
||||
<h2>Description</h2>
|
||||
$testDescription
|
||||
<h2>Details</h2>
|
||||
Add here the detailed description of the test, with reference to the parameters (if any).
|
||||
<h2>Parameters</h2>
|
||||
$testParameters
|
||||
<h2>Contact</h2>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#$testName
|
||||
#Test name: $testName
|
||||
#$testDescription
|
||||
|
||||
###### Init - DO NOT MODIFY THE CODE BELOW ######
|
||||
|
||||
@@ -1,79 +1,118 @@
|
||||
#Script imported from: Calibrate.xml
|
||||
###### Init - DO NOT MODIFY THE CODE BELOW ######
|
||||
global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback
|
||||
import sys, inspect, os, traceback
|
||||
|
||||
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()
|
||||
def print_log(testName, DEVICE, text):
|
||||
time.ctime()
|
||||
now = time.strftime('%Y.%m.%d %H:%M:%S')
|
||||
print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text)
|
||||
log (now + ' ' + DEVICE + ' - ' + testName + ': ' + text )
|
||||
|
||||
#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])
|
||||
#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)
|
||||
|
||||
#Closing channels
|
||||
id000001.close()
|
||||
id000003.close()
|
||||
id000004.close()
|
||||
id000005.close()
|
||||
id000006.close()
|
||||
id000007.close()
|
||||
id000008.close()
|
||||
id000009.close()
|
||||
id000010.close()
|
||||
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 #############
|
||||
scan = ManualScan(['sample'], ['Drive Status: '+DEVICE+':STA:1', 'Logical Pos: '+DEVICE+':IST:2', 'Diameter: '+DEVICE+':DIAM:2 (mm)', 'Cpc: '+DEVICE+':IST1:2 (mm)', 'Pot: '+DEVICE+':IST2:2 (mm)', 'Btvs: '+DEVICE+':IST3:2 (mm)'] , [0.0], [900.0], [900])
|
||||
scan.setPlotName(plotName)
|
||||
scan.start()
|
||||
|
||||
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:
|
||||
ret = 'Unable to create channel - ' + traceback.format_exc()
|
||||
success = False
|
||||
sendFeedback(testPath, testName, DEVICE, ret, success)
|
||||
return
|
||||
|
||||
#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, detector5, detector7, detector9])
|
||||
|
||||
scan.end()
|
||||
#Closing channels
|
||||
id000001.close()
|
||||
id000003.close()
|
||||
id000004.close()
|
||||
id000005.close()
|
||||
id000006.close()
|
||||
id000007.close()
|
||||
id000008.close()
|
||||
id000009.close()
|
||||
id000010.close()
|
||||
|
||||
ret = 'Calibration done'
|
||||
status = True
|
||||
scan.end()
|
||||
|
||||
ret = 'Calibration done'
|
||||
status = True
|
||||
################ END OF YOUR CODE ################
|
||||
###### Final - 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)
|
||||
|
||||
@@ -1,82 +1,118 @@
|
||||
#Script imported from: Drive Out.xml
|
||||
import traceback
|
||||
###### Init - DO NOT MODIFY THE CODE BELOW ######
|
||||
global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback
|
||||
import sys, inspect, os, traceback
|
||||
|
||||
#by default, failed
|
||||
ret = 'Test failed'
|
||||
status = False
|
||||
def print_log(testName, DEVICE, text):
|
||||
time.ctime()
|
||||
now = time.strftime('%Y.%m.%d %H:%M:%S')
|
||||
print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text)
|
||||
log (now + ' ' + DEVICE + ' - ' + testName + ': ' + 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)
|
||||
|
||||
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()
|
||||
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 #############
|
||||
scan = ManualScan(['sample'], ['Drive Status: '+DEVICE+':STA:1', 'Logical Pos: '+DEVICE+':IST:2', 'Diameter: '+DEVICE+':DIAM:2 (mm)', 'Cpc: '+DEVICE+':IST1:2 (mm)', 'Pot: '+DEVICE+'::IST2:2 (mm)', 'Btvs: '+DEVICE+':IST3:2 (mm)'] )
|
||||
scan.setPlotName(plotName);
|
||||
scan.start()
|
||||
|
||||
#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()
|
||||
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:
|
||||
ret = 'Unable to create channel - ' + traceback.format_exc()
|
||||
success = False
|
||||
sendFeedback(testPath, testName, DEVICE, ret, success)
|
||||
return
|
||||
|
||||
#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()
|
||||
#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, detector5, detector7, detector9])
|
||||
|
||||
scan.end()
|
||||
#Closing channels
|
||||
id000001.close()
|
||||
id000003.close()
|
||||
id000004.close()
|
||||
id000005.close()
|
||||
id000006.close()
|
||||
id000007.close()
|
||||
id000008.close()
|
||||
id000009.close()
|
||||
id000010.close()
|
||||
|
||||
#return ok
|
||||
ret = 'Slides moved out'
|
||||
status = True
|
||||
scan.end()
|
||||
|
||||
#return ok
|
||||
ret = 'Slides moved out'
|
||||
status = 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)
|
||||
|
||||
Reference in New Issue
Block a user