Open
Description
Description of the problem
With fNIRS files (in SNIRF format) mne_bids.read_raw_bids
is sorting channel names differently than channel locations, leading to mixed up channel distances. This can be reproduced for example using data from this tutorial.
Steps to reproduce
import mne
import mne_nirs
import mne_bids
root = mne_nirs.datasets.audio_or_visual_speech.data_path()
dataset = mne_bids.BIDSPath(
root=root,
suffix="nirs",
extension=".snirf",
subject="04",
task="AudioVisualBroadVsRestricted",
datatype="nirs",
session="01",
)
raw = mne_bids.read_raw_bids(bids_path=dataset)
print(mne.preprocessing.nirs.source_detector_distances(raw.info))
Expected results
We'd expect the same result as using mne.io.read_raw_snirf
raw = mne.io.read_raw_snirf(dataset.fpath)
print(mne.preprocessing.nirs.source_detector_distances(raw.info))
Actual results
mne_bids.read_raw_bids
is sorting channels differently than locations and the channel distances are mixed up.
Additional information
Seems to only be an issue when SNIRF files have a specific structure, which is the case for the dataset of the linked tutorial.