From 6a79a92f66e8f662e4a56be2ea4be9465489e8f4 Mon Sep 17 00:00:00 2001 From: boccioli_m Date: Mon, 28 Aug 2017 15:26:08 +0200 Subject: [PATCH] Closedown --- script/tests/tests.properties | 2 +- script/tests/tests/sad/rightleft/.config | 4 +-- script/tests/tests/sad/rightleft/rightleft.py | 34 +++++++++++++++---- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/script/tests/tests.properties b/script/tests/tests.properties index f23fc61..5ee1b9b 100644 --- a/script/tests/tests.properties +++ b/script/tests/tests.properties @@ -1,5 +1,5 @@ #TestingList for pshell: configuration properties -#Fri Aug 25 16:57:39 CEST 2017 +#Mon Aug 28 15:25:01 CEST 2017 customPanel= showEnabledTestsOnly=true listFilter=test-bx84 diff --git a/script/tests/tests/sad/rightleft/.config b/script/tests/tests/sad/rightleft/.config index a2593ab..9ff18c4 100644 --- a/script/tests/tests/sad/rightleft/.config +++ b/script/tests/tests/sad/rightleft/.config @@ -1,4 +1,4 @@ -#Fri Aug 25 16:45:24 CEST 2017 +#Mon Aug 28 14:48:34 CEST 2017 name=rightleft -parameters=delay\:.2\:delay between 2 steps;centre\:2\:centre where to move around;moveAround\:20\:move right and left from centre;steps\:1\:steps of each move; +parameters=delay\:.1\:delay between 2 steps;centre\:2\:centre where to move around;moveAround\:10\:move right and left from centre;steps\:1\:steps of each move; description=move around a value and plot the result diff --git a/script/tests/tests/sad/rightleft/rightleft.py b/script/tests/tests/sad/rightleft/rightleft.py index 5aea1d6..eeab882 100644 --- a/script/tests/tests/sad/rightleft/rightleft.py +++ b/script/tests/tests/sad/rightleft/rightleft.py @@ -98,7 +98,8 @@ def startTest(testName, DEVICE, params): from math import sin motor_val = 0 # take 100 samples of a sinus and a jigsaw plot them: - for sample in range(int(-moveAround), int(moveAround), int(steps)): + for sample in range(int(-moveAround), int(moveAround)+1, int(steps)): + break readback1 = sample #the x axis. sleep(delay) # settling time. # get value (it is translated to a caget): @@ -128,25 +129,46 @@ def startTest(testName, DEVICE, params): # send a command to a channel (it is translated to a caput): uncomment this line below to try it #pv_motor_com.put(1.0, timeout=None) # optionally, a timeout can be given. # take 100 samples of the channels and plot them: - for sample in range(int(moveAround), int(-moveAround), int(-steps)): + forwardsValues = {} + maxError = 0.0 + maxErrorPos = 0.0 + for sample in range(int(-moveAround), int(moveAround)+1, int(steps)): readback1 = sample #the x axis. sleep(delay) # settling time. # get value: - motor_val = pv_motor_val.put(float(readback1)) + motor_val = float(readback1) + pv_motor_val.put(motor_val) # get value (it is translated to a caget): motor_sta = pv_motor_sta.get() # add values to plot: #scan.append([readback1], [readback1], [motor_sta, motor_val]) # 2 colour plot - p1.getSeries(1).appendData(float(motor_val), float(motor_sta)) - + p1.getSeries(0).appendData(motor_val, float(motor_sta)) + forwardsValues[sample] = float(motor_sta) + for sample in range(int(moveAround), int(-moveAround)-1, int(-steps)): + readback1 = sample #the x axis. + sleep(delay) # settling time. + # get value: + motor_val = float(readback1) + pv_motor_val.put(motor_val+1.0) + # get value (it is translated to a caget): + motor_sta = pv_motor_sta.get() + 5 + # add values to plot: + # scan.append([readback1], [readback1], [motor_sta, motor_val]) + # 2 colour plot + p1.getSeries(1).appendData(motor_val, float(motor_sta)) + if abs(float(forwardsValues[sample]) - float(motor_sta)) > maxError: + maxError = abs(float(forwardsValues[sample]) - float(motor_sta) ) + maxErrorPos = sample + import java.awt.Color + p1.addMarker(maxErrorPos, None, "MaxE=" + str(maxError), java.awt.Color.GREEN) # Closing channels: all channels that were opened with Channel() must be closed before exit: pv_motor_sta.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: ..." + ret = "Example - Test successful, max error: " + str(maxError) + " at " + str(maxErrorPos) success = True test.sendFeedback(ret, success) # once the test is finished, no need to do anything. The code below yours will do the rest.