# mne.fit_dipole¶

mne.fit_dipole(evoked, cov, bem, trans=None, min_dist=5.0, n_jobs=1, pos=None, ori=None, verbose=None)[source]

Fit a dipole.

Parameters
evokedinstance of Evoked

The dataset to fit.

covstr | instance of Covariance

The noise covariance.

bemstr | instance of ConductorModel

The BEM filename (str) or conductor model.

trans

The head<->MRI transform filename. Must be provided unless BEM is a sphere model.

min_distfloat

Minimum distance (in millimeters) from the dipole to the inner skull. Must be positive. Note that because this is a constraint passed to a solver it is not strict but close, i.e. for a min_dist=5. the fits could be 4.9 mm from the inner skull.

n_jobsint

The number of jobs to run in parallel (default 1). Requires the joblib package. It is used in field computation and fitting.

posndarray, shape (3,) | None

Position of the dipole to use. If None (default), sequential fitting (different position and orientation for each time instance) is performed. If a position (in head coords) is given as an array, the position is fixed during fitting.

New in version 0.12.

orindarray, shape (3,) | None

Orientation of the dipole to use. If None (default), the orientation is free to change as a function of time. If an orientation (in head coordinates) is given as an array, pos must also be provided, and the routine computes the amplitude and goodness of fit of the dipole at the given position and orientation for each time instant.

New in version 0.12.

verbose

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

Returns
dipinstance of Dipole or DipoleFixed

The dipole fits. A mne.DipoleFixed is returned if pos and ori are both not None, otherwise a mne.Dipole is returned.

residualinstance of Evoked

The M-EEG data channels with the fitted dipolar activity removed.

Notes

New in version 0.9.0.