Dear all,
we’re trying to load .snirf data to mne-nirs, but get the following error(short) “IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed”. Please see below for the full version.
The snirf data is recorded over Aurora 2023. The aux data can be accessed from anywhere else e.g. Satori.
- MNE version: 1.8.0
- mne-nirs: 0.7.4
- operating system: MacOS 15.2
The code we use to load the file is pretty simple:
from mne.io import read_raw_nirx, read_raw_snirf
# snirf file look for ending with .snirf file in the directory
snirf_file_snirf = '*filename*.snirf'
snirf_intensity = read_raw_snirf(snirf_file_snirf)
from mne_nirs.io.snirf import read_snirf_aux_data
aux_df = read_snirf_aux_data(snirf_file_snirf, snirf_intensity)
The above code also still works for old recordings from last year made in Aurora 2021.
Since the data is still accessable from anywhere else we suspect a change of fnirs data structure in some way and also already contacted Aurora support, but just in case we also wanted to ask around if someone came across the same error also, since we havn’t found a proof of that assumption yet.
We would appreciate any kind of help or hint and please let me know if we can provide anything else that could help fixing that problem.
Kind Regards,
Joshi
Full version error code, just a little anonymized:
Loading [/Volumes/project/bids/sub\path/to/file/filename.snirf](https://file+.vscode-resource.vscode-cdn.net/Volumes/IMS_Drive3/project/bids/path/to/file/filename.snirf)
\--------------------------------------------------------------------------- IndexError Traceback (most recent call last) Cell In\[3\], [line 7](vscode-notebook-cell:?execution_count=3&line=7) [3](vscode-notebook-cell:?execution_count=3&line=3) snirf\_intensity \= read\_raw\_snirf(snirf\_file\_snirf) [5](vscode-notebook-cell:?execution_count=3&line=5) from mne\_nirs.io.snirf import read\_snirf\_aux\_data \----> [7](vscode-notebook-cell:?execution_count=3&line=7) aux\_df \= read\_snirf\_aux\_data(snirf\_file\_snirf, snirf\_intensity) File ~/anaconda3/envs/svwm/lib/python3.10/site-packages/mne\_nirs/io/snirf/\_aux.py:43, in read\_snirf\_aux\_data(fname, raw) [41](https://file+.vscode-resource.vscode-cdn.net/path/to/files/~/anaconda3/envs/svwm/lib/python3.10/site-packages/mne_nirs/io/snirf/_aux.py:41) all\_keys \= list(dat.get(basename).keys()) [42](https://file+.vscode-resource.vscode-cdn.net/path/to/files/~/anaconda3/envs/svwm/lib/python3.10/site-packages/mne_nirs/io/snirf/_aux.py:42) aux\_keys \= \[i for i in all\_keys if i.startswith("aux")\] \---> [43](https://file+.vscode-resource.vscode-cdn.net/path/to/files/~/anaconda3/envs/svwm/lib/python3.10/site-packages/mne_nirs/io/snirf/_aux.py:43) aux\_names \= \[\_decode\_name(dat.get(f"{basename}/{k}/name")) for k in aux\_keys\] [44](https://file+.vscode-resource.vscode-cdn.net/path/to/files/~/anaconda3/envs/svwm/lib/python3.10/site-packages/mne_nirs/io/snirf/_aux.py:44) logging.debug(f"Found auxiliary channels {aux\_names}") [46](https://file+.vscode-resource.vscode-cdn.net/path/to/files/~/anaconda3/envs/svwm/lib/python3.10/site-packages/mne_nirs/io/snirf/_aux.py:46) d \= {"times": raw.times} File ~/anaconda3/envs/svwm/lib/python3.10/site-packages/mne\_nirs/io/snirf/\_aux.py:43, in <listcomp>(.0) [41](https://file+.vscode-resource.vscode-cdn.net/path/to/files/~/anaconda3/envs/svwm/lib/python3.10/site-packages/mne_nirs/io/snirf/_aux.py:41) all\_keys \= list(dat.get(basename).keys()) [42](https://file+.vscode-resource.vscode-cdn.net/path/to/files/~/anaconda3/envs/svwm/lib/python3.10/site-packages/mne_nirs/io/snirf/_aux.py:42) aux\_keys \= \[i for i in all\_keys if i.startswith("aux")\] \---> [43](https://file+.vscode-resource.vscode-cdn.net/path/to/files/~/anaconda3/envs/svwm/lib/python3.10/site-packages/mne_nirs/io/snirf/_aux.py:43) aux\_names \= \[\_decode\_name(dat.get(f"{basename}/{k}/name")) for k in aux\_keys\] [44](https://file+.vscode-resource.vscode-cdn.net/path/to/files/~/anaconda3/envs/svwm/lib/python3.10/site-packages/mne_nirs/io/snirf/_aux.py:44) logging.debug(f"Found auxiliary channels {aux\_names}") [46](https://file+.vscode-resource.vscode-cdn.net/path/to/files/~/anaconda3/envs/svwm/lib/python3.10/site-packages/mne_nirs/io/snirf/_aux.py:46) d \= {"times": raw.times} File ~/anaconda3/envs/svwm/lib/python3.10/site-packages/mne\_nirs/io/snirf/\_aux.py:63, in \_decode\_name(key) [62](https://file+.vscode-resource.vscode-cdn.net/path/to/files/~/anaconda3/envs/svwm/lib/python3.10/site-packages/mne_nirs/io/snirf/_aux.py:62) def \_decode\_name(key): \---> [63](https://file+.vscode-resource.vscode-cdn.net/path/to/files/~/anaconda3/envs/svwm/lib/python3.10/site-packages/mne_nirs/io/snirf/_aux.py:63) return np.array(key)\[0\].decode() IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed