Commit 9394e0b4 authored by Projects's avatar Projects

test/pulse_rejection: updated to the new version of PyBECO

parent 787cb3a0
......@@ -12,7 +12,7 @@ import sys
import time
sys.path.append("../PyBECO")
from PyBECO.boards import PyConvTTL, PyConvTTLException
from PyBECO.boards import PyConvTTLBLO, PyConvTTLException
from PyBECO.fec import Elma, ElmaException
# crate credentials
......@@ -27,7 +27,8 @@ slot = int(input("Slot number: "))
cooldown_time = 20 # number seconds of cool down time between tests
elma = Elma(address, user, password)
convttl = PyConvTTL(slot, elma)
convttl = PyConvTTLBLO(slot, elma)
convttl.reset()
# display status
print(convttl.status)
......@@ -45,6 +46,7 @@ if convttl.status.gw_version[0] != 4:
if(convttl.status.switch[1]):
# short pulse
print("Running short pulse tests")
tests = (
{'freq': 2000000, 'seconds': 1},
{'freq': 1333333, 'seconds': 6.5},
......@@ -78,7 +80,7 @@ for test in tests:
# test if the guaranteed number of pulses is repeated
# clear counters
for ch in range(1, 7):
for ch in convttl.CHANNELS:
convttl.pulse_counter_set(ch, (0, 0))
# clear errors (including missed pulse flags)
......@@ -100,9 +102,10 @@ for test in tests:
old_counters = convttl.pulse_counters
for ch in range(1, 7):
pulse_missed_errors = (convttl.ERRORS_MASK_FLIM_MISSED(ch),
convttl.ERRORS_MASK_FWDG_MISSED(ch))
for ch in convttl.CHANNELS:
# set of missed pulse error flags for this channel
pulse_missed_errors = (convttl.error.ERRORS_MASK_FLIM_MISSED(ch),
convttl.error.ERRORS_MASK_FWDG_MISSED(ch))
if old_counters[ch - 1][0] != 0 and old_counters[ch - 1][1] != 0:
print("WARNING: Both pulse counters are increasing, check if it is ok")
......@@ -133,7 +136,7 @@ for test in tests:
continue # are meant to repeat pulses without rejecting any
# clear counters
for ch in range(1, 7):
for ch in convttl.CHANNELS:
convttl.pulse_counter_set(ch, (0, 0))
# clear errors (including missed pulse flags)
......@@ -149,7 +152,7 @@ for test in tests:
print("Pulse counters:")
test_run = True
passed = [False for _ in range(6)] # passed test flags for each channel
passed = [False for _ in convttl.CHANNELS] # passed test flags for each channel
# test if pulses are rejected after a certain threshold
while(test_run):
......@@ -173,8 +176,12 @@ for test in tests:
print("TEST FAILED: channel %d missed a pulse too early (%d)" % (ch, pulse_count))
sys.exit(2)
elif not passed[ch - 1]:
print("TEST PASSED: rejected %d pulse at channel %d" % (pulse_count, ch))
passed[ch - 1] = True
if convttl.error.ERRORS_MASK_FLIM_MISSED(ch) & errors:
print("TEST FAILED: pulse rejected on channel %d, but FLIM_MISSED bit is set" % (ch))
sys.exit(2)
else:
print("TEST PASSED: rejected %d pulse on channel %d" % (pulse_count, ch))
passed[ch - 1] = True
# even if the test was passed, wait for the end of current pulse burst
if(pulse_count >= pulses * 2):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment