mad_gui.plugins.example.ExampleImporter#
- class mad_gui.plugins.example.ExampleImporter(parent=None)[source]#
Bases:
BaseImporter
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.
- file_type = {'annotation_file': '*.csv', 'data_file': '*.csv', 'video_file': '*.mp4'}#
- 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