mad_gui.plugins.BaseAlgorithm#

class mad_gui.plugins.BaseAlgorithm(parent=None)[source]#

A base class for implementing an algorithm.

Methods

name()

Return a name, which is used to represent this Algorithm in a dropdown in the GUI.

process_data(plot_data)

Get labels from the data using an algorithm.

__init__(parent=None)[source]#

Set a parent, in case this would be necessary at any later stage.

Parameters:
parent

This could for example be the main window of the GUI, in case the plugin wants to access something there. However, this is unlikely to be necessary since plugins receive either the single mad_gui.models.GlobalData or its attribute PlotData, which should be sufficient to do everything.

abstract classmethod name() str[source]#

Return a name, which is used to represent this Algorithm in a dropdown in the GUI.

abstract process_data(plot_data: Dict[str, PlotData])[source]#

Get labels from the data using an algorithm.

This method applies an algorithm to the passed data. For example it could be a peak detection algorithm, which then for example creates one mad_gui.plot_tools.labels.BaseRegionLabel between to consecutive peaks. This method can be accessed by the user by clicking the Use algorithm button in the GUI's sidebar. For more information and an example, see the part of Implement an algorithm in our online documentation.

Parameters:
plot_data

A dictionary, where keys are the names of the plots in the GUI and the values are instances of mad_gui.models.local.PlotData. These in turn keep the plotted sensor data, its sampling frequency, and the plotted annotations.

Returns
plot_data

The adapted dictionary, where you have for example changed the data or annotations.