mne.preprocessing.corrmap#

mne.preprocessing.corrmap(icas, template, threshold='auto', label=None, ch_type='eeg', plot=True, show=True, outlines='head', sensors=True, contours=6, cmap=None, sphere=None, verbose=None)[source]#

Find similar Independent Components across subjects by map similarity.

Corrmap (Viola et al. 2009 Clin Neurophysiol) identifies the best group match to a supplied template. Typically, feed it a list of fitted ICAs and a template IC, for example, the blink for the first subject, to identify specific ICs across subjects.

The specific procedure consists of two iterations. In a first step, the maps best correlating with the template are identified. In the next step, the analysis is repeated with the mean of the maps identified in the first stage.

Run with plot and show set to True and label=False to find good parameters. Then, run with labelling enabled to apply the labelling in the IC objects. (Running with both plot and labels off does nothing.)

Outputs a list of fitted ICAs with the indices of the marked ICs in a specified field.

The original Corrmap website: www.debener.de/corrmap/corrmapplugin1.html

Parameters
icaslist of mne.preprocessing.ICA

A list of fitted ICA objects.

templatetuple | np.ndarray, shape (n_components,)

Either a tuple with two elements (int, int) representing the list indices of the set from which the template should be chosen, and the template. E.g., if template=(1, 0), the first IC of the 2nd ICA object is used. Or a numpy array whose size corresponds to each IC map from the supplied maps, in which case this map is chosen as the template.

threshold“auto” | list of float | float

Correlation threshold for identifying ICs If “auto”, search for the best map by trying all correlations between 0.6 and 0.95. In the original proposal, lower values are considered, but this is not yet implemented. If list of floats, search for the best map in the specified range of correlation strengths. As correlation values, must be between 0 and 1 If float > 0, select ICs correlating better than this. If float > 1, use z-scoring to identify ICs within subjects (not in original Corrmap) Defaults to “auto”.

labelNone | str

If not None, categorised ICs are stored in a dictionary labels_ under the given name. Preexisting entries will be appended to (excluding repeats), not overwritten. If None, a dry run is performed and the supplied ICs are not changed.

ch_type‘mag’ | ‘grad’ | ‘planar1’ | ‘planar2’ | ‘eeg’

The channel type to plot. Defaults to ‘eeg’.

plotbool

Should constructed template and selected maps be plotted? Defaults to True.

showbool

Show figures if True.

outlines‘head’ | ‘skirt’ | dict | None

The outlines to be drawn. If ‘head’, the default head scheme will be drawn. If ‘skirt’ the head scheme will be drawn, but sensors are allowed to be plotted outside of the head circle. If dict, each key refers to a tuple of x and y positions, the values in ‘mask_pos’ will serve as image mask. Alternatively, a matplotlib patch object can be passed for advanced masking options, either directly or as a function that returns patches (required for multi-axis plots). If None, nothing will be drawn. Defaults to ‘head’.

sensorsbool | str

Add markers for sensor locations to the plot. Accepts matplotlib plot format string (e.g., ‘r+’ for red plusses). If True, a circle will be used (via .add_artist). Defaults to True.

contoursint | array of float

The number of contour lines to draw. If 0, no contours will be drawn. When an integer, matplotlib ticker locator is used to find suitable values for the contour thresholds (may sometimes be inaccurate, use array for accuracy). If an array, the values represent the levels for the contours. Defaults to 6.

cmapNone | matplotlib colormap

Colormap for the plot. If None, defaults to ‘Reds_r’ for norm data, otherwise to ‘RdBu_r’.

spherefloat | array-like | str | None

The sphere parameters to use for the cartoon head. Can be array-like of shape (4,) to give the X/Y/Z origin and radius in meters, or a single float to give the radius (origin assumed 0, 0, 0). Can also be a spherical ConductorModel, which will use the origin and radius. Can be “auto” to use a digitization-based fit. Can also be None (default) to use ‘auto’ when enough extra digitization points are available, and 0.095 otherwise. Currently the head radius does not affect plotting.

New in version 0.20.

verbosebool | str | int | None

Control verbosity of the logging output. If None, use the default verbosity level. See the logging documentation and mne.verbose() for details. Should only be passed as a keyword argument.

Returns
template_figFigure

Figure showing the template.

labelled_icsFigure

Figure showing the labelled ICs in all ICA decompositions.

Examples using mne.preprocessing.corrmap#

Repairing artifacts with ICA

Repairing artifacts with ICA

Repairing artifacts with ICA