When loading a SNIRF file via mne.io.read_raw_snirf, the descriptions for Annotations are currently extracted from the keys of the SNIRF stim indexed groups. According to the SNIRF file format spec, what is currently being extracted as the Annotation description is the index of the stim rather than a descriptive string.
group: a structure containing sub-fields (defined in the H5G object class). Arrays of groups, also known as the indexed-groups, are denoted with numbers at the end (e.g. /nirs/data1, /nirs/data2) starting with index 1. Array indices should be contiguious with no skipped values (an empty group with no sub-member is permitted).
This is a string describing the jth stimulus condition.
The proposed change is to get Annotation descriptions from the stimulus name rather than the index.
Describe your proposed implementation
Update RawSNIRF.__init__ lines 362:369 to take the description field from the name field of the stim group rather than the stim group key.
Describe possible alternatives
The descriptions can be left as-is. Although the match between an Annotation description and a SNIRF stimulus name isn't perfect, it seems like an improvement over using the stimulus index as-is.
If the description is not changed, then tests for the MNE-NIRS SNIRF writer will need to be changed (see Additional comments below).
MNE-NIRS currently has tests which use the MNE-Python SNIRF reader to make a round trip write/read test. Resolving this issue will ensure that the annotation descriptions remain the same after a round trip.
Describe the new feature or enhancement
When loading a SNIRF file via
mne.io.read_raw_snirf
, the descriptions forAnnotations
are currently extracted from the keys of the SNIRF stim indexed groups. According to the SNIRF file format spec, what is currently being extracted as the Annotation description is the index of the stim rather than a descriptive string.A better field to get a description from is the stimulus group
name
field which is described as:The proposed change is to get
Annotation
descriptions from the stimulus name rather than the index.Describe your proposed implementation
Update
RawSNIRF.__init__
lines 362:369 to take the description field from thename
field of the stim group rather than the stim group key.Describe possible alternatives
The descriptions can be left as-is. Although the match between an
Annotation
description and a SNIRF stimulus name isn't perfect, it seems like an improvement over using the stimulus index as-is.If the description is not changed, then tests for the MNE-NIRS SNIRF writer will need to be changed (see Additional comments below).
Additional comments
This is related to https://github.com/mne-tools/mne-nirs/pull/326, where the MNE-NIRS SNIRF writer is being updated to be more consistent with the SNIRF spec.
MNE-NIRS currently has tests which use the MNE-Python SNIRF reader to make a round trip write/read test. Resolving this issue will ensure that the annotation descriptions remain the same after a round trip.