ICAPipeο
Tip
π‘ Usage Examples - See the notebook for usage examples and code snippets: ICA
- class sleepeegpy.pipeline.ICAPipe(prec_pipe=None, path_to_eeg='', output_dir='', method='fastica', n_components=None, fit_params=None, path_to_ica=None, **ica_kwargs)[source]ο
 Bases:
BasePipeThe ICA pipeline element.
Contains ica fitting, plotting multiple ica plots, selecting ica exclusion components and its application to the raw data. More at
mne.preprocessing.ICA.Methods:
A wrapper for
mne.preprocessing.ICA.apply().High-pass filters (1 Hz) a copy of the mne_raw object and then runs
mne.preprocessing.ICA.fit()on it.A wrapper for
mne.io.Raw.interpolate_bads()A wrapper for
mne.io.Raw.plot().A wrapper for
mne.preprocessing.ICA.plot_components().A wrapper for
mne.preprocessing.ICA.plot_properties().A wrapper for
mne.viz.plot_sensors()with a legend.A wrapper for
mne.preprocessing.ICA.plot_sources().A wrapper for
mne.preprocessing.ICA.save().A wrapper for
mne.io.Raw.save().A wrapper for
mne.io.Raw.set_eeg_reference().Attributes:
Instance of
mne.preprocessing.ICA.Calculates percent of data segments annotated as BAD.
A wrapper for
raw.info["sfreq"].Preceding pipe that hands over mne_raw object and output_dir.
Can be any eeg file type supported by
mne.io.read_raw().Path to the directory where the output will be saved.
An instanse of
mne.io.Raw.- 
mne_ica: 
ICA[source]ο Instance of
mne.preprocessing.ICA.
- fit(filter_kwargs=None, **fit_kwargs)[source]ο
 High-pass filters (1 Hz) a copy of the mne_raw object and then runs
mne.preprocessing.ICA.fit()on it.- Parameters:
 filter_args β Arguments passed to
mne.io.Raw.filter(). Defaults to None.**fit_kwargs β Arguments passed to
mne.preprocessing.ICA.fit().
- plot_sources(**kwargs)[source]ο
 A wrapper for
mne.preprocessing.ICA.plot_sources().
- plot_components(save=False, **kwargs)[source]ο
 A wrapper for
mne.preprocessing.ICA.plot_components().
- plot_properties(picks=None, save=False, **kwargs)[source]ο
 A wrapper for
mne.preprocessing.ICA.plot_properties().
- apply(exclude=None, **kwargs)[source]ο
 A wrapper for
mne.preprocessing.ICA.apply().
- save_ica(fname='data-ica.fif', overwrite=False)[source]ο
 A wrapper for
mne.preprocessing.ICA.save().- Parameters:
 fname (
str) β filename for the ica file being saved. Defaults to βdata-ica.fifβ.overwrite (
bool) β Whether to overwrite the file. Defaults to False.
- property bad_data_percent[source]ο
 Calculates percent of data segments annotated as BAD.
- Returns:
 percent of bad data spans in raw data
- Return type:
 float
- interpolate_bads(**interp_kwargs)[source]ο
 A wrapper for
mne.io.Raw.interpolate_bads()- Parameters:
 **interp_kwargs β Arguments passed to
mne.io.Raw.interpolate_bads().
- plot(save_annotations=False, save_bad_channels=False, overwrite=False, **kwargs)[source]ο
 A wrapper for
mne.io.Raw.plot().- Parameters:
 save_annotations (
bool) β Whether to save annotations as txt. Defaults to False.save_bad_channels (
bool) β Whether to save bad channels as txt. Defaults to False.overwrite (
bool) β Whether to overwrite annotations and bad_channels files if exist. Defaults to False.**kwargs β Arguments passed to
mne.io.Raw.plot().
- plot_sensors(legend=None, legend_args=None, **kwargs)[source]ο
 A wrapper for
mne.viz.plot_sensors()with a legend.- Parameters:
 legend (
Iterable[str]) β ch_groups names to connect to colors. Defaults to None.legend_args (
dict) β Arguments passed tomatplotlib.axes.Axes.legend(). Defaults to None.**kwargs β Arguments passed to
mne.viz.plot_sensors().
- save_raw(fname, **kwargs)[source]ο
 A wrapper for
mne.io.Raw.save().- Parameters:
 fname (
str) β Filename for the fif file being saved.**kwargs β Arguments passed to
mne.io.Raw.save().
- set_eeg_reference(ref_channels='average', projection=False, **kwargs)[source]ο
 A wrapper for
mne.io.Raw.set_eeg_reference().- Parameters:
 ref_channels β
ref_channels. Defaults to βaverageβ.projection β
projection. Defaults to False.**kwargs β Additional arguments passed to
mne.io.Raw.set_eeg_reference().
- property sf[source]ο
 A wrapper for
raw.info["sfreq"].- Returns:
 sampling frequency
- Return type:
 float
- prec_pipe: Type[BasePipeType]ο
 Preceding pipe that hands over mne_raw object and output_dir.
- path_to_eeg: Pathο
 Can be any eeg file type supported by
mne.io.read_raw().
- output_dir: Pathο
 Path to the directory where the output will be saved.
- mne_raw: mne.io.Rawο
 An instanse of
mne.io.Raw.
- 
mne_ica: