Skip to content

[BUG] fNIRS nirx montage roundtrip failure #10585

@alexrockhill

Description

@alexrockhill

In running the following minimally reproducible example

import os.path as op
import mne
from mne.datasets.testing import data_path

testing_path = data_path(download=False)
fname_nirx_15_0 = op.join(
    testing_path, 'NIRx', 'nirscout', 'nirx_15_0_recording')

raw = mne.io.read_raw_nirx(fname_nirx_15_0)
montage = raw.get_montage()
raw.set_montage(montage)

I get the following stacktrace

ValueError                                Traceback (most recent call last)
<ipython-input-3-6ef838ccbf6c> in <module>
      9 raw = mne.io.read_raw_nirx(fname_nirx_15_0)
     10 montage = raw.get_montage()
---> 11 raw.set_montage(montage)

<decorator-gen-28> in set_montage(self, montage, match_case, match_alias, on_missing, verbose)

~/projects/mne-python/mne/io/meas_info.py in set_montage(self, montage, match_case, match_alias, on_missing, verbose)
    221         from ..channels.montage import _set_montage
    222         info = self if isinstance(self, Info) else self.info
--> 223         _set_montage(info, montage, match_case, match_alias, on_missing)
    224         return self
    225 

~/projects/mne-python/mne/channels/montage.py in _set_montage(***failed resolving arguments***)
   1094     fnirs_picks = _picks_to_idx(info, 'fnirs', allow_empty=True)
   1095     if len(fnirs_picks) > 0:
-> 1096         _set_montage_fnirs(info, mnt_head)
   1097 
   1098 

~/projects/mne-python/mne/channels/montage.py in _set_montage_fnirs(info, montage)
    875         ch = info['chs'][ch_idx]['ch_name']
    876         source, detector = ch.split(' ')[0].split('_')
--> 877         source_pos = montage.dig[montage.ch_names.index(source)
    878                                  + num_ficiduals]['r']
    879         detector_pos = montage.dig[montage.ch_names.index(detector)

ValueError: 'S1' is not in list

I don't know a whole lot about setting montages in fNIRS but this seems like an issue if you wanted to adjust coordinates let's say. If there's a reason fNIRS should not be able to go round-trip with a montage, perhaps a more informative error should be given as well. cc @rob-luke

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions