neurone_loader.mne_export

Classes

neurone_loader.mne_export.MneExportable A metaclass that provides a function allowing objects that expose data, events, channels and sampling_rate properties to be converted to an mne.io.RawArray.

Exceptions

neurone_loader.mne_export.UnknownChannelException Raised if data contains a channel name that is neither in a list of well-known channels nor in an (optional) list of user supplied channel name to channel type mappings.

Provides the metaclass MneExportable that allows subclasses implementing all the metaclass’s properties to be converted to a mne.io.RawArray.

class neurone_loader.mne_export.MneExportable[source]

A metaclass that provides a function allowing objects that expose data, events, channels and sampling_rate properties to be converted to an mne.io.RawArray.

channels

Abstract Property

Returns:should contain the names of channels, matching the sequence used in the data property
Return type:list[str]
clear_data()[source]

Abstract Method

Should delete loaded data from memory

data

Abstract Property

Returns:should contain data in (n_samples, n_channels) shape
Return type:numpy.ndarray
events

Abstract Property

Returns:should contain the events as a DataFrame, required fields are StartSampleIndex, StopSampleIndex and Code. Additional fields are ignored.
Return type:pandas.DataFrame
sampling_rate

Abstract Property

Returns:should contain the used sampling rate
Return type:int
to_mne(substitute_zero_events_with=None, copy=False, channel_type_mappings=None)[source]

Convert loaded data to a mne.io.RawArray

Parameters:
  • substitute_zero_events_with (None or int) – None. events with code = 0 are not supported by MNE, if this parameter is set, the event code 0 will be substituted with this parameter
  • copy (bool) – False. If False (default), the original data will be removed from memory to save space while creating the mne.io.RawArray. If the data is needed again it must be reloaded from disk
  • channel_type_mappings (None or dict) – Optional. You can provide a dictionary of channel name to type mappings. If the data contains any channel not in the list of well-known channel names and not in this mapping the conversion will raise UnknownChannelException. You can choose to map any unknown channel to one specific type e.g. {‘#unknown’: ‘eeg’}. For a list of available types see the documentation of mne.pick_types(). This setting takes precedence over the built-in list of common channel names.
Returns:

the converted data

Return type:

mne.io.RawArray

Raises:
exception neurone_loader.mne_export.UnknownChannelException[source]

Raised if data contains a channel name that is neither in a list of well-known channels nor in an (optional) list of user supplied channel name to channel type mappings.