Compute MNE inverse solution on evoked data in a mixed source space

Create a mixed source space and compute MNE inverse solution on evoked dataset

# Author: Annalisa Pascarella <a.pascarella@iac.cnr.it>
#
# License: BSD (3-clause)

import os.path as op
import matplotlib.pyplot as plt
import mne

from mne.datasets import sample
from mne import setup_volume_source_space
from mne import make_forward_solution
from mne.minimum_norm import make_inverse_operator, apply_inverse

from nilearn import plotting

# Set dir
data_path = sample.data_path()
subject = 'sample'
data_dir = op.join(data_path, 'MEG', subject)
subjects_dir = op.join(data_path, 'subjects')
bem_dir = op.join(subjects_dir, subject, 'bem')

# Set file names
fname_mixed_src = op.join(bem_dir, '%s-oct-6-mixed-src.fif' % subject)
fname_aseg = op.join(subjects_dir, subject, 'mri', 'aseg.mgz')

fname_model = op.join(bem_dir, '%s-5120-bem.fif' % subject)
fname_bem = op.join(bem_dir, '%s-5120-bem-sol.fif' % subject)

fname_evoked = data_dir + '/sample_audvis-ave.fif'
fname_trans = data_dir + '/sample_audvis_raw-trans.fif'
fname_fwd = data_dir + '/sample_audvis-meg-oct-6-mixed-fwd.fif'
fname_cov = data_dir + '/sample_audvis-shrunk-cov.fif'

Set up our source space.

# List substructures we are interested in. We select only the
# sub structures we want to include in the source space
labels_vol = ['Left-Amygdala',
              'Left-Thalamus-Proper',
              'Left-Cerebellum-Cortex',
              'Brain-Stem',
              'Right-Amygdala',
              'Right-Thalamus-Proper',
              'Right-Cerebellum-Cortex']

# Get a surface-based source space. We could set one up like this::
#
#     >>> src = setup_source_space(subject, fname=None, spacing='oct6',
#                                  add_dist=False, subjects_dir=subjects_dir)
#
# But we already have one saved:

src = mne.read_source_spaces(op.join(bem_dir, 'sample-oct-6-src.fif'))

# Now we create a mixed src space by adding the volume regions specified in the
# list labels_vol. First, read the aseg file and the source space bounds
# using the inner skull surface (here using 10mm spacing to save time):

vol_src = setup_volume_source_space(
    subject, mri=fname_aseg, pos=7.0, bem=fname_model,
    volume_label=labels_vol, subjects_dir=subjects_dir, verbose=True)

# Generate the mixed source space
src += vol_src

# Visualize the source space.
src.plot(subjects_dir=subjects_dir)

n = sum(src[i]['nuse'] for i in range(len(src)))
print('the src space contains %d spaces and %d points' % (len(src), n))

# We could write the mixed source space with::
#
#    >>> write_source_spaces(fname_mixed_src, src, overwrite=True)
#
../../_images/sphx_glr_plot_mixed_source_space_inverse_001.png

Out:

Reading a source space...
    Computing patch statistics...
    Patch information added...
    Distance information added...
    [done]
    Reading a source space...
    Computing patch statistics...
    Patch information added...
    Distance information added...
    [done]
    2 source spaces read
BEM file              : /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/bem/sample-5120-bem.fif
Output file           : None
grid                  : 7.0 mm
mindist               : 5.0 mm
MRI volume            : /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/mri/aseg.mgz

Loaded inner skull from /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/bem/sample-5120-bem.fif (2562 nodes)
Surface CM = (   0.7  -10.0   44.3) mm
Surface fits inside a sphere with radius   91.8 mm
Surface extent:
    x =  -66.7 ...   68.8 mm
    y =  -88.0 ...   79.0 mm
    z =  -44.5 ...  105.8 mm
Grid extent:
    x =  -70.0 ...   70.0 mm
    y =  -91.0 ...   84.0 mm
    z =  -49.0 ...  112.0 mm
13104 sources before omitting any.
8549 sources after omitting infeasible sources.
Source spaces are in MRI coordinates.
Checking that the sources are inside the bounding surface and at least    5.0 mm away (will take a few...)
3911 source space points omitted because they are outside the inner skull surface.
881 source space points omitted because of the    5.0-mm distance limit.
Thank you for waiting.
3757 sources remaining after excluding the sources outside the surface and less than    5.0 mm inside.
Selecting voxels from Left-Amygdala
5 sources remaining after excluding sources too far from VOI voxels
Adjusting the neighborhood info...
Surface CM = (   0.7  -10.0   44.3) mm
Surface fits inside a sphere with radius   91.8 mm
Surface extent:
    x =  -66.7 ...   68.8 mm
    y =  -88.0 ...   79.0 mm
    z =  -44.5 ...  105.8 mm
Grid extent:
    x =  -70.0 ...   70.0 mm
    y =  -91.0 ...   84.0 mm
    z =  -49.0 ...  112.0 mm
13104 sources before omitting any.
8549 sources after omitting infeasible sources.
Source spaces are in MRI coordinates.
Checking that the sources are inside the bounding surface and at least    5.0 mm away (will take a few...)
3911 source space points omitted because they are outside the inner skull surface.
881 source space points omitted because of the    5.0-mm distance limit.
Thank you for waiting.
3757 sources remaining after excluding the sources outside the surface and less than    5.0 mm inside.
Selecting voxels from Left-Thalamus-Proper
24 sources remaining after excluding sources too far from VOI voxels
Adjusting the neighborhood info...
Surface CM = (   0.7  -10.0   44.3) mm
Surface fits inside a sphere with radius   91.8 mm
Surface extent:
    x =  -66.7 ...   68.8 mm
    y =  -88.0 ...   79.0 mm
    z =  -44.5 ...  105.8 mm
Grid extent:
    x =  -70.0 ...   70.0 mm
    y =  -91.0 ...   84.0 mm
    z =  -49.0 ...  112.0 mm
13104 sources before omitting any.
8549 sources after omitting infeasible sources.
Source spaces are in MRI coordinates.
Checking that the sources are inside the bounding surface and at least    5.0 mm away (will take a few...)
3911 source space points omitted because they are outside the inner skull surface.
881 source space points omitted because of the    5.0-mm distance limit.
Thank you for waiting.
3757 sources remaining after excluding the sources outside the surface and less than    5.0 mm inside.
Selecting voxels from Left-Cerebellum-Cortex
106 sources remaining after excluding sources too far from VOI voxels
Adjusting the neighborhood info...
Surface CM = (   0.7  -10.0   44.3) mm
Surface fits inside a sphere with radius   91.8 mm
Surface extent:
    x =  -66.7 ...   68.8 mm
    y =  -88.0 ...   79.0 mm
    z =  -44.5 ...  105.8 mm
Grid extent:
    x =  -70.0 ...   70.0 mm
    y =  -91.0 ...   84.0 mm
    z =  -49.0 ...  112.0 mm
13104 sources before omitting any.
8549 sources after omitting infeasible sources.
Source spaces are in MRI coordinates.
Checking that the sources are inside the bounding surface and at least    5.0 mm away (will take a few...)
3911 source space points omitted because they are outside the inner skull surface.
881 source space points omitted because of the    5.0-mm distance limit.
Thank you for waiting.
3757 sources remaining after excluding the sources outside the surface and less than    5.0 mm inside.
Selecting voxels from Brain-Stem
65 sources remaining after excluding sources too far from VOI voxels
Adjusting the neighborhood info...
Surface CM = (   0.7  -10.0   44.3) mm
Surface fits inside a sphere with radius   91.8 mm
Surface extent:
    x =  -66.7 ...   68.8 mm
    y =  -88.0 ...   79.0 mm
    z =  -44.5 ...  105.8 mm
Grid extent:
    x =  -70.0 ...   70.0 mm
    y =  -91.0 ...   84.0 mm
    z =  -49.0 ...  112.0 mm
13104 sources before omitting any.
8549 sources after omitting infeasible sources.
Source spaces are in MRI coordinates.
Checking that the sources are inside the bounding surface and at least    5.0 mm away (will take a few...)
3911 source space points omitted because they are outside the inner skull surface.
881 source space points omitted because of the    5.0-mm distance limit.
Thank you for waiting.
3757 sources remaining after excluding the sources outside the surface and less than    5.0 mm inside.
Selecting voxels from Right-Amygdala
4 sources remaining after excluding sources too far from VOI voxels
Adjusting the neighborhood info...
Surface CM = (   0.7  -10.0   44.3) mm
Surface fits inside a sphere with radius   91.8 mm
Surface extent:
    x =  -66.7 ...   68.8 mm
    y =  -88.0 ...   79.0 mm
    z =  -44.5 ...  105.8 mm
Grid extent:
    x =  -70.0 ...   70.0 mm
    y =  -91.0 ...   84.0 mm
    z =  -49.0 ...  112.0 mm
13104 sources before omitting any.
8549 sources after omitting infeasible sources.
Source spaces are in MRI coordinates.
Checking that the sources are inside the bounding surface and at least    5.0 mm away (will take a few...)
3911 source space points omitted because they are outside the inner skull surface.
881 source space points omitted because of the    5.0-mm distance limit.
Thank you for waiting.
3757 sources remaining after excluding the sources outside the surface and less than    5.0 mm inside.
Selecting voxels from Right-Thalamus-Proper
24 sources remaining after excluding sources too far from VOI voxels
Adjusting the neighborhood info...
Surface CM = (   0.7  -10.0   44.3) mm
Surface fits inside a sphere with radius   91.8 mm
Surface extent:
    x =  -66.7 ...   68.8 mm
    y =  -88.0 ...   79.0 mm
    z =  -44.5 ...  105.8 mm
Grid extent:
    x =  -70.0 ...   70.0 mm
    y =  -91.0 ...   84.0 mm
    z =  -49.0 ...  112.0 mm
13104 sources before omitting any.
8549 sources after omitting infeasible sources.
Source spaces are in MRI coordinates.
Checking that the sources are inside the bounding surface and at least    5.0 mm away (will take a few...)
3911 source space points omitted because they are outside the inner skull surface.
881 source space points omitted because of the    5.0-mm distance limit.
Thank you for waiting.
3757 sources remaining after excluding the sources outside the surface and less than    5.0 mm inside.
Selecting voxels from Right-Cerebellum-Cortex
121 sources remaining after excluding sources too far from VOI voxels
Adjusting the neighborhood info...
Reading /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/mri/aseg.mgz...
Source space : MRI voxel -> MRI (surface RAS)
     0.007000  0.000000  0.000000     -70.00 mm
     0.000000  0.007000  0.000000     -91.00 mm
     0.000000  0.000000  0.007000     -49.00 mm
     0.000000  0.000000  0.000000       1.00
MRI volume : MRI voxel -> MRI (surface RAS)
    -0.001000  0.000000  0.000000     128.00 mm
     0.000000  0.000000  0.001000    -128.00 mm
     0.000000 -0.001000  0.000000     128.00 mm
     0.000000  0.000000  0.000000       1.00
MRI volume : MRI (surface RAS) -> RAS (non-zero origin)
     1.000000 -0.000000 -0.000000      -5.27 mm
    -0.000000  1.000000 -0.000000       9.04 mm
    -0.000000  0.000000  1.000000     -27.29 mm
     0.000000  0.000000  0.000000       1.00
Setting up interpolation...
 60368/16777216 nonzero values [done]
Reading /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/mri/aseg.mgz...
Source space : MRI voxel -> MRI (surface RAS)
     0.007000  0.000000  0.000000     -70.00 mm
     0.000000  0.007000  0.000000     -91.00 mm
     0.000000  0.000000  0.007000     -49.00 mm
     0.000000  0.000000  0.000000       1.00
MRI volume : MRI voxel -> MRI (surface RAS)
    -0.001000  0.000000  0.000000     128.00 mm
     0.000000  0.000000  0.001000    -128.00 mm
     0.000000 -0.001000  0.000000     128.00 mm
     0.000000  0.000000  0.000000       1.00
MRI volume : MRI (surface RAS) -> RAS (non-zero origin)
     1.000000 -0.000000 -0.000000      -5.27 mm
    -0.000000  1.000000 -0.000000       9.04 mm
    -0.000000  0.000000  1.000000     -27.29 mm
     0.000000  0.000000  0.000000       1.00
Setting up interpolation...
 189336/16777216 nonzero values [done]
Reading /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/mri/aseg.mgz...
Source space : MRI voxel -> MRI (surface RAS)
     0.007000  0.000000  0.000000     -70.00 mm
     0.000000  0.007000  0.000000     -91.00 mm
     0.000000  0.000000  0.007000     -49.00 mm
     0.000000  0.000000  0.000000       1.00
MRI volume : MRI voxel -> MRI (surface RAS)
    -0.001000  0.000000  0.000000     128.00 mm
     0.000000  0.000000  0.001000    -128.00 mm
     0.000000 -0.001000  0.000000     128.00 mm
     0.000000  0.000000  0.000000       1.00
MRI volume : MRI (surface RAS) -> RAS (non-zero origin)
     1.000000 -0.000000 -0.000000      -5.27 mm
    -0.000000  1.000000 -0.000000       9.04 mm
    -0.000000  0.000000  1.000000     -27.29 mm
     0.000000  0.000000  0.000000       1.00
Setting up interpolation...
 743624/16777216 nonzero values [done]
Reading /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/mri/aseg.mgz...
Source space : MRI voxel -> MRI (surface RAS)
     0.007000  0.000000  0.000000     -70.00 mm
     0.000000  0.007000  0.000000     -91.00 mm
     0.000000  0.000000  0.007000     -49.00 mm
     0.000000  0.000000  0.000000       1.00
MRI volume : MRI voxel -> MRI (surface RAS)
    -0.001000  0.000000  0.000000     128.00 mm
     0.000000  0.000000  0.001000    -128.00 mm
     0.000000 -0.001000  0.000000     128.00 mm
     0.000000  0.000000  0.000000       1.00
MRI volume : MRI (surface RAS) -> RAS (non-zero origin)
     1.000000 -0.000000 -0.000000      -5.27 mm
    -0.000000  1.000000 -0.000000       9.04 mm
    -0.000000  0.000000  1.000000     -27.29 mm
     0.000000  0.000000  0.000000       1.00
Setting up interpolation...
 433552/16777216 nonzero values [done]
Reading /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/mri/aseg.mgz...
Source space : MRI voxel -> MRI (surface RAS)
     0.007000  0.000000  0.000000     -70.00 mm
     0.000000  0.007000  0.000000     -91.00 mm
     0.000000  0.000000  0.007000     -49.00 mm
     0.000000  0.000000  0.000000       1.00
MRI volume : MRI voxel -> MRI (surface RAS)
    -0.001000  0.000000  0.000000     128.00 mm
     0.000000  0.000000  0.001000    -128.00 mm
     0.000000 -0.001000  0.000000     128.00 mm
     0.000000  0.000000  0.000000       1.00
MRI volume : MRI (surface RAS) -> RAS (non-zero origin)
     1.000000 -0.000000 -0.000000      -5.27 mm
    -0.000000  1.000000 -0.000000       9.04 mm
    -0.000000  0.000000  1.000000     -27.29 mm
     0.000000  0.000000  0.000000       1.00
Setting up interpolation...
 54880/16777216 nonzero values [done]
Reading /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/mri/aseg.mgz...
Source space : MRI voxel -> MRI (surface RAS)
     0.007000  0.000000  0.000000     -70.00 mm
     0.000000  0.007000  0.000000     -91.00 mm
     0.000000  0.000000  0.007000     -49.00 mm
     0.000000  0.000000  0.000000       1.00
MRI volume : MRI voxel -> MRI (surface RAS)
    -0.001000  0.000000  0.000000     128.00 mm
     0.000000  0.000000  0.001000    -128.00 mm
     0.000000 -0.001000  0.000000     128.00 mm
     0.000000  0.000000  0.000000       1.00
MRI volume : MRI (surface RAS) -> RAS (non-zero origin)
     1.000000 -0.000000 -0.000000      -5.27 mm
    -0.000000  1.000000 -0.000000       9.04 mm
    -0.000000  0.000000  1.000000     -27.29 mm
     0.000000  0.000000  0.000000       1.00
Setting up interpolation...
 172872/16777216 nonzero values [done]
Reading /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/mri/aseg.mgz...
Source space : MRI voxel -> MRI (surface RAS)
     0.007000  0.000000  0.000000     -70.00 mm
     0.000000  0.007000  0.000000     -91.00 mm
     0.000000  0.000000  0.007000     -49.00 mm
     0.000000  0.000000  0.000000       1.00
MRI volume : MRI voxel -> MRI (surface RAS)
    -0.001000  0.000000  0.000000     128.00 mm
     0.000000  0.000000  0.001000    -128.00 mm
     0.000000 -0.001000  0.000000     128.00 mm
     0.000000  0.000000  0.000000       1.00
MRI volume : MRI (surface RAS) -> RAS (non-zero origin)
     1.000000 -0.000000 -0.000000      -5.27 mm
    -0.000000  1.000000 -0.000000       9.04 mm
    -0.000000  0.000000  1.000000     -27.29 mm
     0.000000  0.000000  0.000000       1.00
Setting up interpolation...
 864360/16777216 nonzero values [done]
Using /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/bem/flash/outer_skull.surf for head surface.
the src space contains 9 spaces and 8545 points

Export source positions to nift file:

nii_fname = op.join(bem_dir, '%s-mixed-src.nii' % subject)
src.export_volume(nii_fname, mri_resolution=True)

plotting.plot_img(nii_fname, cmap=plt.cm.spectral)
plt.show()

# Compute the fwd matrix
fwd = make_forward_solution(fname_evoked, fname_trans, src, fname_bem,
                            mindist=5.0,  # ignore sources<=5mm from innerskull
                            meg=True, eeg=False, n_jobs=1)

leadfield = fwd['sol']['data']
print("Leadfield size : %d sensors x %d dipoles" % leadfield.shape)

src_fwd = fwd['src']
n = sum(src_fwd[i]['nuse'] for i in range(len(src_fwd)))
print('the fwd src space contains %d spaces and %d points' % (len(src_fwd), n))

# Load data
condition = 'Left Auditory'
evoked = mne.read_evokeds(fname_evoked, condition=condition,
                          baseline=(None, 0))
noise_cov = mne.read_cov(fname_cov)

# Compute inverse solution and for each epoch
snr = 3.0           # use smaller SNR for raw data
inv_method = 'MNE'  # sLORETA, MNE, dSPM
parc = 'aparc'      # the parcellation to use, e.g., 'aparc' 'aparc.a2009s'

lambda2 = 1.0 / snr ** 2

# Compute inverse operator
inverse_operator = make_inverse_operator(evoked.info, fwd, noise_cov,
                                         loose=None, depth=None,
                                         fixed=False)

stcs = apply_inverse(evoked, inverse_operator, lambda2, inv_method,
                     pick_ori=None)

# Get labels for FreeSurfer 'aparc' cortical parcellation with 34 labels/hemi
labels_parc = mne.read_labels_from_annot(subject, parc=parc,
                                         subjects_dir=subjects_dir)

# Average the source estimates within each label of the cortical parcellation
# and each sub structure contained in the src space
# If mode = 'mean_flip' this option is used only for the surface cortical label
src = inverse_operator['src']

label_ts = mne.extract_label_time_course([stcs], labels_parc, src,
                                         mode='mean',
                                         allow_empty=True,
                                         return_generator=False)

# plot the times series of 2 labels
fig, axes = plt.subplots(1)
axes.plot(1e3 * stcs.times, label_ts[0][0, :], 'k', label='bankssts-lh')
axes.plot(1e3 * stcs.times, label_ts[0][71, :].T, 'r',
          label='Brain-stem')
axes.set(xlabel='Time (ms)', ylabel='MNE current (nAm)')
axes.legend()
mne.viz.tight_layout()
plt.show()
  • ../../_images/sphx_glr_plot_mixed_source_space_inverse_002.png
  • ../../_images/sphx_glr_plot_mixed_source_space_inverse_003.png

Out:

Reading FreeSurfer lookup table
Source space                 : <SourceSpaces: [<surface (lh), n_vertices=155407, n_used=4098, coordinate_frame=MRI (surface RAS)>, <surface (rh), n_vertices=156866, n_used=4098, coordinate_frame=MRI (surface RAS)>, <volume (Left-Amygdala), n_used=5, coordinate_frame=MRI (surface RAS)>, <volume (Left-Thalamus-Proper), n_used=24, coordinate_frame=MRI (surface RAS)>, <volume (Left-Cerebellum-Cortex), n_used=106, coordinate_frame=MRI (surface RAS)>, <volume (Brain-Stem), n_used=65, coordinate_frame=MRI (surface RAS)>, <volume (Right-Amygdala), n_used=4, coordinate_frame=MRI (surface RAS)>, <volume (Right-Thalamus-Proper), n_used=24, coordinate_frame=MRI (surface RAS)>, <volume (Right-Cerebellum-Cortex), n_used=121, coordinate_frame=MRI (surface RAS)>]>
MRI -> head transform source : /home/ubuntu/mne_data/MNE-sample-data/MEG/sample/sample_audvis_raw-trans.fif
Measurement data             : sample_audvis-ave.fif
BEM model                    : /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/bem/sample-5120-bem-sol.fif
Accurate field computations
Do computations in head coordinates
Free source orientations
Destination for the solution : None

Read 9 source spaces a total of 8545 active source locations

Coordinate transformation: MRI (surface RAS) -> head
     0.999310  0.009985 -0.035787      -3.17 mm
     0.012759  0.812405  0.582954       6.86 mm
     0.034894 -0.583008  0.811716      28.88 mm
     0.000000  0.000000  0.000000       1.00

Read 306 MEG channels from info
81 coil definitions read
Coordinate transformation: MEG device -> head
     0.991420 -0.039936 -0.124467      -6.13 mm
     0.060661  0.984012  0.167456       0.06 mm
     0.115790 -0.173570  0.977991      64.74 mm
     0.000000  0.000000  0.000000       1.00
MEG coil definitions created in head coordinates.
Source spaces are now in head coordinates.

Setting up the BEM model using /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/bem/sample-5120-bem-sol.fif...

Loading surfaces...
Homogeneous model surface loaded.

Loading the solution matrix...

Loaded linear_collocation BEM solution from /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/bem/sample-5120-bem-sol.fif
Employing the head->MRI coordinate transform with the BEM model.
BEM model sample-5120-bem-sol.fif is now set up

Source spaces are in head coordinates.
Checking that the sources are inside the bounding surface and at least    5.0 mm away (will take a few...)
2 source space points omitted because they are outside the inner skull surface.
364 source space points omitted because of the    5.0-mm distance limit.
    Computing patch statistics...
    Patch information added...
1 source space point omitted because it is outside the inner skull surface.
331 source space point omitted because of the    5.0-mm distance limit.
    Computing patch statistics...
    Patch information added...
Thank you for waiting.

Setting up compensation data...
    No compensation set. Nothing more to do.

Composing the field computation matrix...
Computing MEG at 7847 source locations (free orientations)...

Finished.
Leadfield size : 306 sensors x 23541 dipoles
the fwd src space contains 9 spaces and 7847 points
Reading /home/ubuntu/mne_data/MNE-sample-data/MEG/sample/sample_audvis-ave.fif ...
    Read a total of 4 projection items:
        PCA-v1 (1 x 102) active
        PCA-v2 (1 x 102) active
        PCA-v3 (1 x 102) active
        Average EEG reference (1 x 60) active
    Found the data of interest:
        t =    -199.80 ...     499.49 ms (Left Auditory)
        0 CTF compensation matrices available
        nave = 55 - aspect type = 100
Projections have already been applied. Setting proj attribute to True.
Applying baseline correction (mode: mean)
    365 x 365 full covariance (kind = 1) found.
    Read a total of 4 projection items:
        PCA-v1 (1 x 102) active
        PCA-v2 (1 x 102) active
        PCA-v3 (1 x 102) active
        Average EEG reference (1 x 59) active
info["bads"] and noise_cov["bads"] do not match, excluding bad channels from both
Computing inverse operator with 305 channels.
    Created an SSP operator (subspace dimension = 3)
estimated rank (mag + grad): 302
Setting small MEG eigenvalues to zero.
Not doing PCA for MEG.
Total rank is 302
Computing inverse operator with 305 channels.
Creating the source covariance matrix
Whitening the forward solution.
Adjusting source covariance matrix.
Computing SVD of whitened and weighted lead field matrix.
    largest singular value = 4.513
    scaling factor to adjust the trace = 2.21982e+20
Preparing the inverse operator for use...
    Scaled noise and source covariance from nave = 1 to nave = 55
    Created the regularized inverter
    Created an SSP operator (subspace dimension = 3)
    Created the whitener using a full noise covariance matrix (3 small eigenvalues omitted)
Picked 305 channels from the data
Computing inverse...
(eigenleads need to be weighted)...
combining the current components...
[done]
Reading labels from parcellation..
   read 34 labels from /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/label/lh.aparc.annot
   read 34 labels from /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/label/rh.aparc.annot
[done]
Extracting time courses for 75 labels (mode: mean)

Total running time of the script: ( 2 minutes 37.682 seconds)

Generated by Sphinx-Gallery