mne.epochs.average_movements(epochs, pos, orig_sfreq=None, picks=None, origin='auto', weight_all=True, int_order=8, ext_order=3, ignore_ref=False, return_mapping=False, verbose=None)

Average data using Maxwell filtering, transforming using head positions


epochs : instance of Epochs

The epochs to operate on.

pos : tuple

Tuple of position information as (trans, rot, t) like that returned by get_chpi_positions. The positions will be matched based on the last given position before the onset of the epoch.

orig_sfreq : float | None

The original sample frequency of the data (that matches the event sample numbers in Can be None if data have not been decimated or resampled.

picks : array-like of int | None

If None only MEG, EEG and SEEG channels are kept otherwise the channels indices in picks are kept.

origin : array-like, shape (3,) | str

Origin of internal and external multipolar moment space in head coords and in meters. The default is 'auto', which means a head-digitization-based origin fit.

weight_all : bool

If True, all channels are weighted by the SSS basis weights. If False, only MEG channels are weighted, other channels receive uniform weight per epoch.

int_order : int

Order of internal component of spherical expansion.

ext_order : int

Order of external component of spherical expansion.

regularize : str | None

Basis regularization type, must be “in” or None. See mne.preprocessing.maxwell_filter() for details. Regularization is chosen based only on the destination position.

ignore_ref : bool

If True, do not include reference channels in compensation. This option should be True for KIT files, since Maxwell filtering with reference channels is not currently supported.

return_mapping : bool

If True, return the mapping matrix.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose).


evoked : instance of Evoked

The averaged epochs.


The Maxwell filtering version of this algorithm is described in [R18], in section V.B “Virtual signals and movement correction”, equations 40-44. For additional validation, see [R19].

Regularization has not been added because in testing it appears to decrease dipole localization accuracy relative to using all components. Fine calibration and cross-talk cancellation, however, could be added to this algorithm based on user demand.

New in version 0.11.


[R18](1, 2) Taulu S. and Kajola M. “Presentation of electromagnetic multichannel data: The signal space separation method,” Journal of Applied Physics, vol. 97, pp. 124905 1-10, 2005.
[R19](1, 2) Wehner DT, Hämäläinen MS, Mody M, Ahlfors SP. “Head movements of children in MEG: Quantification, effects on source estimation, and compensation. NeuroImage 40:541–550, 2008.