NeuralEnsemble / python-neo

Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats
http://neo.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
325 stars 248 forks source link

Best way to collect notes data from `IntanIO`. #1564

Closed Tevin-yue closed 2 months ago

Tevin-yue commented 2 months ago

Hi,

For the IntanIO function, I think there could be a more convenient way to get notes from the data. Currently, I can get that with this code:

import neo
test = neo.IntanIO(r'F:\MATLAB\DAT_test\info.rhd')
test.raw_annotations['blocks'][0]['segments'][0]['signals'][0]['note1']

So is there any possibility there can be an easier way to get that?

zm711 commented 2 months ago

I think the info is also stored in the header. You could work at the rawio level if you aren't worried about blocks and segments. So instead:

from neo.rawio import IntanRawIO
reader = IntanRawIO(r'xx')
reader.parse_header()
header = reader.header

header is a dict that should contain that info without going through blocks and segments. So it is flatter than how you are currently accessing the data.

zm711 commented 2 months ago

@Tevin-yue actually sorry one tiny mistake. you want global info so

global_info = reader._global_info

that will have the notes stored as the dict :)

Tevin-yue commented 2 months ago

Thanks a lot!