mne.Forward#

class mne.Forward[source]#

Forward class to represent info from forward solution.

Like mne.Info, this data structure behaves like a dictionary. It contains all metadata necessary for a forward solution.

Warning

This class should not be modified or created by users. Forward objects should be obtained using mne.make_forward_solution() or mne.read_forward_solution().

Attributes:
ch_nameslist of str

A convenience wrapper accessible as fwd.ch_names which wraps fwd['info']['ch_names'].

Methods

copy()

Copy the Forward instance.

pick_channels(ch_names[, ordered])

Pick channels from this forward operator.

save(fname, *[, overwrite, verbose])

Save the forward solution.

Notes

Forward data is accessible via string keys using standard dict access (e.g., fwd['nsource'] == 4096):

source_oriint

The source orientation, either FIFF.FIFFV_MNE_FIXED_ORI or FIFF.FIFFV_MNE_FREE_ORI.

coord_frameint

The coordinate frame of the forward solution, usually FIFF.FIFFV_COORD_HEAD.

nsourceint

The number of source locations.

nchanint

The number of channels.

soldict

The forward solution, with entries:

'data'ndarray, shape (n_channels, nsource * n_ori)

The forward solution data. The shape will be (n_channels, nsource) for a fixed-orientation forward and (n_channels, nsource * 3) for a free-orientation forward.

'row_names'list of str

The channel names.

mri_head_tinstance of Transform

The mri ↔ head transformation that was used.

infoinstance of Info

The measurement information (with contents reduced compared to that of the original data).

srcinstance of SourceSpaces

The source space used during forward computation. This can differ from the original source space as:

  1. Source points are removed due to proximity to (or existing outside) the inner skull surface.

  2. The source space will be converted to the coord_frame of the forward solution, which typically means it gets converted from MRI to head coordinates.

source_rrndarray, shape (n_sources, 3)

The source locations.

source_nnndarray, shape (n_sources, 3)

The source normals. Will be all +Z ((0, 0, 1.)) for volume source spaces. For surface source spaces, these are normal to the cortical surface.

surf_oriint

Whether sol is surface-oriented with the surface normal in the Z component (FIFF.FIFFV_MNE_FIXED_ORI) or +Z in the given coord_frame in the Z component (FIFF.FIFFV_MNE_FREE_ORI).

Forward objects also have some attributes that are accessible via . access, like fwd.ch_names.

copy()[source]#

Copy the Forward instance.

pick_channels(ch_names, ordered=False)[source]#

Pick channels from this forward operator.

Parameters:
ch_nameslist of str

List of channels to include.

orderedbool

If true (default False), treat include as an ordered list rather than a set.

Returns:
fwdinstance of Forward.

The modified forward model.

Notes

Operates in-place.

New in v0.20.0.

save(fname, *, overwrite=False, verbose=None)[source]#

Save the forward solution.

Parameters:
fnamepath-like

File name to save the forward solution to. It should end with -fwd.fif or -fwd.fif.gz to save to FIF, or -fwd.h5 to save to HDF5.

overwritebool

If True (default False), overwrite the destination file if it exists.

verbosebool | str | int | None

Control verbosity of the logging output. If None, use the default verbosity level. See the logging documentation and mne.verbose() for details. Should only be passed as a keyword argument.

Examples using mne.Forward#

Getting started with mne.Report

Getting started with mne.Report

Setting the EEG reference

Setting the EEG reference

Preprocessing optically pumped magnetometer (OPM) MEG data

Preprocessing optically pumped magnetometer (OPM) MEG data

Head model and forward computation

Head model and forward computation

EEG forward operator with a template MRI

EEG forward operator with a template MRI

Source localization with equivalent current dipole (ECD) fit

Source localization with equivalent current dipole (ECD) fit

The role of dipole orientations in distributed source localization

The role of dipole orientations in distributed source localization

EEG source localization given electrode locations on an MRI

EEG source localization given electrode locations on an MRI

Corrupt known signal with point spread

Corrupt known signal with point spread

DICS for power mapping

DICS for power mapping

Compare simulated and estimated source activity

Compare simulated and estimated source activity

Generate simulated evoked data

Generate simulated evoked data

Generate simulated raw data

Generate simulated raw data

Simulate raw data using subject anatomy

Simulate raw data using subject anatomy

Generate simulated source data

Generate simulated source data

Cortical Signal Suppression (CSS) for removal of cortical signals

Cortical Signal Suppression (CSS) for removal of cortical signals

Sensitivity map of SSP projections

Sensitivity map of SSP projections

Display sensitivity maps for EEG and MEG sensors

Display sensitivity maps for EEG and MEG sensors

Use source space morphing

Use source space morphing

Source localization with a custom inverse solver

Source localization with a custom inverse solver

Compute source level time-frequency timecourses using a DICS beamformer

Compute source level time-frequency timecourses using a DICS beamformer

Compute evoked ERS source power using DICS, LCMV beamformer, and dSPM

Compute evoked ERS source power using DICS, LCMV beamformer, and dSPM

Compute a sparse inverse solution using the Gamma-MAP empirical Bayesian method

Compute a sparse inverse solution using the Gamma-MAP empirical Bayesian method

Compute sparse inverse solution with mixed norm: MxNE and irMxNE

Compute sparse inverse solution with mixed norm: MxNE and irMxNE

Compute source power estimate by projecting the covariance with MNE

Compute source power estimate by projecting the covariance with MNE

Morph surface source estimate

Morph surface source estimate

Computing source timecourses with an XFit-like multi-dipole model

Computing source timecourses with an XFit-like multi-dipole model

Compute iterative reweighted TF-MxNE with multiscale time-frequency dictionary

Compute iterative reweighted TF-MxNE with multiscale time-frequency dictionary

Plot point-spread functions (PSFs) and cross-talk functions (CTFs)

Plot point-spread functions (PSFs) and cross-talk functions (CTFs)

Compute cross-talk functions for LCMV beamformers

Compute cross-talk functions for LCMV beamformers

Plot point-spread functions (PSFs) for a volume

Plot point-spread functions (PSFs) for a volume

Compute Rap-Music on evoked data

Compute Rap-Music on evoked data

Compute spatial resolution metrics to compare MEG with EEG+MEG

Compute spatial resolution metrics to compare MEG with EEG+MEG

Computing source space SNR

Computing source space SNR

Compute MxNE with time-frequency sparse prior

Compute MxNE with time-frequency sparse prior

Compute Trap-Music on evoked data

Compute Trap-Music on evoked data

From raw data to dSPM on SPM Faces dataset

From raw data to dSPM on SPM Faces dataset