Skip to content

Expand channel types supported for CSD plotting #13711

@tsbinns

Description

@tsbinns

Describe the new feature or enhancement

If info is provided when using mne.viz.plot_csd, it only looks for EEG and MEG channels to plot.

Describe your proposed implementation

Maybe there are some data channel types we don't want to extend this functionality too, but at least seeg, ecog, and dbs makes sense.

Could also improve DRY in the code:

mne-python/mne/viz/misc.py

Lines 1485 to 1506 in 8dd298f

if info is not None:
info_ch_names = info["ch_names"]
sel_eeg = pick_types(info, meg=False, eeg=True, ref_meg=False, exclude=[])
sel_mag = pick_types(info, meg="mag", eeg=False, ref_meg=False, exclude=[])
sel_grad = pick_types(info, meg="grad", eeg=False, ref_meg=False, exclude=[])
idx_eeg = [
csd.ch_names.index(info_ch_names[c])
for c in sel_eeg
if info_ch_names[c] in csd.ch_names
]
idx_mag = [
csd.ch_names.index(info_ch_names[c])
for c in sel_mag
if info_ch_names[c] in csd.ch_names
]
idx_grad = [
csd.ch_names.index(info_ch_names[c])
for c in sel_grad
if info_ch_names[c] in csd.ch_names
]
indices = [idx_eeg, idx_mag, idx_grad]
titles = ["EEG", "Magnetometers", "Gradiometers"]

Describe possible alternatives

N/A

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions