neurone_loader.loader

Classes

neurone_loader.loader.BaseContainer() A metaclass that provides properties for accessing data shared between all subclasses.
neurone_loader.loader.Phase(*args, **kwargs) Represents one recording phase of one NeurOne session in one NeurOne Recording
neurone_loader.loader.Recording(*args, **kwargs) Represents one NeurOne Recording and contains all of the recording’s sessions
neurone_loader.loader.Session(*args, **kwargs) Represents one session in one NeurOne Recording and contains all of the session’s phases

Provides classes to load, represent and export data recorded with the Bittium NeurOne device.

class neurone_loader.loader.BaseContainer[source]

A metaclass that provides properties for accessing data shared between all subclasses. I cannot be used itself as it is not implementing all required methods of its abstract superclass.

channels[source]

Note

This property is a lazy property. For details see lazy.Lazy

Returns:ordered list of all channel names, read from the session protocol
Return type:list[str]
drop_channels(channels_to_drop)[source]

Remove specified channels from loaded data. Dropped channels will be remembered and when data is cleared from memory and reloaded from disk the channels will get removed again. To get them back create a new object of this type to reload from disk.

Parameters:channels_to_drop (list[str]) – names of channels to drop
sampling_rate
Returns:the sampling rate, read from the session protocol
Return type:int
class neurone_loader.loader.Phase(*args, **kwargs)[source]

Represents one recording phase of one NeurOne session in one NeurOne Recording

Parameters:
  • path (str) – path to the recording session folder
  • phase (dict) – phase object from a session protocol
clear_data()[source]

Remove loaded data from memory

data[source]

Note

This property is a lazy property. For details see lazy.Lazy

Returns:recorded data with shape (samples, channels) in µV
Return type:numpy.ndarray
drop_channels(channels_to_drop)[source]

Remove specified channels from loaded data. Dropped channels will be remembered and when data is cleared from memory and reloaded from disk the channels will get removed again. To get them back create a new object of this type to reload from disk.

Parameters:channels_to_drop (list[str]) – names of channels to drop
event_codes
Returns:all event codes used in the data as int32 in an numpy.ndarray
Return type:numpy.ndarray
events[source]

Note

This property is a lazy property. For details see lazy.Lazy

Returns:recorded events with Revision, Type, SourcePort, ChannelNumber, Code, StartSampleIndex, StopSampleIndex, DescriptionLength, DescriptionOffset, DataLength, DataOffset, StartTime, StopTime
Return type:pandas.DataFrame
n_channels
Returns:the number of channels, read from the session protocol
Return type:int
n_samples
Returns:the number of channels, inferred from the binary recording’s file size
Return type:int
preload()

Use this function to call all properties constructed with lazy.Lazy. It can also be used to reload all lazy properties without deleting them first.

Example:
>>> @preloadable
>>> class Test:
>>>     @Lazy
>>>     def lazy_attribute(self):
>>>         print('lazy function called')
>>>         return 'lazy return'
>>>
>>> test_object = Test(preload=False) # The lazy property is not evaluated on initialization
>>> test_object.preload()
lazy function called
>>> print(test_object.lazy_attribute) # The stored attribute is returned
lazy return
>>> test_object.preload() # All properties are reloaded even though already stored
lazy function called
class neurone_loader.loader.Recording(*args, **kwargs)[source]

Represents one NeurOne Recording and contains all of the recording’s sessions

Parameters:path (str) – path to the recording recording folder
channels

Returns the channels used in all sessions and makes sure they’re equal

Returns:ordered list of all channel names, read from the session protocols
Return type:list[str]
clear_data()[source]

Remove loaded data in all phases of all sessions from memory

data[source]

Note

This property is a lazy property. For details see lazy.Lazy

Returns:concatenated data of all phases of all sessions with shape (samples, channels) in µV
Return type:numpy.ndarray

Warning

Calling this replaces the data attribute of the contained phases and sessions with a view on the concatenated data to save memory. Keep this in mind when manipulating the contained sessions or phases.

drop_channels(channels_to_drop)[source]

Remove specified channels from loaded data. Dropped channels will be remembered and when data is cleared from memory and reloaded from disk the channels will get removed again. To get them back create a new object of this type to reload from disk.

Parameters:channels_to_drop (list[str]) – names of channels to drop
event_codes
Returns:all event codes used in the data as int32 in an numpy.ndarray
Return type:numpy.ndarray
events
Returns:concatenated events of all phases of all sessions with Revision, Type, SourcePort, ChannelNumber, Code, StartSampleIndex, StopSampleIndex, DescriptionLength, DescriptionOffset, DataLength, DataOffset, StartTime, StopTime
Return type:pandas.DataFrame
n_channels

Returns the number of channels used in all phases and makes sure they’re equal

Returns:the number of channels, read from the session protocol
Return type:int
n_samples
Returns:sum of the number of samples, inferred from the binary recording’s file size, of all phases of all sessions
Return type:int
preload()

Use this function to call all properties constructed with lazy.Lazy. It can also be used to reload all lazy properties without deleting them first.

Example:
>>> @preloadable
>>> class Test:
>>>     @Lazy
>>>     def lazy_attribute(self):
>>>         print('lazy function called')
>>>         return 'lazy return'
>>>
>>> test_object = Test(preload=False) # The lazy property is not evaluated on initialization
>>> test_object.preload()
lazy function called
>>> print(test_object.lazy_attribute) # The stored attribute is returned
lazy return
>>> test_object.preload() # All properties are reloaded even though already stored
lazy function called
sampling_rate

Returns the sampling rate used in all sessions and makes sure they’re all equal

Returns:the sampling rate, read from the session protocols
Return type:int
class neurone_loader.loader.Session(*args, **kwargs)[source]

Represents one session in one NeurOne Recording and contains all of the session’s phases

Parameters:path (str) – path to the recording session folder
clear_data()[source]

Remove loaded data in all phases from memory

data[source]

Note

This property is a lazy property. For details see lazy.Lazy

Warning

Calling this replaces the data attribute of the contained phases with a view on the concatenated data to save memory. Keep this in mind when manipulating the contained sessions.

Returns:concatenated data of all phases with shape (samples, channels) in µV
Return type:numpy.ndarray
drop_channels(channels_to_drop)[source]

Remove specified channels from loaded data. Dropped channels will be remembered and when data is cleared from memory and reloaded from disk the channels will get removed again. To get them back create a new object of this type to reload from disk.

Parameters:channels_to_drop (list[str]) – names of channels to drop
event_codes
Returns:all event codes used in the data as int32 in an numpy.ndarray
Return type:numpy.ndarray
events
Returns:concatenated events of all phases with Revision, Type, SourcePort, ChannelNumber, Code, StartSampleIndex, StopSampleIndex, DescriptionLength, DescriptionOffset, DataLength, DataOffset, StartTime, StopTime
Return type:pandas.DataFrame
n_channels

Returns the number of channels used in all phases and makes sure they’re equal

Returns:the number of channels, read from the session protocol
Return type:int
n_samples
Returns:sum of the number of samples, inferred from the binary recording’s file size, of all phases
Return type:int
preload()

Use this function to call all properties constructed with lazy.Lazy. It can also be used to reload all lazy properties without deleting them first.

Example:
>>> @preloadable
>>> class Test:
>>>     @Lazy
>>>     def lazy_attribute(self):
>>>         print('lazy function called')
>>>         return 'lazy return'
>>>
>>> test_object = Test(preload=False) # The lazy property is not evaluated on initialization
>>> test_object.preload()
lazy function called
>>> print(test_object.lazy_attribute) # The stored attribute is returned
lazy return
>>> test_object.preload() # All properties are reloaded even though already stored
lazy function called