mne.channels.read_ch_adjacency#

mne.channels.read_ch_adjacency(fname, picks=None)[source]#

Read a channel adjacency (“neighbors”) file that ships with MNE.

More information on these neighbor definitions can be found on the related FieldTrip documentation pages.

Parameters:
fnamepath-like | str

The path to the file to load, or the name of a channel adjacency matrix that ships with MNE-Python.

Note

You can retrieve the names of all built-in channel adjacencies via mne.channels.get_builtin_ch_adjacencies().

pickslist of int | list of str | slice | None

Channels to include. Slices and lists of integers will be interpreted as channel indices. In lists, channel name strings (e.g., ['MEG0111', 'MEG2623'] will pick the given channels. None (default) will pick all channels. Note that channels in info['bads'] will be included if their names or indices are explicitly provided.

Returns:
ch_adjacencyscipy.sparse.csr_array, shape (n_channels, n_channels)

The adjacency matrix.

ch_nameslist

The list of channel names present in adjacency matrix.

Notes

If the neighbor definition you need is not shipped by MNE-Python, you may use find_ch_adjacency() to compute the adjacency matrix based on your 2D sensor locations.

Note that depending on your use case, you may need to additionally use mne.stats.combine_adjacency() to prepare a final “adjacency” to pass to the eventual function.