brainaccess_board.database#

Classes#

ReadDB

Get current database file to read from it

Module Contents#

class brainaccess_board.database.ReadDB(filename='current')[source]#

Get current database file to read from it

Parameters:

filename (str)

get_data_since(device, last_timestamp=0.0, return_mne=False)[source]#

Gets data for a device that has arrived after a given timestamp.

This method connects and disconnects from the database for each call.

Parameters:
  • device (str) – The device identifier.

  • last_timestamp (float) – The local_clock timestamp of the last record you’ve processed. Defaults to 0.0 to fetch all data on the first call.

  • return_mne (bool, optional) – If True, returns data as an MNE Raw object. Defaults to False.

Returns:

If return_mne is False (default): A dictionary containing the new data arrays and the timestamp of the newest record. Keys are: ‘data’, ‘time’, ‘local_time’, ‘id’, and ‘last_timestamp’. If return_mne is True: A dictionary with ‘mne_raw’ holding the mne.io.Raw object and ‘last_timestamp’ for the newest record. Returns an empty dictionary if no new data is available.

Return type:

dict

Raises:

ValueError – If return_mne is True and metadata for the device cannot be found.

get_mne(device=None, duration=None, time_range=None, only_lsl=True, marker_devices_include=None)[source]#

Get data from the database as mne objects

If no parameters are given, dictionary with all devices full data are returned.

Parameters:
  • device (str, optional) – The device identifier. Usually the LSL uid. If empty all devices are returned.

  • duration (int, Optional) – The duration in seconds from the end.

  • time_range (tuple, Optional) – The time range to get data from. If duration is set time_range is ignored.

  • only_lsl (bool, Optional) – If True, only LSL devices are included. With default templates non LSL devices are not recorded.

  • marker_devices_include (list, Optional) – List of marker devices to include. If left empty all marker devices are included.

Returns:

Dictionary with mne objects.

Return type:

dict

name[source]#