osl_ephys.preprocessing.plot_ica#
Plotting functions for ICA.
Attributes#
Classes#
OSL's adaptatation of MNE's mne.viz._mpl_figure.MNEBrowseFigure that |
Functions#
|
osl-ephys' adaptation of MNE's |
|
Adaptation of MNE's mne.preprocessing.ica._plot_sources function to allow for OSL additions. |
|
OSL Adaptation of MNE's mne.viz._figure._get_browser function |
|
|
|
Flatten a list using recursion. |
|
Plot average over epochs in ICA space. |
Module Contents#
- osl_ephys.preprocessing.plot_ica.backends_to_try = ['Qt5Agg', 'QtAgg', 'GTK3Agg', 'GTK4Agg', 'macosx', 'TkAgg', 'GTK3Cairo', 'GTK4Cairo', 'wxAgg'][source]#
- osl_ephys.preprocessing.plot_ica.plot_ica(ica, inst, picks=None, start=None, stop=None, title=None, show=True, block=False, show_first_samp=False, show_scrollbars=True, time_format='float', n_channels=10, bad_labels_list=['eog', 'ecg', 'emg', 'hardware', 'other'])[source]#
osl-ephys’ adaptation of MNE’s
mne.preprocessing.ICA.plot_sourcesfunction to plot estimated latent sources given the unmixing matrix.Typical usecases:
plot evolution of latent sources over time based on (Raw input)
plot latent source around event related time windows (Epochs input)
plot time-locking in ICA space (Evoked input)
- Parameters:
ica (
mne.preprocessing.ICA.) – The ICA solution.inst (
mne.io.Raw,mne.Epochs, ormne.Evoked.) – The object to plot the sources from.picks (str) – Channel types to pick.
start (float | int | None) – If
instis amne.io.Rawor anmne.Evokedobject, the first and last time point (in seconds) of the data to plot. Ifinstis amne.io.Rawobject,start=Noneandstop=Nonewill be translated intostart=0.andstop=3., respectively. Formne.Evoked,Nonerefers to the beginning and end of the evoked signal. Ifinstis anmne.Epochsobject, specifies the index of the first and last epoch to show.stop (float | int | None) – If
instis amne.io.Rawor anmne.Evokedobject, the first and last time point (in seconds) of the data to plot. Ifinstis amne.io.Rawobject,start=Noneandstop=Nonewill be translated intostart=0.andstop=3., respectively. Formne.Evoked,Nonerefers to the beginning and end of the evoked signal. Ifinstis anmne.Epochsobject, specifies the index of the first and last epoch to show.title (str | None) – The window title. If None a default is provided.
show (bool) – Show figure if True.
block (bool) – Whether to halt program execution until the figure is closed. Useful for interactive selection of components in raw and epoch plotter. For evoked, this parameter has no effect. Defaults to False.
show_first_samp (bool) – If True, show time axis relative to the
raw.first_samp.n_channels (int) – Number of channels to show at the same time (default: 10)
bad_labels_list (list of str) – list of bad labels to show in the bad labels list that can be used to mark the type of bad component. Defaults to
["eog", "ecg", "emg", "hardware", "other"].
- Returns:
fig – The figure.
- Return type:
instance of Figure
Notes
For raw and epoch instances, it is possible to select components for exclusion by clicking on the line. The selected components are added to
ica.excludeon close.New in version 0.10.0.
- osl_ephys.preprocessing.plot_ica._plot_sources(ica, inst, picks, exclude, start, stop, show, title, block, show_scrollbars, show_first_samp, time_format, n_channels, bad_labels_list)[source]#
Adaptation of MNE’s mne.preprocessing.ica._plot_sources function to allow for OSL additions.
- osl_ephys.preprocessing.plot_ica._get_browser(**kwargs)[source]#
OSL Adaptation of MNE’s mne.viz._figure._get_browser function that instantiate a new MNE browse-style figure.
- class osl_ephys.preprocessing.plot_ica.osl_MNEBrowseFigure(inst, figsize, ica=None, xlabel='Time (s)', **kwargs)[source]#
Bases:
mne.viz._mpl_figure.MNEBrowseFigureOSL’s adaptatation of MNE’s mne.viz._mpl_figure.MNEBrowseFigure that creates an interactive figure with scrollbars, for data browsing.
- osl_ephys.preprocessing.plot_ica._plot_ica_sources_evoked(evoked, picks, exclude, title, show, ica, labels=None, n_channels=10, bad_labels_list=None)[source]#
Plot average over epochs in ICA space.
- Parameters:
evoked (instance of mne.Evoked) – The Evoked to be used.
fitted. (%(picks_base)s all sources in the order as) –
exclude (array-like of int) – The components marked for exclusion. If None (default), ICA.exclude will be used.
title (str) – The figure title.
show (bool) – Show figure if True.
labels (None | dict) – The ICA labels attribute.