mne.preprocessing.compute_maxwell_basis(info, origin='auto', int_order=8, ext_order=3, calibration=None, coord_frame='head', regularize='in', ignore_ref=True, bad_condition='error', mag_scale=100.0, extended_proj=(), verbose=None)[source]

Compute the SSS basis for a given measurement info structure.

infoinstance of Info

The measurement info.

originarray_like, shape (3,) | str

Origin of internal and external multipolar moment space in meters. The default is 'auto', which means (0., 0., 0.) when coord_frame='meg', and a head-digitization-based origin fit using fit_sphere_to_headshape() when coord_frame='head'. If automatic fitting fails (e.g., due to having too few digitization points), consider separately calling the fitting function with different options or specifying the origin manually.


Order of internal component of spherical expansion.


Order of external component of spherical expansion.

calibrationstr | None

Path to the '.dat' file with fine calibration coefficients. File can have 1D or 3D gradiometer imbalance correction. This file is machine/site-specific.


The coordinate frame that the origin is specified in, either 'meg' or 'head'. For empty-room recordings that do not have a head<->meg transform info['dev_head_t'], the MEG coordinate frame should be used.

regularizestr | None

Basis regularization type, must be “in” or None. “in” is the same algorithm as the “-regularize in” option in MaxFilter™.


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.


How to deal with ill-conditioned SSS matrices. Can be “error” (default), “warning”, “info”, or “ignore”.

mag_scalefloat | str

The magenetometer scale-factor used to bring the magnetometers to approximately the same order of magnitude as the gradiometers (default 100.), as they have different units (T vs T/m). Can be 'auto' to use the reciprocal of the physical distance between the gradiometer pickup loops (e.g., 0.0168 m yields 59.5 for VectorView).


The empty-room projection vectors used to extend the external SSS basis (i.e., use eSSS).

New in version 0.21.

verbosebool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more). If used, it should be passed as a keyword-argument only.

Sndarray, shape (n_meg, n_moments)

The basis that can be used to reconstruct the data.

pSndarray, shape (n_moments, n_good_meg)

The (stabilized) pseudoinverse of the S array.

reg_momentsndarray, shape (n_moments,)

The moments that were kept after regularization.


The number of kept moments that were in the internal space.


This outputs variants of \(\mathbf{S}\) and \(\mathbf{S^\dagger}\) from equations 27 and 37 of 1 with the coil scale for magnetometers already factored in so that the resulting denoising transform of the data to obtain \(\hat{\phi}_{in}\) from equation 38 would be:

phi_in = S[:, :n_use_in] @ pS[:n_use_in] @ data_meg_good

New in version 0.23.



Samu Taulu and Matti Kajola. Presentation of electromagnetic multichannel data: the signal space separation method. Journal of Applied Physics, 97(12):124905, 2005. doi:10.1063/1.1935742.