mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
fix(figure): subplot methods consolidated; added subplot factory
This commit is contained in:
@ -10,7 +10,7 @@ from bec_widgets.cli.client import BECFigure, BECImageShow, BECMotorMap, BECWave
|
||||
def test_rpc_waveform1d_custom_curve(rpc_server_figure):
|
||||
fig = BECFigure(rpc_server_figure)
|
||||
|
||||
ax = fig.add_plot()
|
||||
ax = fig.plot()
|
||||
curve = ax.plot(x=[1, 2, 3], y=[1, 2, 3])
|
||||
curve.set_color("red")
|
||||
curve = ax.curves[0]
|
||||
@ -26,7 +26,7 @@ def test_rpc_plotting_shortcuts_init_configs(rpc_server_figure, qtbot):
|
||||
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(x_name="samx", y_name="samy", z_name="bpm4i")
|
||||
plt_z = fig.plot(x_name="samx", y_name="samy", z_name="bpm4i", new=True)
|
||||
|
||||
# Checking if classes are correctly initialised
|
||||
assert len(fig.widgets) == 4
|
||||
|
@ -9,7 +9,7 @@ def test_rpc_register_list_connections(rpc_server_figure):
|
||||
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(x_name="samx", y_name="samy", z_name="bpm4i")
|
||||
plt_z = fig.plot(x_name="samx", y_name="samy", z_name="bpm4i", new=True)
|
||||
|
||||
# keep only class names from objects, since objects on server and client are different
|
||||
# so the best we can do is to compare types (rpc register is unit-tested elsewhere)
|
||||
|
@ -11,7 +11,7 @@ from .test_bec_figure import bec_figure
|
||||
|
||||
|
||||
def test_adding_curve_to_waveform(bec_figure):
|
||||
w1 = bec_figure.add_plot()
|
||||
w1 = bec_figure.plot()
|
||||
|
||||
# adding curve which is in bec - only names
|
||||
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i")
|
||||
@ -39,7 +39,7 @@ def test_adding_curve_to_waveform(bec_figure):
|
||||
|
||||
|
||||
def test_adding_curve_with_same_id(bec_figure):
|
||||
w1 = bec_figure.add_plot()
|
||||
w1 = bec_figure.plot()
|
||||
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i", gui_id="test_curve")
|
||||
|
||||
with pytest.raises(ValueError) as excinfo:
|
||||
@ -122,9 +122,10 @@ def test_create_waveform1D_by_config(bec_figure):
|
||||
},
|
||||
}
|
||||
|
||||
w1 = bec_figure.add_plot(config=w1_config_input)
|
||||
w1 = bec_figure.plot(config=w1_config_input)
|
||||
|
||||
w1_config_output = w1.get_config()
|
||||
w1_config_input["gui_id"] = w1.gui_id
|
||||
|
||||
assert w1_config_input == w1_config_output
|
||||
assert w1.plot_item.titleLabel.text == "Widget 1"
|
||||
@ -132,7 +133,7 @@ def test_create_waveform1D_by_config(bec_figure):
|
||||
|
||||
|
||||
def test_change_gui_id(bec_figure):
|
||||
w1 = bec_figure.add_plot()
|
||||
w1 = bec_figure.plot()
|
||||
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i")
|
||||
w1.change_gui_id("new_id")
|
||||
|
||||
@ -141,7 +142,7 @@ def test_change_gui_id(bec_figure):
|
||||
|
||||
|
||||
def test_getting_curve(bec_figure):
|
||||
w1 = bec_figure.add_plot()
|
||||
w1 = bec_figure.plot()
|
||||
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i", gui_id="test_curve")
|
||||
c1_expected_config = CurveConfig(
|
||||
widget_class="BECCurve",
|
||||
@ -171,7 +172,7 @@ def test_getting_curve(bec_figure):
|
||||
|
||||
|
||||
def test_getting_curve_errors(bec_figure):
|
||||
w1 = bec_figure.add_plot()
|
||||
w1 = bec_figure.plot()
|
||||
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i", gui_id="test_curve")
|
||||
|
||||
with pytest.raises(ValueError) as excinfo:
|
||||
@ -188,7 +189,7 @@ def test_getting_curve_errors(bec_figure):
|
||||
|
||||
|
||||
def test_add_curve(bec_figure):
|
||||
w1 = bec_figure.add_plot()
|
||||
w1 = bec_figure.plot()
|
||||
|
||||
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i")
|
||||
|
||||
@ -199,7 +200,7 @@ def test_add_curve(bec_figure):
|
||||
|
||||
|
||||
def test_change_legend_font_size(bec_figure):
|
||||
plot = bec_figure.add_plot()
|
||||
plot = bec_figure.plot()
|
||||
|
||||
w1 = plot.add_curve_scan(x_name="samx", y_name="bpm4i")
|
||||
my_func = plot.plot_item.legend
|
||||
@ -211,7 +212,7 @@ def test_change_legend_font_size(bec_figure):
|
||||
|
||||
|
||||
def test_remove_curve(bec_figure):
|
||||
w1 = bec_figure.add_plot()
|
||||
w1 = bec_figure.plot()
|
||||
|
||||
w1.add_curve_scan(x_name="samx", y_name="bpm4i")
|
||||
w1.add_curve_scan(x_name="samx", y_name="bpm3a")
|
||||
@ -229,7 +230,7 @@ def test_remove_curve(bec_figure):
|
||||
|
||||
|
||||
def test_change_curve_appearance_methods(bec_figure, qtbot):
|
||||
w1 = bec_figure.add_plot()
|
||||
w1 = bec_figure.plot()
|
||||
|
||||
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i")
|
||||
|
||||
@ -258,7 +259,7 @@ def test_change_curve_appearance_methods(bec_figure, qtbot):
|
||||
|
||||
|
||||
def test_change_curve_appearance_args(bec_figure):
|
||||
w1 = bec_figure.add_plot()
|
||||
w1 = bec_figure.plot()
|
||||
|
||||
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i")
|
||||
|
||||
@ -288,7 +289,7 @@ def test_change_curve_appearance_args(bec_figure):
|
||||
|
||||
|
||||
def test_set_custom_curve_data(bec_figure, qtbot):
|
||||
w1 = bec_figure.add_plot()
|
||||
w1 = bec_figure.plot()
|
||||
|
||||
c1 = w1.add_curve_custom(
|
||||
x=[1, 2, 3],
|
||||
@ -336,7 +337,7 @@ def test_custom_data_2D_array(bec_figure, qtbot):
|
||||
|
||||
|
||||
def test_get_all_data(bec_figure):
|
||||
w1 = bec_figure.add_plot()
|
||||
w1 = bec_figure.plot()
|
||||
|
||||
c1 = w1.add_curve_custom(
|
||||
x=[1, 2, 3],
|
||||
@ -371,7 +372,7 @@ def test_get_all_data(bec_figure):
|
||||
|
||||
|
||||
def test_curve_add_by_config(bec_figure):
|
||||
w1 = bec_figure.add_plot()
|
||||
w1 = bec_figure.plot()
|
||||
|
||||
c1_config_input = {
|
||||
"widget_class": "BECCurve",
|
||||
@ -411,7 +412,7 @@ def test_curve_add_by_config(bec_figure):
|
||||
|
||||
|
||||
def test_scan_update(bec_figure, qtbot):
|
||||
w1 = bec_figure.add_plot()
|
||||
w1 = bec_figure.plot()
|
||||
|
||||
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i")
|
||||
|
||||
@ -445,7 +446,7 @@ def test_scan_update(bec_figure, qtbot):
|
||||
|
||||
|
||||
def test_scan_history_with_val_access(bec_figure, qtbot):
|
||||
w1 = bec_figure.add_plot()
|
||||
w1 = bec_figure.plot()
|
||||
|
||||
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i")
|
||||
|
||||
@ -470,7 +471,7 @@ def test_scan_history_with_val_access(bec_figure, qtbot):
|
||||
|
||||
|
||||
def test_scatter_2d_update(bec_figure, qtbot):
|
||||
w1 = bec_figure.add_plot()
|
||||
w1 = bec_figure.plot()
|
||||
|
||||
c1 = w1.add_curve_scan(x_name="samx", y_name="samx", z_name="bpm4i")
|
||||
|
||||
|
Reference in New Issue
Block a user