Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bliss
python-handel
Commits
184ff884
Commit
184ff884
authored
Sep 19, 2017
by
Vincent Michel
Browse files
Add underflows and overflows to the stats
parent
8d4dc6ef
Pipeline
#1030
passed with stages
in 1 minute and 18 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
handel/interface.py
View file @
184ff884
...
...
@@ -36,7 +36,9 @@ MAX_STRING_LENGTH = 80
# Helpers
Stats
=
namedtuple
(
'Stats'
,
'realtime livetime triggers events icr ocr deadtime'
)
'Stats'
,
'realtime livetime triggers events icr ocr deadtime '
'underflows overflows'
)
def
stats_from_buffer
(
array
):
...
...
@@ -68,7 +70,9 @@ def stats_from_buffer(array):
# Prospect uses 0% so 0. it is.
deadtime
=
1
-
float
(
ocr
)
/
icr
if
icr
!=
0
else
0.
return
Stats
(
realtime
,
livetime
,
triggers
,
events
,
icr
,
ocr
,
deadtime
)
return
Stats
(
realtime
,
livetime
,
triggers
,
events
,
icr
,
ocr
,
deadtime
,
underflows
,
overflows
)
def
to_bytes
(
arg
):
...
...
tests/test_interface.py
View file @
184ff884
...
...
@@ -285,9 +285,9 @@ def test_get_module_statistics(interface):
3088.
,
2742.
,
3131.720827046904
,
272
1
.3
508253533
51
,
0
.
,
0
.
]
272
4
.3
282332585
51
3
,
1
.
,
2
.
]
expected
=
{
8
:
interface
.
Stats
(
1.00758784
,
...
...
@@ -295,8 +295,10 @@ def test_get_module_statistics(interface):
3088
,
2742
,
3131.720827046904
,
2721.350825353351
,
0.13103658479051494
)}
2724.3282332585513
,
0.1300858589533055
,
1
,
2
)}
m
.
side_effect
=
side_effect
with
mock
.
patch
(
'handel.interface.get_module_channels'
)
as
m2
:
...
...
@@ -314,7 +316,7 @@ def test_get_module_statistics(interface):
assert
ctx
[
0
].
message
.
args
[
0
].
startswith
(
'ICR buffer inconsistency: 4.56 != 3131.7208'
)
assert
ctx
[
1
].
message
.
args
[
0
].
startswith
(
'OCR buffer inconsistency: 1.23 != 272
1
.3
508
'
)
'OCR buffer inconsistency: 1.23 != 272
4
.3
282
'
)
# Make sure errors have been checked
interface
.
check_error
.
assert_called_with
(
0
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment