mad_gui.plugins.example.EnergyCalculator#

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

Bases: BaseAlgorithm

An exemplary algorithm, which evaluates data within each annotation to calculate a feature.

Note: a label inherited from BaseRegionLabel with the name `Activity must have been passed to start_gui(). Furthermore, annotations of this kind must exist in the GUI, for example created by mad_gui.plugins.example.StationaryMomentsDetector in order for this algorithm to calculate features for each existing annotation.

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.

calculate_features

static calculate_features(sensor_data: DataFrame) str[source]#
classmethod name()[source]#

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

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.