Commit 5ff3bc00 authored by Projects's avatar Projects

tests/pulse_rejection: read first the error reg and then counters

parent be9188fc
...@@ -101,23 +101,25 @@ for test in tests: ...@@ -101,23 +101,25 @@ for test in tests:
# test if all pulses pass through # test if all pulses pass through
while(test_run): while(test_run):
if(old_counters != convttl.pulse_counters): errors = convttl.error.error_reg
print(convttl.pulse_counters) counters = convttl.pulse_counters
old_counters = convttl.pulse_counters if(old_counters != counters):
print(counters)
old_counters = counters
for ch in convttl.CHANNELS: for ch in convttl.CHANNELS:
# set of missed pulse error flags for this channel # set of missed pulse error flags for this channel
pulse_missed_errors = (convttl.error.ERRORS_MASK_FLIM_MISSED(ch), pulse_missed_errors = (convttl.error.ERRORS_MASK_FLIM_MISSED(ch),
convttl.error.ERRORS_MASK_FWDG_MISSED(ch)) convttl.error.ERRORS_MASK_FWDG_MISSED(ch))
if old_counters[ch - 1][0] != 0 and old_counters[ch - 1][1] != 0: if counters[ch - 1][0] != 0 and counters[ch - 1][1] != 0:
print("WARNING: Both pulse counters are increasing, check if it is ok") print("WARNING: Both pulse counters are increasing, check if it is ok")
pulse_count = max(old_counters[ch - 1]) pulse_count = max(old_counters[ch - 1])
# check if there were any pulses missed # check if there were any pulses missed
if any(error in convttl.error for error in pulse_missed_errors): if any(error_bit & errors for error_bit in pulse_missed_errors):
if(pulse_count <= pulses): if(pulse_count <= pulses):
print("TEST FAILED: channel %d missed a pulse (%d)" % (ch, pulse_count)) print("TEST FAILED: channel %d missed a pulse (%d)" % (ch, pulse_count))
sys.exit(2) sys.exit(2)
...@@ -160,14 +162,17 @@ for test in tests: ...@@ -160,14 +162,17 @@ for test in tests:
# test if pulses are rejected after a certain threshold # test if pulses are rejected after a certain threshold
while(test_run): while(test_run):
errors = convttl.error.error_reg
counters = convttl.pulse_counters
if(old_counters != convttl.pulse_counters): if(old_counters != counters):
print(convttl.pulse_counters) print(counters)
old_counters = counters
old_counters = convttl.pulse_counters
for ch in range(1, 7): for ch in convttl.CHANNELS:
pulse_missed_errors = (convttl.ERRORS_MASK_FLIM_MISSED(ch), convttl.ERRORS_MASK_FWDG_MISSED(ch)) # 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: 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") print("WARNING: Both pulse counters are increasing, check if it is ok")
...@@ -175,7 +180,7 @@ for test in tests: ...@@ -175,7 +180,7 @@ for test in tests:
pulse_count = max(old_counters[ch - 1]) pulse_count = max(old_counters[ch - 1])
# check if there were any pulses missed # check if there were any pulses missed
if any(error in convttl.error for error in pulse_missed_errors): if any(error_bit & errors for error_bit in pulse_missed_errors):
if(pulse_count <= pulses): if(pulse_count <= pulses):
print("TEST FAILED: channel %d missed a pulse too early (%d)" % (ch, pulse_count)) print("TEST FAILED: channel %d missed a pulse too early (%d)" % (ch, pulse_count))
sys.exit(2) sys.exit(2)
...@@ -189,7 +194,7 @@ for test in tests: ...@@ -189,7 +194,7 @@ for test in tests:
# even if the test was passed, wait for the end of current pulse burst # even if the test was passed, wait for the end of current pulse burst
if(pulse_count >= pulses * 2): if(pulse_count >= pulses * 2):
if not any(error in convttl.error for error in pulse_missed_errors): if not any(error & errors for error in pulse_missed_errors):
print("TEST FAILED: repeated %d pulses, none rejected" % (pulse_count)) print("TEST FAILED: repeated %d pulses, none rejected" % (pulse_count))
sys.exit(2) sys.exit(2)
test_run = False test_run = False
......
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