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:
icamne.preprocessing.ICA

Fitted ICA object.

infomne.Info

Channel info the ICA was fitted on (EEG channels only).

transstr | mne.transforms.Transform

Head-to-MRI transform. "fsaverage" uses MNE’s built-in template.

rv_threshfloat | None

Residual-variance threshold in [0, 1]. When set, components whose best-fitting dipole has RV >= rv_thresh are replaced by None in the output lists (flagged as non-dipolar). Typical value: 0.15 (15 %). None disables filtering.

n_dipolesint

Number of dipoles to fit per IC. 1 (default, and currently the only supported value) fits a single equivalent current dipole via mne.fit_dipole(). 2 is reserved for a future bilateral pair fit mirroring BeMoBIL’s number_of_dipoles=2 option – MNE has no built-in constrained two-dipole fit, so this is not yet implemented and currently raises NotImplementedError.

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 by None in the output lists.

Returns:
dipoleslist[mne.Dipole | None]

One entry per ICA component. Entries are None when the component was filtered by rv_thresh or remove_outside_head.

residualslist[mne.Evoked | None]

Residual field per component (None for filtered components).

Raises:
NotImplementedError

If n_dipoles=2 is requested (bilateral fitting is not yet implemented).

ValueError

If n_dipoles is not 1 or 2.