A way to obtain ica.exclude selections without closing ica.plot_sources window?

  • MNE .240
  • Mac OS 11.6.1

This question is closely related to that at Obtaining bad channels and annotations from command line without closing plot window

In my tkinter GUI, I frequently need to retrieve the current selection of bad channels while the window is still open so I can execute a command from a pull-down menu. If my plot is labelled fig=raw.plot(), the current bad channels are given by bads=fig.mne.info['bads']

Iā€™m curious to know if there is something similar for determining the unselected components of a figure showing ICA sources. In particular, if ica is an instance of ICA and if

fig=ica.plot_sources(raw)

can one determine the current indices in ica.exclude without actually closing the figure?

@drammock do you know?

Maybe fig.mne.ica.exclude?

if I recall correctly, the ica.plot_sources GUI does not update the ICA object in real time, only when the plot is closed does that happen. It could be made to do so, and I think it was discussed before and nobody objected. @PaulF maybe you could make a PR to implement that?

1 Like