Improved documentation
This commit is contained in:
@@ -79,43 +79,47 @@ def startTest(testName, DEVICE, params):
|
||||
return
|
||||
|
||||
# loop to read channels for a while and plot the channels values.
|
||||
# initialise plot tab with 2 plots: pass here the axis names.
|
||||
# initialise plot tab with 2 plots: pass here the axis names:
|
||||
scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'])
|
||||
# set plot name(tab title).
|
||||
# set plot name(tab title):
|
||||
scan.setPlotName(plotName)
|
||||
# start plots. See further below how to add points to the plots (scan).
|
||||
# start plots. See further below how to add points to the plots (scan):
|
||||
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:
|
||||
# set up connection to channels. "type" of data can be "d" (= double), "l" (= long).
|
||||
pv_motor_msta = Channel(DEVICE + ':MOTOR.MSTA', type='d')
|
||||
pv_motor_val = Channel(DEVICE + ':MOTOR.VAL', type='d')
|
||||
pv_motor_val = Channel(DEVICE + ':MOTOR.VAL' , type='d')
|
||||
pv_motor_com = Channel(DEVICE + ':COM:2' , type='d')
|
||||
except:
|
||||
# prepare return information: return text.
|
||||
# prepare return information: return text:
|
||||
ret = 'Unable to create channel - ' + traceback.format_exc()
|
||||
# prepare return information: return success.
|
||||
# prepare return information: return success:
|
||||
success = False
|
||||
# send return information.
|
||||
# send return information:
|
||||
test.sendFeedback(ret, success)
|
||||
return
|
||||
# take 100 samples of the channels and plot them.
|
||||
# send a command to a channel (it is translated to a caput):
|
||||
pv_motor_com.put(1, timeout=None) # optionally, a timeout can be given.
|
||||
# take 100 samples of the channels and plot them:
|
||||
for sample in range(0, 100):
|
||||
readback1 = sample #the x axis.
|
||||
sleep(0.1) # Settling time.
|
||||
# get value.
|
||||
sleep(0.1) # settling time.
|
||||
# get value (it is translated to a caget):
|
||||
motor_msta = pv_motor_msta.get()
|
||||
# get value.
|
||||
# get value:
|
||||
motor_val = pv_motor_val.get()
|
||||
# add values to plot.
|
||||
# add values to plot:
|
||||
scan.append([readback1], [readback1], [motor_msta, motor_val])
|
||||
|
||||
# Closing channels: all channels that were opened with Channel() must be closed before exit.
|
||||
# Closing channels: all channels that were opened with Channel() must be closed before exit:
|
||||
pv_motor_msta.close()
|
||||
pv_motor_val.close()
|
||||
pv_motor_com.close()
|
||||
|
||||
# IMPORTANT: if the test was successful, write the report into the variables ret and success.
|
||||
# for example, write the following:
|
||||
@@ -147,4 +151,5 @@ startTest(test, device, parameters)
|
||||
|
||||
################ END OF Final ####################
|
||||
#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW ####
|
||||
# Indent to end left
|
||||
# def yourCustomFunction:
|
||||
|
||||
Reference in New Issue
Block a user