From dec3bd47f3032500b128e8f5fc4ed73b77ee3492 Mon Sep 17 00:00:00 2001 From: boccioli_m Date: Wed, 16 Sep 2015 15:08:15 +0200 Subject: [PATCH] Closedown --- plugins/NewTest.java | 2 +- .../Motor Test 2/help.html | 30 +- .../monitorAllParams/.config | 8 +- .../monitorAllParams/help.html | 22 +- .../monitorAllParams/monitorAllParams.py | 290 +++++++++--------- 5 files changed, 176 insertions(+), 176 deletions(-) diff --git a/plugins/NewTest.java b/plugins/NewTest.java index 290024d..14e0d0f 100644 --- a/plugins/NewTest.java +++ b/plugins/NewTest.java @@ -940,7 +940,7 @@ public class NewTest extends javax.swing.JPanel { Logger.getLogger(NewTest.class.getName()).log(Level.SEVERE, null, ex); } if(attrs == null){ - System.out.println("LDAP: user" + userName +" not found."); + System.out.println("LDAP: user " + userName +" not found."); } return attrs; } diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 2/help.html b/script/tests/tests/Collimator Tests pro/Motor Test 2/help.html index a1c8bc0..f5bddb1 100644 --- a/script/tests/tests/Collimator Tests pro/Motor Test 2/help.html +++ b/script/tests/tests/Collimator Tests pro/Motor Test 2/help.html @@ -1,15 +1,15 @@ - - -

Short Description

-Oscillate around a specified 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

-repeatTimes Repeat the Initialisation N times
-midPoint Position A -spanFromMidPoint The B steps -

Contact

-Marco Boccioli - - - + + +

Short Description

+Oscillate around a specified 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

+repeatTimes Repeat the Initialisation N times
+midPoint Position A +spanFromMidPoint The B steps +

Contact

+Marco Boccioli + + + diff --git a/script/tests/tests/Collimator Tests pro/monitorAllParams/.config b/script/tests/tests/Collimator Tests pro/monitorAllParams/.config index f4e4c0e..9a7b936 100644 --- a/script/tests/tests/Collimator Tests pro/monitorAllParams/.config +++ b/script/tests/tests/Collimator Tests pro/monitorAllParams/.config @@ -1,4 +1,4 @@ -#Fri Sep 11 13:31:33 CEST 2015 -name=monitorAllParams -parameters=monitorTime\:0.1\:This is the parameter n.1 with unit [unit];samplingDelay\:30\:This is the parameter n.2 with unit [unit]; -description=d +#Fri Sep 11 13:31:33 CEST 2015 +name=monitorAllParams +parameters=monitorTime\:0.1\:This is the parameter n.1 with unit [unit];samplingDelay\:30\:This is the parameter n.2 with unit [unit]; +description=d diff --git a/script/tests/tests/Collimator Tests pro/monitorAllParams/help.html b/script/tests/tests/Collimator Tests pro/monitorAllParams/help.html index 3043e89..0d6eb66 100644 --- a/script/tests/tests/Collimator Tests pro/monitorAllParams/help.html +++ b/script/tests/tests/Collimator Tests pro/monitorAllParams/help.html @@ -1,13 +1,13 @@ - - -

Description

-d -

Parameters

+ + +

Description

+d +

Parameters

monitorTime This is the parameter n.1 with unit [unit]
samplingDelay This is the parameter n.2 with unit [unit]
- -

Contact

-boccioli_m - - - + +

Contact

+boccioli_m + + + diff --git a/script/tests/tests/Collimator Tests pro/monitorAllParams/monitorAllParams.py b/script/tests/tests/Collimator Tests pro/monitorAllParams/monitorAllParams.py index b7576c6..b9a9396 100644 --- a/script/tests/tests/Collimator Tests pro/monitorAllParams/monitorAllParams.py +++ b/script/tests/tests/Collimator Tests pro/monitorAllParams/monitorAllParams.py @@ -1,145 +1,145 @@ -# Test name: monitorAllParams -# d - -###### Init - DO NOT MODIFY THE CODE BELOW ###### -global sys, inspect, os, traceback -import sys, inspect, os, traceback - - -def startTest(testName, DEVICE, params): - # by default, assume the test failed - ret = 'Test failed' - success = False - # plot name to be given to the scan. Use: scan.setPlotName(plotName) - plotName = DEVICE + ' - ' + testName - # put the whole custom code under try/catch - try: - # get the path of this script - testPath = inspect.getfile(inspect.currentframe()) - # init the testing tool class. It can be sued in the following ways: - test = TestingTool(testName, testPath, DEVICE, params) - - ################ END OF Init ##################### - ######### WRITE YOUR CODE HERE BELOW ############# - - """ - All the code in this section ###..YOUR CODE..### can be modified/deleted. - It must be indented to the same level as this comment - ----------------------------------- - GETTING 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) - ----------------------------------- - GETTING TEST PARAMETERS: - if you need to get parameters for the test, use (casting may be necessary): - myParamValue = test.getParam('myParamName') - see the test config for the list of parameters specific to the test. - ----------------------------------- - SETTING 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. - test.sendFeedback(ret,success) method that ends the testing script and gives the report to the calling application. - Examples: - - whenever the code must quit (i.e. after an error), you must end with: - ret = 'here is some info on what failed on the test' - success = false - test.sendFeedback(ret, success) - - whenever the code is finished successfully, you must end with: - ret = 'here is some info on the success of the test' - success = true - test.sendFeedback(ret, success) - ----------------------------------- - LOG INFO: - when some information must be shown on the log, use: - test.log('test to log') - """ - - ########## Example (can be removed) ###### - # print the list of parameters passed. If any error, stop and send feedback - test.log("Example - Test name: " + testName) - test.log("Example - Device name: " + DEVICE) - try: - test.log("Running test Initialise with the following parameters:") - test.log(params) - # If present, use the parameters here below for your test script. You might need to change the casting - monitorTime = float(test.getParam('monitorTime')) ; samplingDelay = float(test.getParam('samplingDelay')) ; - except: - ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() - success = False - test.sendFeedback(ret, success) - return - - # 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 failed, write the report into the variables ret and success. - # for example, write the following: - ret = "Example - Error, the test failed because...." - success = False - # 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 - test.sendFeedback(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], [motor_msta, motor_val]) - - # Closing channels - pv_motor_msta.close() - pv_motor_val.close() - - # IMPORTANT: if the test was successful, write the report into the variables ret and success. - # for example, write the following: - ret = "Example - Test successful, here some detail: ..." - success = True - test.sendFeedback(ret, success) - # once the test is finished, no need to do anything. The code below yours will do the rest. - ################ End of Example ########## - - ################ END OF YOUR CODE ################ - ###### Final - DO NOT MODIFY THE CODE BELOW ###### - - # just in case the feedback was forgotten - test.sendFeedback(ret, success) - except (KeyboardInterrupt): - # user stop error handler - ret = 'Test stopped by user.' - success = False - test.sendFeedback(ret, success) - except: - # generic error handler - ret = traceback.format_exc() - success = False - test.sendFeedback(ret, success) - - -# launch the test -startTest(test, device, parameters) - -################ END OF Final #################### -#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### -# def yourCustomFunction: +# Test name: monitorAllParams +# d + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + # by default, assume the test failed + ret = 'Test failed' + success = False + # plot name to be given to the scan. Use: scan.setPlotName(plotName) + plotName = DEVICE + ' - ' + testName + # put the whole custom code under try/catch + try: + # get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + + ################ END OF Init ##################### + ######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section ###..YOUR CODE..### can be modified/deleted. + It must be indented to the same level as this comment + ----------------------------------- + GETTING 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) + ----------------------------------- + GETTING TEST PARAMETERS: + if you need to get parameters for the test, use (casting may be necessary): + myParamValue = test.getParam('myParamName') + see the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING 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. + test.sendFeedback(ret,success) method that ends the testing script and gives the report to the calling application. + Examples: + + whenever the code must quit (i.e. after an error), you must end with: + ret = 'here is some info on what failed on the test' + success = false + test.sendFeedback(ret, success) + + whenever the code is finished successfully, you must end with: + ret = 'here is some info on the success of the test' + success = true + test.sendFeedback(ret, success) + ----------------------------------- + LOG INFO: + when some information must be shown on the log, use: + test.log('test to log') + """ + + ########## Example (can be removed) ###### + # print the list of parameters passed. If any error, stop and send feedback + test.log("Example - Test name: " + testName) + test.log("Example - Device name: " + DEVICE) + try: + test.log("Running test Initialise with the following parameters:") + test.log(params) + # If present, use the parameters here below for your test script. You might need to change the casting + monitorTime = float(test.getParam('monitorTime')) ; samplingDelay = float(test.getParam('samplingDelay')) ; + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # 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 failed, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Error, the test failed because...." + success = False + # 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 + test.sendFeedback(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], [motor_msta, motor_val]) + + # Closing channels + pv_motor_msta.close() + pv_motor_val.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + test.sendFeedback(ret, success) + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + + ################ END OF YOUR CODE ################ + ###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# def yourCustomFunction: