mad_gui.models.local.PlotData#

class mad_gui.models.local.PlotData(data: DataFrame, sampling_rate_hz: float, annotation: Dict | None = None, additional_data=None)[source]#

Bases: BaseStateModel

An object, which keeps the plotted data and annotations of a single plot.

Parameters:
data

A pandas.DataFrame, where each column is one channel of plotted data.

sampling_rate_hz

The sampling rate with which the data was recorded.

annotation

A dictionary, where the keys are the label names (as named in the label's name() attribute). The values are instances of AnnotationData.

additional_data

Keeps things that belongs to the plotted data but should not be plotted. Here you can find everything that was returned from your loader for one sensor, where the key is not sensor_data or sampling_rate_hz, see mad_gui.plugins.BaseImporter.

Methods

from_dict(plot_data[, selections])

Create an instance of this class from a dictionary.

to_dict()

Represent this object as a dictionary, such that it can be pickled.

classmethod from_dict(plot_data: Dict, selections: List | None = None) PlotData[source]#

Create an instance of this class from a dictionary.

Parameters:
plot_data

A dictionary with a key sensor_data, which is a pandas.DataFrame; a key sampling_rate_hz, which is a float`; optionally a key annotations containing a dictionary, where keys are label names ( mad_gui.plot_tools.labels.BaseRegionLabel.name) and each value is a pandas.DataFrame at least with the columns start and end and optional columns description and identifier.

selections

This is used to indicate which of the items in the passed dictionary plot_data should be plotted. We use it only when using the "reload displayed data" button.

Returns:
PlotData
to_dict()[source]#

Represent this object as a dictionary, such that it can be pickled.

Returns:
dict

A dictionary with the keys sensor_data, annotations, events, and sampling_rate_hz, where the first three are pandas.DataFrame and the last is a float.