This commit is contained in:
boccioli_m
2015-09-02 09:15:01 +02:00
parent 86ba17cdca
commit d60cd68812
104 changed files with 4334 additions and 3 deletions
@@ -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
@@ -0,0 +1,94 @@
###### DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback
import sys, inspect, os, traceback
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
log (now + ' ' + DEVICE + ' - ' + testName + ': ' + text )
#get test arguments
DEVICE = device
testName = test
params = parameters
#launch the test
startTest(testName, DEVICE, params)
@@ -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)
@@ -0,0 +1,4 @@
#Tue Sep 01 11:44:04 CEST 2015
name=feffeefe
parameters=examplePar1\:2\:This is the parameter n.1 with unit [unit];examplePar2\:4.5\:This is the parameter n.2 with unit [unit];
description=dvfsdf
@@ -0,0 +1,119 @@
#feffeefe
#dvfsdf
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback
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)
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)
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 #############
#All the code here in this section ## ..YOUR CODE.. ## can be modified/deleted.
# INPUTS:
#If needed, the following variables are available:
#testPath string, path of this test file
#testName string, name of this test
#DEVICE string, device for which the test must run (typically it is the beginning of a process variable name)
#params dictionary, a set of key-value parameters specific to the test.
# Syntax: params["<key>"]["value"]
# Example: access the parameter called midPoint and store it in a new variable:
# middlePoint = params["midPoint"]["value"]
# OUTPUTS:
#ret string, a text summarizing the result of the test. It must be set before the end of your code.
#success bool, True = test successful. It must be set before the end of your code.
#Example (can be removed): print the list of parameters passed. If any error, stop and send feedback
print_log(testName, DEVICE, "Example - Test name: "+testName):
print_log(testName, DEVICE, "Example - Device name: "+DEVICE):
try:
print_log(testName, DEVICE, "Running test Initialise with the following parameters:")
print_log(testName, DEVICE, params )
#If present, use the parameters here below for your test script
examplePar1 = float(params["examplePar1"]["value"]) ; examplePar2 = float(params["examplePar2"]["value"]) ;
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#example: loop to read channels for a while and plot the channels values.
#initialise plot tab with 2 plots
scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] )
#set plot name(tab title)
scan.setPlotName(plotName)
#start plots. See further below how to add points to the plots
scan.start()
#IMPORTANT: if the test resulted with an error, write the following:
ret = "Example - Error, the test failed because...."
success = False
#IMPORTANT: if the test was successful, write the following:
ret = "Example - Test successful, here some detail: ..."
success = True
#set up connection to channels. "type" of data can be "d" (= double), "l" (= long)
try:
pv_motor_msta = Channel(DEVICE+':MOTOR.MSTA', type = 'd')
pv_motor_val = Channel(DEVICE+':MOTOR.VAL' , type = 'd')
except:
#prepare return information: return text
ret = 'Unable to create channel - ' + traceback.format_exc()
#prepare return information: return success
success = False
#send return information
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#take 100 samples of the channels
for sample in range(0, 100):
readback1 = sample
sleep( 0.1 ) # Settling time
#get value
motor_msta = pv_motor_msta.get()
#get value
motor_val = pv_motor_val.get()
#add values to plot
scan.append ([sample], [readback1], [detmotor_msta, motor_val] )
#Closing channels
pv_motor_msta.close()
pv_motor_val.close()
#once the test is finished, no need to do anything. The code below yours will do the rest.
################ 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)
@@ -0,0 +1,15 @@
<html>
<body>
<h2>Short Description</h2>
dvfsdf
<h2>Details</h2>
Add here the detailed description of the test, with reference to the parameters (if any).
<h2>Parameters</h2>
<code>examplePar1 </code>This is the parameter n.1 with unit [unit]<br/>
<code>examplePar2 </code>This is the parameter n.2 with unit [unit]<br/>
<h2>Contact</h2>
<a href="https://intranet.psi.ch/search/#?t=phonebook&q=dfsdfd">dfsdfd</a>
</html>
</body>
+4
View File
@@ -0,0 +1,4 @@
#Tue Sep 01 11:58:14 CEST 2015
name=ef
parameters=examplePar1\:2\:This is the parameter n.1 with unit [unit];examplePar2\:4.5\:This is the parameter n.2 with unit [unit];
description=wedwee
+119
View File
@@ -0,0 +1,119 @@
#ef
#wedwee
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback
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)
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)
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 #############
#All the code here in this section ## ..YOUR CODE.. ## can be modified/deleted.
# INPUTS:
#If needed, the following variables are available:
#testPath string, path of this test file
#testName string, name of this test
#DEVICE string, device for which the test must run (typically it is the beginning of a process variable name)
#params dictionary, a set of key-value parameters specific to the test.
# Syntax: params["<key>"]["value"]
# Example: access the parameter called midPoint and store it in a new variable:
# middlePoint = params["midPoint"]["value"]
# OUTPUTS:
#ret string, a text summarizing the result of the test. It must be set before the end of your code.
#success bool, True = test successful. It must be set before the end of your code.
#Example (can be removed): print the list of parameters passed. If any error, stop and send feedback
print_log(testName, DEVICE, "Example - Test name: "+testName):
print_log(testName, DEVICE, "Example - Device name: "+DEVICE):
try:
print_log(testName, DEVICE, "Running test Initialise with the following parameters:")
print_log(testName, DEVICE, params )
#If present, use the parameters here below for your test script
examplePar1 = float(params["examplePar1"]["value"]) ; examplePar2 = float(params["examplePar2"]["value"]) ;
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#example: loop to read channels for a while and plot the channels values.
#initialise plot tab with 2 plots
scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] )
#set plot name(tab title)
scan.setPlotName(plotName)
#start plots. See further below how to add points to the plots
scan.start()
#IMPORTANT: if the test resulted with an error, write the following:
ret = "Example - Error, the test failed because...."
success = False
#IMPORTANT: if the test was successful, write the following:
ret = "Example - Test successful, here some detail: ..."
success = True
#set up connection to channels. "type" of data can be "d" (= double), "l" (= long)
try:
pv_motor_msta = Channel(DEVICE+':MOTOR.MSTA', type = 'd')
pv_motor_val = Channel(DEVICE+':MOTOR.VAL' , type = 'd')
except:
#prepare return information: return text
ret = 'Unable to create channel - ' + traceback.format_exc()
#prepare return information: return success
success = False
#send return information
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#take 100 samples of the channels
for sample in range(0, 100):
readback1 = sample
sleep( 0.1 ) # Settling time
#get value
motor_msta = pv_motor_msta.get()
#get value
motor_val = pv_motor_val.get()
#add values to plot
scan.append ([sample], [readback1], [detmotor_msta, motor_val] )
#Closing channels
pv_motor_msta.close()
pv_motor_val.close()
#once the test is finished, no need to do anything. The code below yours will do the rest.
################ 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)
+15
View File
@@ -0,0 +1,15 @@
<html>
<body>
<h2>Short Description</h2>
wedwee
<h2>Details</h2>
Add here the detailed description of the test, with reference to the parameters (if any).
<h2>Parameters</h2>
<code>examplePar1 </code>This is the parameter n.1 with unit [unit]<br/>
<code>examplePar2 </code>This is the parameter n.2 with unit [unit]<br/>
<h2>Contact</h2>
<a href="https://intranet.psi.ch/search/#?t=phonebook&q=deefe">deefe</a>
</html>
</body>
+4
View File
@@ -0,0 +1,4 @@
#Tue Sep 01 13:58:29 CEST 2015
name=blabla
parameters=examplePar1\:2\:This is the parameter n.1 with unit [unit];examplePar2\:4.5\:This is the parameter n.2 with unit [unit];
description=zaza
+119
View File
@@ -0,0 +1,119 @@
#Test name: blabla
#zaza
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback
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)
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)
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 #############
#All the code here in this section ## ..YOUR CODE.. ## can be modified/deleted.
# INPUTS:
#If needed, the following variables are available:
#testPath string, path of this test file
#testName string, name of this test
#DEVICE string, device for which the test must run (typically it is the beginning of a process variable name)
#params dictionary, a set of key-value parameters specific to the test.
# Syntax: params["<key>"]["value"]
# Example: access the parameter called midPoint and store it in a new variable:
# middlePoint = params["midPoint"]["value"]
# OUTPUTS:
#ret string, a text summarizing the result of the test. It must be set before the end of your code.
#success bool, True = test successful. It must be set before the end of your code.
#Example (can be removed): print the list of parameters passed. If any error, stop and send feedback
print_log(testName, DEVICE, "Example - Test name: "+testName):
print_log(testName, DEVICE, "Example - Device name: "+DEVICE):
try:
print_log(testName, DEVICE, "Running test Initialise with the following parameters:")
print_log(testName, DEVICE, params )
#If present, use the parameters here below for your test script
examplePar1 = float(params["examplePar1"]["value"]) ; examplePar2 = float(params["examplePar2"]["value"]) ;
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#example: loop to read channels for a while and plot the channels values.
#initialise plot tab with 2 plots
scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] )
#set plot name(tab title)
scan.setPlotName(plotName)
#start plots. See further below how to add points to the plots
scan.start()
#IMPORTANT: if the test resulted with an error, write the following:
ret = "Example - Error, the test failed because...."
success = False
#IMPORTANT: if the test was successful, write the following:
ret = "Example - Test successful, here some detail: ..."
success = True
#set up connection to channels. "type" of data can be "d" (= double), "l" (= long)
try:
pv_motor_msta = Channel(DEVICE+':MOTOR.MSTA', type = 'd')
pv_motor_val = Channel(DEVICE+':MOTOR.VAL' , type = 'd')
except:
#prepare return information: return text
ret = 'Unable to create channel - ' + traceback.format_exc()
#prepare return information: return success
success = False
#send return information
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#take 100 samples of the channels
for sample in range(0, 100):
readback1 = sample
sleep( 0.1 ) # Settling time
#get value
motor_msta = pv_motor_msta.get()
#get value
motor_val = pv_motor_val.get()
#add values to plot
scan.append ([sample], [readback1], [detmotor_msta, motor_val] )
#Closing channels
pv_motor_msta.close()
pv_motor_val.close()
#once the test is finished, no need to do anything. The code below yours will do the rest.
################ 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)
+15
View File
@@ -0,0 +1,15 @@
<html>
<body>
<h2>Short Description</h2>
zaza
<h2>Details</h2>
Add here the detailed description of the test, with reference to the parameters (if any).
<h2>Parameters</h2>
<code>examplePar1 </code>This is the parameter n.1 with unit [unit]<br/>
<code>examplePar2 </code>This is the parameter n.2 with unit [unit]<br/>
<h2>Contact</h2>
<a href="https://intranet.psi.ch/search/#?t=phonebook&q=boccioli_m">boccioli_m</a>
</html>
</body>
@@ -0,0 +1,4 @@
#Tue Sep 01 14:16:37 CEST 2015
name=aaaaaaaaaaa
parameters=examplePar1\:2\:This is the parameter n.1 with unit [unit];awa\:5\:wawawwaa;examplePar2\:4.5\:This is the parameter n.2 with unit [unit];
description=asdewe fre rgg tr hyhyhyj jyjyj jkujyu u \: yj yj . thth h<3434 thth \=45 >tt5 [s]
@@ -0,0 +1,119 @@
#Test name: aaaaaaaaaaa
#asdewe fre rgg tr hyhyhyj jyjyj jkujyu u : yj yj . thth h<3434 thth =45 >tt5 [s]
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback
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)
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)
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 #############
#All the code here in this section ## ..YOUR CODE.. ## can be modified/deleted.
# INPUTS:
#If needed, the following variables are available:
#testPath string, path of this test file
#testName string, name of this test
#DEVICE string, device for which the test must run (typically it is the beginning of a process variable name)
#params dictionary, a set of key-value parameters specific to the test.
# Syntax: params["<key>"]["value"]
# Example: access the parameter called midPoint and store it in a new variable:
# middlePoint = params["midPoint"]["value"]
# OUTPUTS:
#ret string, a text summarizing the result of the test. It must be set before the end of your code.
#success bool, True = test successful. It must be set before the end of your code.
#Example (can be removed): print the list of parameters passed. If any error, stop and send feedback
print_log(testName, DEVICE, "Example - Test name: "+testName):
print_log(testName, DEVICE, "Example - Device name: "+DEVICE):
try:
print_log(testName, DEVICE, "Running test Initialise with the following parameters:")
print_log(testName, DEVICE, params )
#If present, use the parameters here below for your test script
examplePar1 = float(params["examplePar1"]["value"]) ; awa = float(params["awa"]["value"]) ; examplePar2 = float(params["examplePar2"]["value"]) ;
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#example: loop to read channels for a while and plot the channels values.
#initialise plot tab with 2 plots
scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] )
#set plot name(tab title)
scan.setPlotName(plotName)
#start plots. See further below how to add points to the plots
scan.start()
#IMPORTANT: if the test resulted with an error, write the following:
ret = "Example - Error, the test failed because...."
success = False
#IMPORTANT: if the test was successful, write the following:
ret = "Example - Test successful, here some detail: ..."
success = True
#set up connection to channels. "type" of data can be "d" (= double), "l" (= long)
try:
pv_motor_msta = Channel(DEVICE+':MOTOR.MSTA', type = 'd')
pv_motor_val = Channel(DEVICE+':MOTOR.VAL' , type = 'd')
except:
#prepare return information: return text
ret = 'Unable to create channel - ' + traceback.format_exc()
#prepare return information: return success
success = False
#send return information
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#take 100 samples of the channels
for sample in range(0, 100):
readback1 = sample
sleep( 0.1 ) # Settling time
#get value
motor_msta = pv_motor_msta.get()
#get value
motor_val = pv_motor_val.get()
#add values to plot
scan.append ([sample], [readback1], [detmotor_msta, motor_val] )
#Closing channels
pv_motor_msta.close()
pv_motor_val.close()
#once the test is finished, no need to do anything. The code below yours will do the rest.
################ 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)
@@ -0,0 +1,14 @@
<html>
<body>
<h2>Description</h2>
asdewe fre rgg tr hyhyhyj jyjyj jkujyu u : yj yj . thth h<3434 thth =45 >tt5 [s]
<h2>Parameters</h2>
<code>examplePar1 </code>This is the parameter n.1 with unit [unit]<br/>
<code>awa </code>wawawwaa<br/>
<code>examplePar2 </code>This is the parameter n.2 with unit [unit]<br/>
<h2>Contact</h2>
<a href="https://intranet.psi.ch/search/#?t=phonebook&q=boccioli_m">boccioli_m</a>
</html>
</body>
+4
View File
@@ -0,0 +1,4 @@
#Tue Sep 01 14:04:43 CEST 2015
name=aha
parameters=ef\:2\:feeerfs;examplePar1\:2\:This is the parameter n.1 with unit [unit];examplePar2\:4.5\:This is the parameter n.2 with unit [unit];
description=pppoo
+119
View File
@@ -0,0 +1,119 @@
#Test name: aha
#pppoo
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback
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)
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)
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 #############
#All the code here in this section ## ..YOUR CODE.. ## can be modified/deleted.
# INPUTS:
#If needed, the following variables are available:
#testPath string, path of this test file
#testName string, name of this test
#DEVICE string, device for which the test must run (typically it is the beginning of a process variable name)
#params dictionary, a set of key-value parameters specific to the test.
# Syntax: params["<key>"]["value"]
# Example: access the parameter called midPoint and store it in a new variable:
# middlePoint = params["midPoint"]["value"]
# OUTPUTS:
#ret string, a text summarizing the result of the test. It must be set before the end of your code.
#success bool, True = test successful. It must be set before the end of your code.
#Example (can be removed): print the list of parameters passed. If any error, stop and send feedback
print_log(testName, DEVICE, "Example - Test name: "+testName):
print_log(testName, DEVICE, "Example - Device name: "+DEVICE):
try:
print_log(testName, DEVICE, "Running test Initialise with the following parameters:")
print_log(testName, DEVICE, params )
#If present, use the parameters here below for your test script
ef = float(params["ef"]["value"]) ; examplePar1 = float(params["examplePar1"]["value"]) ; examplePar2 = float(params["examplePar2"]["value"]) ;
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#example: loop to read channels for a while and plot the channels values.
#initialise plot tab with 2 plots
scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] )
#set plot name(tab title)
scan.setPlotName(plotName)
#start plots. See further below how to add points to the plots
scan.start()
#IMPORTANT: if the test resulted with an error, write the following:
ret = "Example - Error, the test failed because...."
success = False
#IMPORTANT: if the test was successful, write the following:
ret = "Example - Test successful, here some detail: ..."
success = True
#set up connection to channels. "type" of data can be "d" (= double), "l" (= long)
try:
pv_motor_msta = Channel(DEVICE+':MOTOR.MSTA', type = 'd')
pv_motor_val = Channel(DEVICE+':MOTOR.VAL' , type = 'd')
except:
#prepare return information: return text
ret = 'Unable to create channel - ' + traceback.format_exc()
#prepare return information: return success
success = False
#send return information
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#take 100 samples of the channels
for sample in range(0, 100):
readback1 = sample
sleep( 0.1 ) # Settling time
#get value
motor_msta = pv_motor_msta.get()
#get value
motor_val = pv_motor_val.get()
#add values to plot
scan.append ([sample], [readback1], [detmotor_msta, motor_val] )
#Closing channels
pv_motor_msta.close()
pv_motor_val.close()
#once the test is finished, no need to do anything. The code below yours will do the rest.
################ 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)
+16
View File
@@ -0,0 +1,16 @@
<html>
<body>
<h2>Short Description</h2>
pppoo
<h2>Details</h2>
Add here the detailed description of the test, with reference to the parameters (if any).
<h2>Parameters</h2>
<code>ef </code>feeerfs<br/>
<code>examplePar1 </code>This is the parameter n.1 with unit [unit]<br/>
<code>examplePar2 </code>This is the parameter n.2 with unit [unit]<br/>
<h2>Contact</h2>
<a href="https://intranet.psi.ch/search/#?t=phonebook&q=boccioli_m">boccioli_m</a>
</html>
</body>
+4
View File
@@ -0,0 +1,4 @@
#Tue Sep 01 11:44:57 CEST 2015
name=dfsdf
parameters=examplePar1\:2\:This is the parameter n.1 with unit [unit];examplePar2\:4.5\:This is the parameter n.2 with unit [unit];
description=wqeqw
+119
View File
@@ -0,0 +1,119 @@
#dfsdf
#wqeqw
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback
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)
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)
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 #############
#All the code here in this section ## ..YOUR CODE.. ## can be modified/deleted.
# INPUTS:
#If needed, the following variables are available:
#testPath string, path of this test file
#testName string, name of this test
#DEVICE string, device for which the test must run (typically it is the beginning of a process variable name)
#params dictionary, a set of key-value parameters specific to the test.
# Syntax: params["<key>"]["value"]
# Example: access the parameter called midPoint and store it in a new variable:
# middlePoint = params["midPoint"]["value"]
# OUTPUTS:
#ret string, a text summarizing the result of the test. It must be set before the end of your code.
#success bool, True = test successful. It must be set before the end of your code.
#Example (can be removed): print the list of parameters passed. If any error, stop and send feedback
print_log(testName, DEVICE, "Example - Test name: "+testName):
print_log(testName, DEVICE, "Example - Device name: "+DEVICE):
try:
print_log(testName, DEVICE, "Running test Initialise with the following parameters:")
print_log(testName, DEVICE, params )
#If present, use the parameters here below for your test script
examplePar1 = float(params["examplePar1"]["value"]) ; examplePar2 = float(params["examplePar2"]["value"]) ;
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#example: loop to read channels for a while and plot the channels values.
#initialise plot tab with 2 plots
scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] )
#set plot name(tab title)
scan.setPlotName(plotName)
#start plots. See further below how to add points to the plots
scan.start()
#IMPORTANT: if the test resulted with an error, write the following:
ret = "Example - Error, the test failed because...."
success = False
#IMPORTANT: if the test was successful, write the following:
ret = "Example - Test successful, here some detail: ..."
success = True
#set up connection to channels. "type" of data can be "d" (= double), "l" (= long)
try:
pv_motor_msta = Channel(DEVICE+':MOTOR.MSTA', type = 'd')
pv_motor_val = Channel(DEVICE+':MOTOR.VAL' , type = 'd')
except:
#prepare return information: return text
ret = 'Unable to create channel - ' + traceback.format_exc()
#prepare return information: return success
success = False
#send return information
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#take 100 samples of the channels
for sample in range(0, 100):
readback1 = sample
sleep( 0.1 ) # Settling time
#get value
motor_msta = pv_motor_msta.get()
#get value
motor_val = pv_motor_val.get()
#add values to plot
scan.append ([sample], [readback1], [detmotor_msta, motor_val] )
#Closing channels
pv_motor_msta.close()
pv_motor_val.close()
#once the test is finished, no need to do anything. The code below yours will do the rest.
################ 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)
+15
View File
@@ -0,0 +1,15 @@
<html>
<body>
<h2>Short Description</h2>
wqeqw
<h2>Details</h2>
Add here the detailed description of the test, with reference to the parameters (if any).
<h2>Parameters</h2>
<code>examplePar1 </code>This is the parameter n.1 with unit [unit]<br/>
<code>examplePar2 </code>This is the parameter n.2 with unit [unit]<br/>
<h2>Contact</h2>
<a href="https://intranet.psi.ch/search/#?t=phonebook&q=hjkhjkl">hjkhjkl</a>
</html>
</body>