Windows
Ver. 1.1.5 (2023-02-02)
This module provides pool of window objects further used in the context of online adaptivity.
- class mlpro.bf.streams.tasks.windows.Window(p_buffer_size: int, p_delay: bool = False, p_enable_statistics: bool = False, p_name: str = None, p_range_max=1, p_duplicate_data: bool = False, p_visualize: bool = False, p_logging=True, **p_kwargs)
Bases:
StreamTask
This is the base class for window implementations
- Parameters:
p_buffer_size (int) – the size/length of the buffer/window.
p_delay (bool, optional) – Set to true if full buffer is desired before passing the window data to next step. Default is false.
p_name (str, optional) – Name of the Window. Default is None.
-Optional (p_logging) – Maximum range of task parallelism for window task. Default is set to multithread.
p_duplicate_data (bool) – If True, instances will be duplicated before processing. Default = False.
p_ada (bool, optional) – Adaptivity property of object. Default is True.
-Optional – Log level for the object. Default is log everything.
- C_NAME = 'Window'
- C_PLOT_STANDALONE: bool = False
- C_PLOT_IN_WINDOW = 'In Window'
- C_PLOT_OUTSIDE_WINDOW = 'Out Window'
- C_EVENT_BUFFER_FULL = 'BUFFER_FULL'
- C_EVENT_DATA_REMOVED = 'DATA_REMOVED'
- _run(p_inst_new: list, p_inst_del: list)
Method to run the window including adding and deleting of elements
- Parameters:
p_inst_new (list) – Instance/s to be added to the window
p_inst_del (list) – Instance/s to be deleted from the window
- get_buffered_data()
Method to fetch the date from the window buffer
- Returns:
buffer (dict) – the buffered data in the form of dictionary
buffer_pos (int) – the latest buffer position
- get_boundaries()
Method to get the current boundaries of the Window
- Returns:
boundaries – Returns the current window boundaries in the form of a Numpy array.
- Return type:
np.ndarray
- get_mean()
Method to get the mean of the data in the Window.
- Returns:
mean – Returns the mean of the current data in the window in the form of a Numpy array.
- Return type:
np.ndarray
- get_variance()
Method to get the variance of the data in the Window.
- Returns:
variance – Returns the variance of the current data in the window as a numpy array.
- Return type:
np.ndarray
- get_std_deviation()
Method to get the standard deviation of the data in the window.
- Returns:
std – Returns the standard deviation of the data in the window as a numpy array.
- Return type:
np.ndarray
- _init_plot_2d(p_figure: Figure, p_settings: PlotSettings)
Custom method to initialize a 2D plot for the window object
- Parameters:
p_figure (Figure) – The figure object that hosts the plot
p_settings (list of PlotSettings objects.) – Additional settings for the plot
- _init_plot_3d(p_figure: Figure, p_settings: PlotSettings)
Custom method to initialize a 3D plot for window object
- Parameters:
p_figure (matplotlib.figure.Figure) – The figure object to host the plot.
p_settings (PlotSettings) – Additional Settings for the plot
- _init_plot_nd(p_figure: Figure, p_settings: PlotSettings)
Custom method to initialize plot for Window tasks for N-dimensional plotting.
- Parameters:
p_figure (Figure) – Figure to host the plot
p_settings (PlotSettings) – PlotSettings objects with specific settings for the plot
- _update_plot_2d(p_settings: PlotSettings, p_inst_new: list, p_inst_del: list, **p_kwargs)
Default 3-dimensional plotting implementation for window tasks. See class mlpro.bf.plot.Plottable for more details.
- Parameters:
p_settings (PlotSettings) – Object with further plot settings.
p_inst_new (list) – List of new stream instances to be plotted.
p_inst_del (list) – List of obsolete stream instances to be removed.
p_kwargs (dict) – Further optional plot parameters.
- _update_plot_3d(p_settings: PlotSettings, p_inst_new: list, p_inst_del: list, **p_kwargs)
Default 3-dimensional plotting implementation for window tasks. See class mlpro.bf.plot.Plottable for more details.
- Parameters:
p_settings (PlotSettings) – Object with further plot settings.
p_inst_new (list) – List of new stream instances to be plotted.
p_inst_del (list) – List of obsolete stream instances to be removed.
p_kwargs (dict) – Further optional plot parameters.
- _update_plot_nd(p_settings: PlotSettings, p_inst_new: list, p_inst_del: list, **p_kwargs)
Default N-dimensional plotting implementation for window tasks. See class mlpro.bf.plot.Plottable for more details.
- Parameters:
p_settings (PlotSettings) – Object with further plot settings.
p_inst_new (list) – List of new stream instances to be plotted.
p_inst_del (list) – List of obsolete stream instances to be removed.
p_kwargs (dict) – Further optional plot parameters.