Closedown
This commit is contained in:
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
#TestingList for pshell: configuration properties
|
||||
#Fri Aug 25 16:26:30 CEST 2017
|
||||
#Fri Aug 25 16:54:39 CEST 2017
|
||||
customPanel=
|
||||
showEnabledTestsOnly=true
|
||||
listFilter=test-bx84
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Fri Aug 25 16:17:00 CEST 2017
|
||||
#Fri Aug 25 16:45:24 CEST 2017
|
||||
name=rightleft
|
||||
parameters=delay\:.2\:delay between 2 steps;centre\:2\:centre where to move around;moveAround\:4.5\:move right and left from centre;steps\:.1\:steps of each move;
|
||||
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;
|
||||
description=move around a value and plot the result
|
||||
|
||||
@@ -84,25 +84,33 @@ def startTest(testName, DEVICE, params):
|
||||
# initialise plot tab with 2 plots: pass here the axis names:
|
||||
scan = ManualScan(['sample'], ['Status (sta)', 'Position (VAL)'])
|
||||
# set plot name(tab title):
|
||||
scan.setPlotTitle(test.getPlotName())
|
||||
plotName = test.getPlotName()
|
||||
scan.setPlotTitle(plotName)
|
||||
# start plots. See further below how to add points to the plots (scan):
|
||||
scan.start()
|
||||
|
||||
#in this example we initialise also a plot type to show how to add several curves on the same plot
|
||||
p1 = plot(None,name="motor_sta", title = plotName + " Multi curves")[0]
|
||||
#opionally set plot ranges
|
||||
#p1.getAxis(p1.AxisId.X).setRange(0.0,80.0)
|
||||
#p1.getAxis(p1.AxisId.Y).setRange(0.0,70.0)
|
||||
p1.addSeries(LinePlotSeries("motor_val"))
|
||||
# inject a sinus into the plot, as example
|
||||
from math import sin
|
||||
motor_sta = 0
|
||||
motor_val = 0
|
||||
# take 100 samples of a sinus and a jigsaw plot them:
|
||||
for sample in range(0, 100):
|
||||
for sample in range(int(-moveAround), int(moveAround), int(steps)):
|
||||
readback1 = sample #the x axis.
|
||||
sleep(delay) # settling time.
|
||||
# get value (it is translated to a caget):
|
||||
motor_sta = motor_sta + +1
|
||||
if motor_sta > 50:
|
||||
motor_sta = 0
|
||||
motor_val = motor_val + +1
|
||||
if motor_val > 50:
|
||||
motor_val = 0
|
||||
# get value:
|
||||
motor_val = sin(float(sample)/10.0)*10.0-10.0
|
||||
motor_sta = sin(float(readback1)/10.0)*10.0-10.0
|
||||
# add values to plot:
|
||||
scan.append([readback1], [readback1], [motor_sta, motor_val])
|
||||
#scan.append([readback1], [readback1], [motor_sta, motor_val])
|
||||
# add values to 2 colour plot
|
||||
p1.getSeries(0).appendData(motor_val, motor_sta)
|
||||
|
||||
# now try with data from real device: this part will most probably fail: correct the PV names with existing ones.
|
||||
try:
|
||||
@@ -120,15 +128,17 @@ 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(0, 100):
|
||||
for sample in range(int(moveAround), int(-moveAround), int(-steps)):
|
||||
readback1 = sample #the x axis.
|
||||
sleep(delay) # settling time.
|
||||
# get value:
|
||||
motor_val = pv_motor_val.put(sample)
|
||||
motor_val = pv_motor_val.put(float(readback1))
|
||||
# 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])
|
||||
#scan.append([readback1], [readback1], [motor_sta, motor_val])
|
||||
# 2 colour plot
|
||||
p1.getSeries(1).appendData(float(motor_val), float(motor_sta))
|
||||
|
||||
# Closing channels: all channels that were opened with Channel() must be closed before exit:
|
||||
pv_motor_sta.close()
|
||||
|
||||
Reference in New Issue
Block a user