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:
@ -1844,6 +1844,7 @@ class BECWaveformWidget(RPCBase):
|
|||||||
@rpc_call
|
@rpc_call
|
||||||
def plot(
|
def plot(
|
||||||
self,
|
self,
|
||||||
|
arg1: "list | np.ndarray | str | None" = None,
|
||||||
x: "list | np.ndarray | None" = None,
|
x: "list | np.ndarray | None" = None,
|
||||||
y: "list | np.ndarray | None" = None,
|
y: "list | np.ndarray | None" = None,
|
||||||
x_name: "str | None" = None,
|
x_name: "str | None" = None,
|
||||||
@ -1862,6 +1863,7 @@ class BECWaveformWidget(RPCBase):
|
|||||||
"""
|
"""
|
||||||
Plot a curve to the plot widget.
|
Plot a curve to the plot widget.
|
||||||
Args:
|
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.
|
x(list | np.ndarray): Custom x data to plot.
|
||||||
y(list | np.ndarray): Custom y data to plot.
|
y(list | np.ndarray): Custom y data to plot.
|
||||||
x_name(str): The name of the device for the x-axis.
|
x_name(str): The name of the device for the x-axis.
|
||||||
|
@ -204,6 +204,7 @@ class BECWaveformWidget(BECWidget, QWidget):
|
|||||||
@SafeSlot(popup_error=True)
|
@SafeSlot(popup_error=True)
|
||||||
def plot(
|
def plot(
|
||||||
self,
|
self,
|
||||||
|
arg1: list | np.ndarray | str | None = None,
|
||||||
x: list | np.ndarray | None = None,
|
x: list | np.ndarray | None = None,
|
||||||
y: list | np.ndarray | None = None,
|
y: list | np.ndarray | None = None,
|
||||||
x_name: str | None = None,
|
x_name: str | None = None,
|
||||||
@ -222,6 +223,7 @@ class BECWaveformWidget(BECWidget, QWidget):
|
|||||||
"""
|
"""
|
||||||
Plot a curve to the plot widget.
|
Plot a curve to the plot widget.
|
||||||
Args:
|
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.
|
x(list | np.ndarray): Custom x data to plot.
|
||||||
y(list | np.ndarray): Custom y data to plot.
|
y(list | np.ndarray): Custom y data to plot.
|
||||||
x_name(str): The name of the device for the x-axis.
|
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)
|
# self._check_if_scans_have_same_x(enabled=True, x_name_to_check=x_name)
|
||||||
return self.waveform.plot(
|
return self.waveform.plot(
|
||||||
|
arg1=arg1,
|
||||||
x=x,
|
x=x,
|
||||||
y=y,
|
y=y,
|
||||||
x_name=x_name,
|
x_name=x_name,
|
||||||
|
@ -54,6 +54,7 @@ def test_waveform_widget_set_x(waveform_widget, mock_waveform):
|
|||||||
def test_waveform_plot_data(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.plot(x=[1, 2, 3], y=[1, 2, 3])
|
||||||
waveform_widget.waveform.plot.assert_called_once_with(
|
waveform_widget.waveform.plot.assert_called_once_with(
|
||||||
|
arg1=None,
|
||||||
x=[1, 2, 3],
|
x=[1, 2, 3],
|
||||||
y=[1, 2, 3],
|
y=[1, 2, 3],
|
||||||
x_name=None,
|
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):
|
def test_waveform_plot_scan_curves(waveform_widget, mock_waveform):
|
||||||
waveform_widget.plot(x_name="samx", y_name="samy", dap="GaussianModel")
|
waveform_widget.plot(x_name="samx", y_name="samy", dap="GaussianModel")
|
||||||
waveform_widget.waveform.plot.assert_called_once_with(
|
waveform_widget.waveform.plot.assert_called_once_with(
|
||||||
|
arg1=None,
|
||||||
x=None,
|
x=None,
|
||||||
y=None,
|
y=None,
|
||||||
x_name="samx",
|
x_name="samx",
|
||||||
|
Reference in New Issue
Block a user