mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
feat(figure): changes to support direct plot functionality
This commit is contained in:
@ -38,7 +38,7 @@ def test_rpc_add_dock_with_figure_e2e(rpc_server_dock, qtbot):
|
||||
assert fig2.__class__ == BECFigure
|
||||
|
||||
mm = fig0.motor_map("samx", "samy")
|
||||
plt = fig1.plot("samx", "bpm4i")
|
||||
plt = fig1.plot(x_name="samx", y_name="bpm4i")
|
||||
im = fig2.image("eiger")
|
||||
|
||||
assert mm.__class__.__name__ == "BECMotorMap"
|
||||
|
@ -23,7 +23,7 @@ def test_rpc_plotting_shortcuts_init_configs(rpc_server_figure, qtbot):
|
||||
fig = BECFigure(rpc_server_figure.gui_id)
|
||||
fig_server = rpc_server_figure.gui
|
||||
|
||||
plt = fig.plot("samx", "bpm4i")
|
||||
plt = fig.plot(x_name="samx", y_name="bpm4i")
|
||||
im = fig.image("eiger")
|
||||
motor_map = fig.motor_map("samx", "samy")
|
||||
plt_z = fig.add_plot("samx", "samy", "bpm4i")
|
||||
@ -79,9 +79,9 @@ def test_rpc_waveform_scan(rpc_server_figure, qtbot):
|
||||
fig = BECFigure(rpc_server_figure.gui_id)
|
||||
|
||||
# add 3 different curves to track
|
||||
plt = fig.plot("samx", "bpm4i")
|
||||
fig.plot("samx", "bpm3a")
|
||||
fig.plot("samx", "bpm4d")
|
||||
plt = fig.plot(x_name="samx", y_name="bpm4i")
|
||||
fig.plot(x_name="samx", y_name="bpm3a")
|
||||
fig.plot(x_name="samx", y_name="bpm4d")
|
||||
|
||||
client = rpc_server_figure.client
|
||||
dev = client.device_manager.devices
|
||||
|
@ -22,7 +22,7 @@ def test_rpc_register_list_connections(rpc_server_figure, rpc_register, qtbot):
|
||||
fig = BECFigure(rpc_server_figure.gui_id)
|
||||
fig_server = rpc_server_figure.gui
|
||||
|
||||
plt = fig.plot("samx", "bpm4i")
|
||||
plt = fig.plot(x_name="samx", y_name="bpm4i")
|
||||
im = fig.image("eiger")
|
||||
motor_map = fig.motor_map("samx", "samy")
|
||||
plt_z = fig.add_plot("samx", "samy", "bpm4i")
|
||||
|
@ -59,7 +59,7 @@ def test_bec_dock_area_add_remove_dock(bec_dock_area, qtbot):
|
||||
def test_add_remove_bec_figure_to_dock(bec_dock_area):
|
||||
d0 = bec_dock_area.add_dock()
|
||||
fig = d0.add_widget_bec("BECFigure")
|
||||
plt = fig.plot("samx", "bpm4i")
|
||||
plt = fig.plot(x_name="samx", y_name="bpm4i")
|
||||
im = fig.image("eiger")
|
||||
mm = fig.motor_map("samx", "samy")
|
||||
|
||||
|
@ -65,7 +65,7 @@ def test_bec_figure_add_remove_plot(bec_figure):
|
||||
|
||||
|
||||
def test_add_different_types_of_widgets(bec_figure):
|
||||
plt = bec_figure.plot("samx", "bpm4i")
|
||||
plt = bec_figure.plot(x_name="samx", y_name="bpm4i")
|
||||
im = bec_figure.image("eiger")
|
||||
motor_map = bec_figure.motor_map("samx", "samy")
|
||||
|
||||
@ -228,7 +228,7 @@ def test_clear_all(bec_figure):
|
||||
|
||||
|
||||
def test_shortcuts(bec_figure):
|
||||
plt = bec_figure.plot("samx", "bpm4i")
|
||||
plt = bec_figure.plot(x_name="samx", y_name="bpm4i")
|
||||
im = bec_figure.image("eiger")
|
||||
motor_map = bec_figure.motor_map("samx", "samy")
|
||||
|
||||
|
@ -304,6 +304,18 @@ def test_set_custom_curve_data(bec_figure, qtbot):
|
||||
assert np.array_equal(y_new, [7, 8, 9])
|
||||
|
||||
|
||||
def test_custom_data_2D_array(bec_figure, qtbot):
|
||||
|
||||
data = np.random.rand(10, 2)
|
||||
|
||||
plt = bec_figure.plot(data)
|
||||
|
||||
x, y = plt.curves[0].get_data()
|
||||
|
||||
assert np.array_equal(x, data[:, 0])
|
||||
assert np.array_equal(y, data[:, 1])
|
||||
|
||||
|
||||
def test_get_all_data(bec_figure):
|
||||
w1 = bec_figure.add_plot()
|
||||
|
||||
|
Reference in New Issue
Block a user