Multi Waveform Widget#
The Multi Waveform Widget is designed to display multiple 1D detector signals over time. It is ideal for visualizing real-time streaming data from a monitor in the BEC framework, where each new data set is added as a new curve on the plot. This allows users to observe historical changes and trends in the signal.
Key Features:
Real-Time Data Visualization: Display multiple 1D signals from a monitor in real-time, with each new data set represented as a new curve.
Curve Management: Control the number of curves displayed, set limits on the number of curves, and manage the buffer with options to flush old data.
Interactive Controls: Highlight specific curves, adjust opacity, and interact with the plot using zoom and pan tools.
Customizable Appearance: Customize the colormap, curve opacity, and highlight settings to enhance data visualization.
Data Export: Export the displayed data for further analysis, including exporting to Matplotlib for advanced plotting.
Flexible Integration: Can be integrated into
BECDockArea, or used as an individual component in your application throughBEC Designer.
BECMultiWaveform can be embedded in BECDockArea, or used as an individual component in your application through BEC Designer. The command-line API is consistent across these contexts.
Example 1 - Using BECMultiWaveformWidget in BECDockArea
You can add BECMultiWaveformWidget directly to a BECDockArea. This widget includes its own toolbar and controls for interacting with the multi waveform plot.
# Add a new MultiWaveform to the BECDockArea
dock_area = gui.new()
multi_waveform_widget = dock_area.new().new(gui.available_widgets.MultiWaveform)
# Set the monitor from the command line
multi_waveform_widget.plot('waveform')
# Optionally, adjust settings
multi_waveform_widget.opacity = 60
Example 2 - Customizing the Multi Waveform Plot
You can customize various aspects of the plot, such as the colormap, opacity, and curve limit.
# Change the colormap to 'viridis'
multi_waveform_widget.color_palette = 'viridis'
# Adjust the opacity of the curves to 70%
multi_waveform_widget.opacity = 60
# Limit the number of curves displayed to 50
multi_waveform_widget.max_trace = 10
# Enable buffer flush when the curve limit is reached
multi_waveform_widget.flush_buffer = True
Example 3 - Highlighting Curves
You can highlight specific curves to emphasize important data.
# Disable automatic highlighting of the last curve
multi_waveform.highlight_last_curve = False
# Highlight the third curve (indexing starts from 0)
multi_waveform.highlighted_index = 2
# Re-enable automatic highlighting of the last curve
multi_waveform.highlight_last_curve = True
- class MultiWaveform(gui_id: str | None = None, config: dict | None = None, object_name: str | None = None, parent=None, **kwargs)[source]#
Bases:
RPCBaseMultiWaveform widget for displaying multiple waveforms emitted by a single signal.
- auto_range(value: bool = True)[source]#
On demand apply autorange to the plot item based on the visible curves.
- Parameters:
value (bool) – If True, apply autorange to the visible curves.
- property auto_range_x: bool#
Set auto range for the x-axis.
- property auto_range_y: bool#
Set auto range for the y-axis.
- property color_palette: str#
The color palette of the figure widget.
- detach()[source]#
Detach the widget from its parent dock widget (if widget is in the dock), making it a floating widget.
- property enable_fps_monitor: bool#
Enable the FPS monitor.
- property enable_side_panel: bool#
Show Side Panel
- property enable_toolbar: bool#
Show Toolbar.
- property flush_buffer: bool#
The flush_buffer property.
- property highlight_last_curve: bool#
Get the highlight_last_curve property. :returns: The highlight_last_curve property. :rtype: bool
- property highlighted_index#
None
- property inner_axes: bool#
Show inner axes of the plot widget.
- property legend_label_size: int#
The font size of the legend font.
- property lock_aspect_ratio: bool#
Lock aspect ratio of the plot widget.
- property max_trace: int#
The maximum number of traces to display on the plot.
- property minimal_crosshair_precision: int#
Minimum decimal places for crosshair when dynamic precision is enabled.
- property monitor: str#
The monitor of the figure widget.
- property opacity: int#
The opacity of the figure widget.
- property outer_axes: bool#
Show the outer axes of the plot widget.
- plot(monitor: str, color_palette: str | None = 'plasma')[source]#
Create a plot for the given monitor. :param monitor: The monitor to set. :type monitor: str :param color_palette: The color palette to use for the plot. :type color_palette: str|None
- screenshot(file_name: str | None = None)[source]#
Take a screenshot of the dock area and save it to a file.
- set(**kwargs)[source]#
Set the properties of the plot widget.
- Parameters:
**kwargs – Keyword arguments for the properties to be set.
- Possible properties:
title: str
x_label: str
y_label: str
x_scale: Literal[“linear”, “log”]
y_scale: Literal[“linear”, “log”]
x_lim: tuple
y_lim: tuple
legend_label_size: int
- set_curve_highlight(index: int)[source]#
Set the curve highlight based on visible curves.
- Parameters:
index (int) – The index of the curve to highlight among visible curves.
- set_curve_limit(max_trace: int, flush_buffer: bool)[source]#
Set the maximum number of traces to display on the plot.
- Parameters:
max_trace (int) – The maximum number of traces to display.
flush_buffer (bool) – Flush the buffer.
- property title: str#
Set title of the plot.
- property x_grid: bool#
Show grid on the x-axis.
- property x_label: str#
The set label for the x-axis.
- property x_limits: QPointF#
Get the x limits of the plot.
- property x_log: bool#
Set X-axis to log scale if True, linear if False.
- property y_grid: bool#
Show grid on the y-axis.
- property y_label: str#
The set label for the y-axis.
- property y_limits: QPointF#
Get the y limits of the plot.
- property y_log: bool#
Set Y-axis to log scale if True, linear if False.