mad_gui.plugins.ExampleImporter#

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

An exemplary importer.

Attributes:
file_type

Can restrict the format of the data/video/annotation file that can be loaded with this importer.

Methods

load_sensor_data(file)

Loading sensor data as it is usually stored by your recording device

name()

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

__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.

load_sensor_data(file: str) Dict[source]#

Loading sensor data as it is usually stored by your recording device

Parameters:
file

Full path to the file that should be used to load data. You will automatically receive this from the GUI which calls this importer.

Returns:
sensor_data

A dictionary with one key per sensor. Each of those, again keeps a dictionary, with at least two keys: sensor data and sampling_rate_hz. Behind the key sensor_data is a pd.DataFrame with one column per channel, sampling_rate_hz is a float. If this dictionary has further keys, those will later be stored in mad_gui.models.local.PlotData's additional_data.

Examples

>>> data = load_sensor_data("/some/file.format")
>>> data.keys()
dict_keys(['left_sensor', 'right_sensor'])
>>> data['left_sensor'].keys()
dict_keys(['sensor_data', 'sampling_rate_hz'])
>>> data['left_sensor']['sensor_data']
    acc_x    'acc_y'
0    9.81       0.1
1    9.80       0.0
2    9.82       0.1
classmethod name() str[source]#

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