Commit 77f07ab9 authored by Matias Guijarro's avatar Matias Guijarro
Browse files

test: added test of acq. mode for SamplingCounter

parent 0f570fc5
......@@ -8,6 +8,7 @@
import pytest
import numpy
from bliss.common.measurement import SamplingCounter, IntegratingCounter
from bliss.common.scans import loopscan
class Diode(SamplingCounter):
......@@ -84,6 +85,30 @@ def test_diode_with_controller(beacon):
assert diode.raw_value * 2 == diode_value
def test_sampling_counter_acquisition_device_mode(beacon):
diode = beacon.get("diode")
values = []
def f(x):
values.append(x)
return x
test_diode = Diode(diode, f)
# USING DEFAULT MODE
assert test_diode.acquisition_device_mode is None
s = loopscan(1, 0.1, test_diode)
assert s.acq_chain.nodes_list[1].mode.name == "SIMPLE_AVERAGE"
assert s.get_data()["test_diode"] == pytest.approx(sum(values) / len(values))
# UPDATING THE MODE
values = []
test_diode.acquisition_device_mode = "INTEGRATE"
s = loopscan(1, 0.1, test_diode)
assert s.acq_chain.nodes_list[1].mode.name == "INTEGRATE"
assert s.get_data()["test_diode"] == pytest.approx(sum(values) * 0.1 / len(values))
def test_integ_counter(beacon):
acq_controller = AcquisitionController()
......
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