Containers and data structure¶
NeurOne recordings consist of three structures:
- A recording containing (multiple)
- sessions containing (multiple)
- phases containing the actual data
Accordingly neurone_loader
provides three containers representing these structures.
[2]:
from neurone_loader import Recording, Session, Phase
In each of these you can access the data
and metadata like sampling_rate
or channels
and all of them support the features described in Lazy loading.
Session
and Recording
technically don’t hold data themselves. On the other hand one usually wants to work with the whole recording or at least a whole session of a recording. Therefore accessing the .data
or any other attribute of Session
or Recording
will concatenate the data for you. Be aware that in order to save memory, accessing the .data
attribute of a superseeding object will replace the .data
attribute of the included containers with a view on the concatenated
data. So if you manipulate any one of them you will also manipulate the other.
[3]:
rec = Recording(test_data_path)
session0 = rec.sessions[0]
sum_of_samples_of_phases_in_session0 = sum([p.n_samples for p in session0.phases])
print('\n')
print(f'session0.n_samples == sum_of_samples_of_phases_in_session0 is {session0.n_samples == sum_of_samples_of_phases_in_session0}')
(Lazy) loading Phase.n_samples
(Lazy) loading Phase.n_samples
(Lazy) loading Phase.n_samples
(Lazy) loading Phase.n_samples
session0.n_samples == sum_of_samples_of_phases_in_session0 is True
For a detailed description refer to the API documentation of the respective objects