You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The read_snirf_aux_data() function works fine with this dataset that has strings in 1x1 array, but when the name of aux channel is scalar the _decode_name() function fails.
Describe the bug
According to the snirf spec strings should be stored as as scalars, not as 1x1 arrays.
The example aux dataset used in the aux tutorial has strings in 1x1 array.
The read_snirf_aux_data() function works fine with this dataset that has strings in 1x1 array, but when the name of aux channel is scalar the _decode_name() function fails.
mne-nirs/mne_nirs/io/snirf/_aux.py
Lines 62 to 63 in 2fdddfe
To properly retrieve the scalar string,
Steps to reproduce
Can use this file (ignore other possible issues with the file):
04_single.zip
Expected results
Should work since strings are stored as scalar, in accordance with snirf spec.
Actual results
Fail since _decode_name() only works on arrays
Additional information
Could add conditional to check if it's a scalar, and in that case handle it as such, e.g.:
def _decode_name(key):
if key.shape == ():
return key[()].decode()
else:
return np.array(key)[0].decode()
The text was updated successfully, but these errors were encountered: