eegdash.io.fnirs_montage module#

Channel positions of an fNIRS recording from its dataset’s montage derivative.

MNE-BIDS 0.20 reads no optodes.tsv for NIRS (read_raw_bids applies electrodes.tsv for MEG, EEG and iEEG only), so MNE has only the SNIRF probe’s positions, in whatever frame the file uses. The fNIRS deposits on NEMAR carry a derivative with every montage mapped to one space (fsaverage MRI, mm):

derivatives/fnirs-montage/
    montage_recordings.tsv              recording -> montage_id (written yes/no)
    montages.tsv                        montage_id -> tier, method, channels_table
    montages/<montage_id>_channels.tsv  name, source, detector, x, y, z, ...
    montages/channels.json              column descriptions and units

read_fnirs_montage() returns a recording’s channel table aligned to raw.ch_names. It only reads: raw.info is not touched, MNE’s channel locations stay the SNIRF probe’s, in the probe’s frame, and the derivative’s positions stay in the derivative’s space.

eegdash.io.fnirs_montage.read_fnirs_montage(root, recording, ch_names, *, derivative='fnirs-montage')[source]

Return the montage derivative’s channel table for recording, one row per channel.

Parameters:
  • root (path-like) – The BIDS dataset root, the folder holding derivatives/.

  • recording (path-like) – The recording’s data file, relative to root (record["bids_relpath"]) or an absolute path inside it.

  • ch_names (list of str) – The names to align to, usually raw.ch_names. Channels are matched by MNE’s fNIRS name, S<i>_D<j> <wavelength|hbo|hbr>, ignoring case.

  • derivative (str) – The derivative’s folder name under derivatives/.

Returns:

Indexed by ch_names, in their order, with the table’s columns; x, y, z (channel midpoints) are floats. A channel the table does not have, or has as n/a, gets NaN. attrs holds montage_id, tier, heuristic, method, units and table (the file read). None when the derivative has no montage written for the recording.

Return type:

pandas.DataFrame | None