mne.do_forward_solution

mne.do_forward_solution(subject, meas, fname=None, src=None, spacing=None, mindist=None, bem=None, mri=None, trans=None, eeg=True, meg=True, fixed=False, grad=False, mricoord=False, overwrite=False, subjects_dir=None, verbose=None)

Calculate a forward solution for a subject using MNE-C routines

This function wraps to mne_do_forward_solution, so the mne command-line tools must be installed and accessible from Python.

Parameters:

subject : str

Name of the subject.

meas : Raw | Epochs | Evoked | str

If Raw or Epochs, a temporary evoked file will be created and saved to a temporary directory. If str, then it should be a filename to a file with measurement information the mne command-line tools can understand (i.e., raw or evoked).

fname : str | None

Destination forward solution filename. If None, the solution will be created in a temporary directory, loaded, and deleted.

src : str | None

Source space name. If None, the MNE default is used.

spacing : str

The spacing to use. Can be '#' for spacing in mm, 'ico#' for a recursively subdivided icosahedron, or 'oct#' for a recursively subdivided octahedron (e.g., spacing='ico4'). Default is 7 mm.

mindist : float | str | None

Minimum distance of sources from inner skull surface (in mm). If None, the MNE default value is used. If string, ‘all’ indicates to include all points.

bem : str | None

Name of the BEM to use (e.g., “sample-5120-5120-5120”). If None (Default), the MNE default will be used.

mri : str | None

The name of the trans file in FIF format. If None, trans must not be None.

trans : dict | str | None

File name of the trans file in text format. If None, mri must not be None.

eeg : bool

If True (Default), include EEG computations.

meg : bool

If True (Default), include MEG computations.

fixed : bool

If True, make a fixed-orientation forward solution (Default: False). Note that fixed-orientation inverses can still be created from free-orientation forward solutions.

grad : bool

If True, compute the gradient of the field with respect to the dipole coordinates as well (Default: False).

mricoord : bool

If True, calculate in MRI coordinates (Default: False).

overwrite : bool

If True, the destination file (if it exists) will be overwritten. If False (default), an error will be raised if the file exists.

subjects_dir : None | str

Override the SUBJECTS_DIR environment variable.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose).

Returns:

fwd : dict

The generated forward solution.

See also

forward.make_forward_solution