osl_ephys.source_recon.minimum_norm#

Minimum norm source localization using MNE-Python.

Attributes#

logger

Functions#

get_mne_filenames(subjects_dir, subject)

Get minimum norm (MNE) filenames.

create_inverse_operator(fwd, data, chantypes, rank, ...)

Creates minimum norm (MNE) inverse operator.

apply_inverse_operator_surf(outdir, subject, data, ...)

Apply previously computed minimum norm inverse solution (surface).

apply_inverse_operator_vol(outdir, subject, data, ...)

Apply previously computed minimum norm inverse solution (volumetric).

calc_noise_cov(data, data_cov_rank, chantypes)

Calculate noise covariance.

morph_surface(subjects_dir, subject, src_from[, ...])

Morph source space to another subject's surface.

Module Contents#

osl_ephys.source_recon.minimum_norm.logger = None[source]#
osl_ephys.source_recon.minimum_norm.get_mne_filenames(subjects_dir, subject)[source]#

Get minimum norm (MNE) filenames.

Files will be in subjects_dir/subject/mne

Parameters:
  • subjects_dir (string) – Directory containing the subject directories.

  • subject (string) – Subject name.

Returns:

filenames – A dict of files.

Return type:

dict

osl_ephys.source_recon.minimum_norm.create_inverse_operator(fwd, data, chantypes, rank, depth, loose, filename)[source]#

Creates minimum norm (MNE) inverse operator.

Parameters:
  • fwd (mne forward model or str) – Forward model.

  • data (mne.io.Raw, mne.Epochs) – Preprocessed data.

  • chantypes (list) – List of channel types to include.

  • rank (int) – Rank of the data covariance matrix.

  • depth (float) – Depth weighting.

  • loose (float) – Loose parameter.

  • inv_op_filename (str) – Output filename.

osl_ephys.source_recon.minimum_norm.apply_inverse_operator_surf(outdir, subject, data, method, lambda2, pick_ori, inverse_operator=None, morph='fsaverage', save=False)[source]#

Apply previously computed minimum norm inverse solution (surface).

Parameters:
  • outdir (str) – Output directory.

  • subject (str) – Subject ID.

  • data (mne.io.Raw, mne.Epochs) – Raw or Epochs object.

  • inverse_operator (mne.minimum_norm.InverseOperator) – Inverse operator.

  • method (str) – Inverse method. “MNE” | “dSPM” | “sLORETA” | “eLORETA”. (or “mne” | “dspm” | “sloreta” | “eloreta”).

  • lambda2 (float) – Regularization parameter.

  • pick_ori (str) – Orientation to pick.

  • morph (bool, str) – Morph method, e.g. fsaverage. Can be False.

  • save (bool) – Save source estimate (default: False).

osl_ephys.source_recon.minimum_norm.apply_inverse_operator_vol(outdir, subject, data, method, lambda2, pick_ori='pca', inverse_operator=None, transform=None)[source]#

Apply previously computed minimum norm inverse solution (volumetric).

Parameters:
  • outdir (str) – Output directory.

  • subject (str) – Subject ID.

  • data (mne.io.Raw, mne.Epochs) – Raw or Epochs object.

  • inverse_operator (mne.minimum_norm.InverseOperator) – Inverse operator.

  • method (str) – Inverse method. “MNE” | “dSPM” | “sLORETA” | “eLORETA”. (or “mne” | “dspm” | “sloreta” | “eloreta”).

  • lambda2 (float) – Regularization parameter.

  • pick_ori (str) – Orientation to pick.

  • transform (str, optional) – Should we standardise (‘ztrans’) or de-mean (‘demean’) the voxel time courses? If None, no transform is applied.

Returns:

ts – In native MRI space.

Return type:

(voxels, time) array

osl_ephys.source_recon.minimum_norm.calc_noise_cov(data, data_cov_rank, chantypes)[source]#

Calculate noise covariance.

Parameters:
  • raw (mne.io.Raw) – Raw object.

  • data_cov_rank (int) – Rank of the data covariance matrix.

  • chantypes (list) – List of channel types to include.

osl_ephys.source_recon.minimum_norm.morph_surface(subjects_dir, subject, src_from, subject_to='fsaverage', src_to=None, spacing=None)[source]#

Morph source space to another subject’s surface.

Parameters:
  • subject (str) – Subject ID.

  • subjects_dir (str) – Subjects directory.

  • src_from (mne.SourceSpaces) – Original source space.

  • src_to (str, mne.SourceSpaces) – Destination source space. can be ‘fsaverage’ or a source space.