mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
test(rest_rpc_motor_map): fix position comparison, flaky due to mm.precision vs motor precision
This commit is contained in:
@ -147,8 +147,8 @@ def test_rpc_motor_map(qtbot, bec_client_lib, connected_client_gui_obj):
|
|||||||
motor_map = dock.new("mm_dock").new("MotorMap")
|
motor_map = dock.new("mm_dock").new("MotorMap")
|
||||||
motor_map.map(x_name="samx", y_name="samy")
|
motor_map.map(x_name="samx", y_name="samy")
|
||||||
|
|
||||||
initial_pos_x = dev.samx.read()["samx"]["value"]
|
initial_pos_x = dev.samx.read(cached=False)["samx"]["value"]
|
||||||
initial_pos_y = dev.samy.read()["samy"]["value"]
|
initial_pos_y = dev.samy.read(cached=False)["samy"]["value"]
|
||||||
|
|
||||||
status = scans.mv(dev.samx, 1, dev.samy, 2, relative=True)
|
status = scans.mv(dev.samx, 1, dev.samy, 2, relative=True)
|
||||||
status.wait()
|
status.wait()
|
||||||
@ -159,11 +159,15 @@ def test_rpc_motor_map(qtbot, bec_client_lib, connected_client_gui_obj):
|
|||||||
# check plotted data
|
# check plotted data
|
||||||
motor_map_data = motor_map.get_data()
|
motor_map_data = motor_map.get_data()
|
||||||
|
|
||||||
np.testing.assert_equal(
|
np.testing.assert_allclose(
|
||||||
[motor_map_data["x"][0], motor_map_data["y"][0]], [initial_pos_x, initial_pos_y]
|
[motor_map_data["x"][0], motor_map_data["y"][0]],
|
||||||
|
[initial_pos_x, initial_pos_y],
|
||||||
|
atol=motor_map.precision,
|
||||||
)
|
)
|
||||||
np.testing.assert_equal(
|
np.testing.assert_allclose(
|
||||||
[motor_map_data["x"][-1], motor_map_data["y"][-1]], [final_pos_x, final_pos_y]
|
[motor_map_data["x"][-1], motor_map_data["y"][-1]],
|
||||||
|
[final_pos_x, final_pos_y],
|
||||||
|
atol=motor_map.precision,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user