mne.preprocessing.compute_maxwell_basis#
- 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.
- Parameters:
- info
mne.Info
The
mne.Info
object with information about the sensors and methods of measurement.- originarray_like, shape (3,) |
str
Origin of internal and external multipolar moment space in meters. The default is
'auto'
, which means(0., 0., 0.)
whencoord_frame='meg'
, and a head-digitization-based origin fit usingfit_sphere_to_headshape()
whencoord_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.- int_order
int
Order of internal component of spherical expansion.
- ext_order
int
Order of external component of spherical expansion.
- calibration
str
|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.- coord_frame
str
The coordinate frame that the
origin
is specified in, either'meg'
or'head'
. For empty-room recordings that do not have a head<->meg transforminfo['dev_head_t']
, the MEG coordinate frame should be used.- regularize
str
|None
Basis regularization type, must be “in” or None. “in” is the same algorithm as the “-regularize in” option in MaxFilter™.
- 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.
- bad_condition
str
How to deal with ill-conditioned SSS matrices. Can be “error” (default), “warning”, “info”, or “ignore”.
- mag_scale
float
|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).- extended_proj
list
The empty-room projection vectors used to extend the external SSS basis (i.e., use eSSS).
New in version 0.21.
- verbose
bool
|str
|int
|None
Control verbosity of the logging output. If
None
, use the default verbosity level. See the logging documentation andmne.verbose()
for details. Should only be passed as a keyword argument.
- info
- Returns:
- S
ndarray
, shape (n_meg, n_moments) The basis that can be used to reconstruct the data.
- pS
ndarray
, shape (n_moments, n_good_meg) The (stabilized) pseudoinverse of the S array.
- reg_moments
ndarray
, shape (n_moments,) The moments that were kept after regularization.
- n_use_in
int
The number of kept moments that were in the internal space.
- S
Notes
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.
References