mne.preprocessing.corrmap(icas, template, threshold='auto', label=None, ch_type='eeg', plot=True, show=True, verbose=None, outlines='head', layout=None, sensors=True, contours=6, cmap=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:

icas : list of mne.preprocessing.ICA

A list of fitted ICA objects.

template : tuple | 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 find_outliers to identify ICs within subjects (not in original Corrmap) Defaults to “auto”.

label : None | 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’.

plot : bool

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

show : bool

Show figures if True.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more).

outlines : ‘head’ | dict | None

The outlines to be drawn. If ‘head’, a head scheme will be drawn. If dict, each key refers to a tuple of x and y positions. The values in ‘mask_pos’ will serve as image mask. If None, nothing will be drawn. Defaults to ‘head’. If dict, the ‘autoshrink’ (bool) field will trigger automated shrinking of the positions due to points outside the outline. Moreover, 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).

layout : None | Layout | list of Layout

Layout instance specifying sensor positions (does not need to be specified for Neuromag data). Or a list of Layout if projections are from different sensor types.

sensors : bool | 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.

contours : int | 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.

cmap : None | matplotlib colormap

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

template_fig : fig

Figure showing the template.

labelled_ics : fig

Figure showing the labelled ICs in all ICA decompositions.

Examples using mne.preprocessing.corrmap