0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 11:41:49 +02:00

fix(waveform_widget): plot API unified with BECFigure

This commit is contained in:
2024-07-19 16:03:48 +02:00
parent 50135b5fe9
commit 2c8764a27d
3 changed files with 7 additions and 0 deletions

View File

@ -1844,6 +1844,7 @@ class BECWaveformWidget(RPCBase):
@rpc_call
def plot(
self,
arg1: "list | np.ndarray | str | None" = None,
x: "list | np.ndarray | None" = None,
y: "list | np.ndarray | None" = None,
x_name: "str | None" = None,
@ -1862,6 +1863,7 @@ class BECWaveformWidget(RPCBase):
"""
Plot a curve to the plot widget.
Args:
arg1(list | np.ndarray | str | None): First argument which can be x data(list | np.ndarray), y data(list | np.ndarray), or y_name(str).
x(list | np.ndarray): Custom x data to plot.
y(list | np.ndarray): Custom y data to plot.
x_name(str): The name of the device for the x-axis.

View File

@ -204,6 +204,7 @@ class BECWaveformWidget(BECWidget, QWidget):
@SafeSlot(popup_error=True)
def plot(
self,
arg1: list | np.ndarray | str | None = None,
x: list | np.ndarray | None = None,
y: list | np.ndarray | None = None,
x_name: str | None = None,
@ -222,6 +223,7 @@ class BECWaveformWidget(BECWidget, QWidget):
"""
Plot a curve to the plot widget.
Args:
arg1(list | np.ndarray | str | None): First argument which can be x data(list | np.ndarray), y data(list | np.ndarray), or y_name(str).
x(list | np.ndarray): Custom x data to plot.
y(list | np.ndarray): Custom y data to plot.
x_name(str): The name of the device for the x-axis.
@ -241,6 +243,7 @@ class BECWaveformWidget(BECWidget, QWidget):
"""
# self._check_if_scans_have_same_x(enabled=True, x_name_to_check=x_name)
return self.waveform.plot(
arg1=arg1,
x=x,
y=y,
x_name=x_name,

View File

@ -54,6 +54,7 @@ def test_waveform_widget_set_x(waveform_widget, mock_waveform):
def test_waveform_plot_data(waveform_widget, mock_waveform):
waveform_widget.plot(x=[1, 2, 3], y=[1, 2, 3])
waveform_widget.waveform.plot.assert_called_once_with(
arg1=None,
x=[1, 2, 3],
y=[1, 2, 3],
x_name=None,
@ -73,6 +74,7 @@ def test_waveform_plot_data(waveform_widget, mock_waveform):
def test_waveform_plot_scan_curves(waveform_widget, mock_waveform):
waveform_widget.plot(x_name="samx", y_name="samy", dap="GaussianModel")
waveform_widget.waveform.plot.assert_called_once_with(
arg1=None,
x=None,
y=None,
x_name="samx",