Commit b3835bb5 authored by Vincent Michel's avatar Vincent Michel
Browse files

Update statistics namedtuple

parent 5b464506
......@@ -27,7 +27,8 @@ PresetMode = enum.Enum(
Stats = collections.namedtuple(
'Stats',
'realtime livetime triggers events icr ocr deadtime')
'realtime livetime triggers events icr ocr deadtime '
'underflows overflows')
# Base class
......@@ -98,7 +99,7 @@ class BaseMCA(object):
raise NotImplementedError
# Acquisition number (number of points in acquisition)
@property
def acquisition_number(self):
raise NotImplementedError
......
......@@ -78,7 +78,7 @@ def test_base_mca():
def test_base_mca_logic(mocker):
stats = Stats(*range(1, 8))
stats = Stats(*range(1, 10))
class TestMCA(BaseMCA):
......
......@@ -106,7 +106,6 @@ def test_mercury_acquisition_number(mercury):
mercury.acquisition_number == 1
client.get_acquisition_value.assert_called_once_with('mapping_mode', 0)
# Error tests
with pytest.raises(ValueError):
mercury.set_acquisition_number(0)
......@@ -117,8 +116,8 @@ def test_mercury_acquisition(mercury, mocker):
sleep = mocker.patch('time.sleep')
sleep.side_effect = lambda x: client.mock_not_running()
client.get_spectrums.return_value = {0: [3, 2, 1]}
client.get_statistics.return_value = {0: range(7)}
stats = Stats(*range(7))
client.get_statistics.return_value = {0: range(9)}
stats = Stats(*range(9))
assert mercury.run_single_acquisition(3.) == ([[3, 2, 1]], [stats])
sleep.assert_called_once_with(0.1)
......
Supports Markdown
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