Helpers
Ver. 0.1.0 (2025-06-24)
This module provides the ChangeObserver class to be used for observation and visualization of stream adaptation events.
- class mlpro.oa.streams.helpers.change_observer.ChangeObserver(p_related_task: OAStreamTask, p_change_types: list = [], p_logarithmic_plot: bool = True, p_visualize: bool = True, p_logging=True, **p_kwargs)
Bases:
OAStreamHelper,Log,KWArgsThis class observes adaptations of particular oa stream tasks. Its event handler method can be registered for adaptation events of a stream task.
- C_TYPE = 'Helper'
- C_NAME = 'Event Observer'
- C_PLOT_ACTIVE: bool = True
- C_PLOT_STANDALONE: bool = True
- C_PLOT_VALID_VIEWS: list = ['ND']
- C_PLOT_DEFAULT_VIEW: str = 'ND'
- C_ANOMALY_COLORS = ['blue', 'red', 'green', 'purple', 'yellow', 'orange']
- init_plot(p_figure=None, p_plot_settings: PlotSettings = None, p_window_title: str = None) bool
Initializes the plot functionalities of the class.
- Parameters:
p_figure (Matplotlib.figure.Figure, optional) – Optional MatPlotLib host figure, where the plot shall be embedded. The default is None.
p_plot_settings (PlotSettings) – Optional plot settings. If None, the default view is plotted (see attribute C_PLOT_DEFAULT_VIEW).
- _init_plot_nd(p_figure, p_settings: PlotSettings)
Custom method to initialize a nD plot. If attribute p_settings.axes is not None the initialization shall be done there. Otherwise a new MatPlotLib Axes object shall be created in the given figure and stored in p_settings.axes.
Note: Please call this method in your custom implementation to create a default subplot.
- Parameters:
p_figure (Matplotlib.figure.Figure) – Matplotlib figure object to host the subplot(s).
p_settings (PlotSettings) – Object with further plot settings.
- _update_plot_nd(p_settings: PlotSettings, p_event_object: Change, **p_kwargs) bool
Custom method to update the nd plot. The related MatPlotLib Axes object is stored in p_settings.
- Parameters:
p_settings (PlotSettings) – Object with further plot settings.
**p_kwargs – Implementation-specific data and parameters.
- Returns:
True, if changes on the plot require a refresh of the figure. False otherwise.
- Return type:
bool