Skip to content

Inverse solution

loose module-attribute

Python
loose: Annotated[float, Interval(ge=0, le=1)] | Literal['auto'] = 0.2

A value between 0 and 1 that weights the source variances of the dipole components that are parallel (tangential) to the cortical surface.

If 0, then the inverse solution is computed with fixed orientation, i.e., only dipole components perpendicular to the cortical surface are considered.

If 1, it corresponds to free orientation, i.e., dipole components with any orientation are considered.

The default value, 0.2, is suitable for surface-oriented source spaces.

For volume or mixed source spaces, choose 1.0.

Info

Support for modeling volume and mixed source spaces will be added in a future version of MNE-BIDS-Pipeline.

Pipeline steps using this setting

The following steps are directly affected by changes to loose:

  • source/_05_make_inverse

depth module-attribute

Python
depth: Annotated[float, Interval(ge=0, le=1)] | dict = 0.8

If a number, it acts as the depth weighting exponent to use (must be between 0 and1), with0 meaning no depth weighting is performed.

Can also be a dictionary containing additional keyword arguments to pass to mne.forward.compute_depth_prior (see docstring for details and defaults).

Pipeline steps using this setting

The following steps are directly affected by changes to depth:

  • source/_05_make_inverse

inverse_method module-attribute

Python
inverse_method: Literal['MNE', 'dSPM', 'sLORETA', 'eLORETA'] = 'dSPM'

Use minimum norm, dSPM (default), sLORETA, or eLORETA to calculate the inverse solution.

Pipeline steps using this setting

The following steps are directly affected by changes to inverse_method:

  • source/_05_make_inverse
  • source/_99_group_average

noise_cov module-attribute

Python
noise_cov: (
    tuple[float | None, float | None]
    | Literal["emptyroom", "rest", "ad-hoc"]
    | Callable[[BIDSPath], Covariance]
) = (None, 0)

Specify how to estimate the noise covariance matrix, which is used in inverse modeling.

If a tuple, it takes the form (tmin, tmax) with the time specified in seconds. If the first value of the tuple is None, the considered period starts at the beginning of the epoch. If the second value of the tuple is None, the considered period ends at the end of the epoch. The default, (None, 0), includes the entire period before the event, which is typically the pre-stimulus period.

If 'emptyroom', the noise covariance matrix will be estimated from an empty-room MEG recording. The empty-room recording will be automatically selected based on recording date and time. This cannot be used with EEG data.

If 'rest', the noise covariance will be estimated from a resting-state recording (i.e., a recording with task-rest and without a run in the filename).

If 'ad-hoc', a diagonal ad-hoc noise covariance matrix will be used.

You can also pass a function that accepts a BIDSPath and returns an mne.Covariance instance. The BIDSPath will point to the file containing the generated evoked data.

Example

Use the period from start of the epoch until 100 ms before the experimental event:

Python
noise_cov = (None, -0.1)

Use the time period from the experimental event until the end of the epoch:

Python
noise_cov = (0, None)

Use an empty-room recording:

Python
noise_cov = 'emptyroom'

Use a resting-state recording:

Python
noise_cov = 'rest'

Use an ad-hoc covariance:

Python
noise_cov = 'ad-hoc'

Use a custom covariance derived from raw data:

Python
def noise_cov(bids_path):
    bp = bids_path.copy().update(task='rest', run=None, suffix='meg')
    raw_rest = mne_bids.read_raw_bids(bp)
    raw.crop(tmin=5, tmax=60)
    cov = mne.compute_raw_covariance(raw, rank='info')
    return cov

Pipeline steps using this setting

The following steps are directly affected by changes to noise_cov:

  • preprocessing/_07_make_epochs
  • sensor/_01_make_evoked
  • sensor/_06_make_cov
  • source/_04_make_forward
  • source/_05_make_inverse

noise_cov_method module-attribute

Python
noise_cov_method: Literal[
    "shrunk",
    "empirical",
    "diagonal_fixed",
    "oas",
    "ledoit_wolf",
    "factor_analysis",
    "shrinkage",
    "pca",
    "auto",
] = "shrunk"

The noise covariance estimation method to use. See the MNE-Python documentation of mne.compute_covariance for details.

Pipeline steps using this setting

The following steps are directly affected by changes to noise_cov_method:

  • sensor/_06_make_cov

source_info_path_update module-attribute

Python
source_info_path_update: dict[str, str] | None = None

When computing the forward and inverse solutions, it is important to provide the mne.Info object from the data on which the noise covariance was computed, to avoid problems resulting from mismatching ranks. This parameter allows you to explicitly specify from which file to retrieve the mne.Info object. Use this parameter to supply a dictionary to BIDSPath.update() during the forward and inverse processing steps. If set to None (default), the info will be retrieved either from the raw file specified in noise_cov, or the cleaned evoked (if noise_cov is None or ad-hoc).

Example

Use the Info object stored in the cleaned epochs:

Python
source_info_path_update = {'processing': 'clean',
                           'suffix': 'epo'}

Use the Info object stored in a raw file (e.g. resting state):

Python
source_info_path_update = {'processing': 'clean',
                            'suffix': 'raw',
                            'task': 'rest'}
If you set noise_cov = 'rest' and source_path_info = None, then the behavior is identical to that above (it will automatically use the resting state data).

Pipeline steps using this setting

The following steps are directly affected by changes to source_info_path_update:

  • source/_04_make_forward
  • source/_05_make_inverse

inverse_targets module-attribute

Python
inverse_targets: list[Literal['evoked']] = ['evoked']

On which data to apply the inverse operator. Currently, the only supported target is 'evoked'. If no inverse computation should be done, pass an empty list, [].

Example

Compute the inverse solution on evoked data:

Python
inverse_targets = ['evoked']

Don't compute an inverse solution:

Python
inverse_targets = []

Pipeline steps using this setting

The following steps are directly affected by changes to inverse_targets:

  • source/_05_make_inverse