bemobil_mne.preproc.fit_dipoles_on_ica#
- bemobil_mne.preproc.fit_dipoles_on_ica(ica, info, trans='fsaverage', rv_thresh=None, n_dipoles=1, remove_outside_head=False)[source]#
Fit one or two dipoles to each ICA component topography.
Uses the fsaverage BEM and template head-to-MRI transform by default, so no individual MRI is required.
- Parameters:
- ica
mne.preprocessing.ICA Fitted ICA object.
- info
mne.Info Channel info the ICA was fitted on (EEG channels only).
- trans
str|mne.transforms.Transform Head-to-MRI transform.
"fsaverage"uses MNE’s built-in template.- rv_thresh
float|None Residual-variance threshold in [0, 1]. When set, components whose best-fitting dipole has RV >= rv_thresh are replaced by
Nonein the output lists (flagged as non-dipolar). Typical value:0.15(15 %).Nonedisables filtering.- n_dipoles
int Number of dipoles to fit per IC.
1(default, and currently the only supported value) fits a single equivalent current dipole viamne.fit_dipole().2is reserved for a future bilateral pair fit mirroring BeMoBIL’snumber_of_dipoles=2option – MNE has no built-in constrained two-dipole fit, so this is not yet implemented and currently raisesNotImplementedError.- remove_outside_headbool
If
True, components whose best-fitting dipole is located outside the head model (norm of position > 0.13 m from the origin) are replaced byNonein the output lists.
- ica
- Returns:
- dipoles
list[mne.Dipole|None] One entry per ICA component. Entries are
Nonewhen the component was filtered by rv_thresh or remove_outside_head.- residuals
list[mne.Evoked|None] Residual field per component (
Nonefor filtered components).
- dipoles
- Raises:
NotImplementedErrorIf
n_dipoles=2is requested (bilateral fitting is not yet implemented).ValueErrorIf n_dipoles is not
1or2.