Commit 8158074a authored by Valentin Valls's avatar Valentin Valls
Browse files

Make test_iter_software_position_trigger_master more stable

parent 4adec061
Pipeline #48907 passed with stages
in 102 minutes and 25 seconds
...@@ -83,13 +83,13 @@ def test_software_position_trigger_master(session): ...@@ -83,13 +83,13 @@ def test_software_position_trigger_master(session):
assert data["debug_time"] == pytest.approx(expected_triggers, abs=0.02) assert data["debug_time"] == pytest.approx(expected_triggers, abs=0.02)
@pytest.mark.flaky(reruns=3)
def test_iter_software_position_trigger_master(session): def test_iter_software_position_trigger_master(session):
robz = session.config.get("robz") robz = session.config.get("robz")
robz.velocity = 100 robz.velocity = 100
chain = AcquisitionChain() chain = AcquisitionChain()
start_pos = [0, 12, 24] start_pos = [0, 12, 24]
master = SoftwarePositionTriggerMaster(robz, start_pos, 30, 10, time=0.5) end_pos = 30
master = SoftwarePositionTriggerMaster(robz, start_pos, end_pos, 10, time=0.5)
device = DebugMotorMockupAcquisitionSlave("debug", robz) device = DebugMotorMockupAcquisitionSlave("debug", robz)
chain.add(master, device) chain.add(master, device)
s = Scan(chain, save=False) s = Scan(chain, save=False)
...@@ -98,7 +98,13 @@ def test_iter_software_position_trigger_master(session): ...@@ -98,7 +98,13 @@ def test_iter_software_position_trigger_master(session):
data = s.get_data() data = s.get_data()
assert len(data["robz"]) == 25 assert len(data["robz"]) == 25
assert data["robz"] == pytest.approx(data["debug_pos"], abs=0.2)
assert data["robz"] == pytest.approx(
data["debug_pos"], abs=((end_pos - start_pos[0]) / 10) * 0.5
)
error = numpy.abs(data["robz"] - data["debug_pos"])
assert numpy.median(error) < 0.1, error
assert len(data["debug_time"]) == len(data["robz"]) assert len(data["debug_time"]) == len(data["robz"])
assert list(master._positions) == list( assert list(master._positions) == list(
numpy.linspace(24, 30, master._SoftwarePositionTriggerMaster__last_npoints + 1)[ numpy.linspace(24, 30, master._SoftwarePositionTriggerMaster__last_npoints + 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