mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
fix(waveform): scan_history error check for IndexError
This commit is contained in:
@ -221,6 +221,7 @@ class BECWaveform(BECPlotBase):
|
|||||||
label: str | None = None,
|
label: str | None = None,
|
||||||
validate: bool = True,
|
validate: bool = True,
|
||||||
dap: str | None = None, # TODO add dap custom curve wrapper
|
dap: str | None = None, # TODO add dap custom curve wrapper
|
||||||
|
**kwargs,
|
||||||
) -> BECCurve:
|
) -> BECCurve:
|
||||||
"""
|
"""
|
||||||
Plot a curve to the plot widget.
|
Plot a curve to the plot widget.
|
||||||
@ -244,7 +245,7 @@ class BECWaveform(BECPlotBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if x is not None and y is not None:
|
if x is not None and y is not None:
|
||||||
return self.add_curve_custom(x=x, y=y, label=label, color=color)
|
return self.add_curve_custom(x=x, y=y, label=label, color=color, **kwargs)
|
||||||
else:
|
else:
|
||||||
if dap:
|
if dap:
|
||||||
self.add_dap(x_name=x_name, y_name=y_name, dap=dap)
|
self.add_dap(x_name=x_name, y_name=y_name, dap=dap)
|
||||||
@ -259,6 +260,7 @@ class BECWaveform(BECPlotBase):
|
|||||||
color_map_z=color_map_z,
|
color_map_z=color_map_z,
|
||||||
label=label,
|
label=label,
|
||||||
validate_bec=validate,
|
validate_bec=validate,
|
||||||
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
def add_curve_custom(
|
def add_curve_custom(
|
||||||
@ -754,7 +756,11 @@ class BECWaveform(BECPlotBase):
|
|||||||
self.update_dap, MessageEndpoints.dap_response(self.scan_id)
|
self.update_dap, MessageEndpoints.dap_response(self.scan_id)
|
||||||
)
|
)
|
||||||
if scan_index is not None:
|
if scan_index is not None:
|
||||||
self.scan_id = self.queue.scan_storage.storage[scan_index].scan_id
|
try:
|
||||||
|
self.scan_id = self.queue.scan_storage.storage[scan_index].scan_id
|
||||||
|
except IndexError:
|
||||||
|
print(f"Scan index {scan_index} out of range.")
|
||||||
|
return
|
||||||
elif scan_id is not None:
|
elif scan_id is not None:
|
||||||
self.scan_id = scan_id
|
self.scan_id = scan_id
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user