Note

Click here to download the full example code

# Source reconstruction using an LCMV beamformer¶

This tutorial gives an overview of the beamformer method and shows how to use an LCMV beamformer to reconstruct source activity.

```
# Authors: Britta Westner <britta.wstnr@gmail.com>
# Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample, fetch_fsaverage
from mne.beamformer import make_lcmv, apply_lcmv
```

## Introduction to beamformers¶

A beamformer is a spatial filter that reconstructs source activity by scanning through a grid of pre-defined source points and estimating activity at each of those source points independently. A set of weights is constructed for each defined source location which defines the contribution of each sensor to this source. Beamformers are often used for their focal reconstructions and their ability to reconstruct deeper sources. They can also suppress external noise sources. The beamforming method applied in this tutorial is the linearly constrained minimum variance (LCMV) beamformer 1 operates on time series. Frequency-resolved data can be reconstructed with the dynamic imaging of coherent sources (DICS) beamforming method 2. As we will see in the following, the spatial filter is computed from two ingredients: the forward model solution and the covariance matrix of the data.

## Data processing¶

We will use the sample data set for this tutorial and reconstruct source activity on the trials with left auditory stimulation.

```
data_path = sample.data_path()
subjects_dir = data_path + '/subjects'
raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'
# Read the raw data
raw = mne.io.read_raw_fif(raw_fname)
raw.info['bads'] = ['MEG 2443'] # bad MEG channel
# Set up the epoching
event_id = 1 # those are the trials with left-ear auditory stimuli
tmin, tmax = -0.2, 0.5
events = mne.find_events(raw)
# pick relevant channels
raw.pick(['meg', 'eog']) # pick channels of interest
# Create epochs
proj = False # already applied
epochs = mne.Epochs(raw, events, event_id, tmin, tmax,
baseline=(None, 0), preload=True, proj=proj,
reject=dict(grad=4000e-13, mag=4e-12, eog=150e-6))
# for speed purposes, cut to a window of interest
evoked = epochs.average().crop(0.05, 0.15)
# Visualize averaged sensor space data
evoked.plot_joint()
del raw # save memory
```

Out:

```
Opening raw data file /home/circleci/mne_data/MNE-sample-data/MEG/sample/sample_audvis_filt-0-40_raw.fif...
Read a total of 4 projection items:
PCA-v1 (1 x 102) idle
PCA-v2 (1 x 102) idle
PCA-v3 (1 x 102) idle
Average EEG reference (1 x 60) idle
Range : 6450 ... 48149 = 42.956 ... 320.665 secs
Ready.
319 events found
Event IDs: [ 1 2 3 4 5 32]
Removing projector <Projection | Average EEG reference, active : False, n_channels : 60>
Not setting metadata
Not setting metadata
72 matching events found
Setting baseline interval to [-0.19979521315838786, 0.0] sec
Applying baseline correction (mode: mean)
Created an SSP operator (subspace dimension = 3)
Loading data for 72 events and 106 original time points ...
Rejecting epoch based on EOG : ['EOG 061']
Rejecting epoch based on EOG : ['EOG 061']
Rejecting epoch based on EOG : ['EOG 061']
Rejecting epoch based on EOG : ['EOG 061']
Rejecting epoch based on EOG : ['EOG 061']
Rejecting epoch based on MAG : ['MEG 1711']
Rejecting epoch based on EOG : ['EOG 061']
Rejecting epoch based on EOG : ['EOG 061']
Rejecting epoch based on EOG : ['EOG 061']
Rejecting epoch based on EOG : ['EOG 061']
Rejecting epoch based on EOG : ['EOG 061']
Rejecting epoch based on EOG : ['EOG 061']
Rejecting epoch based on EOG : ['EOG 061']
Rejecting epoch based on EOG : ['EOG 061']
Rejecting epoch based on EOG : ['EOG 061']
Rejecting epoch based on EOG : ['EOG 061']
Rejecting epoch based on EOG : ['EOG 061']
17 bad epochs dropped
Created an SSP operator (subspace dimension = 3)
3 projection items activated
SSP projectors applied...
Removing projector <Projection | PCA-v1, active : True, n_channels : 102>
Removing projector <Projection | PCA-v2, active : True, n_channels : 102>
Removing projector <Projection | PCA-v3, active : True, n_channels : 102>
```

## Computing the covariance matrices¶

Spatial filters use the data covariance to estimate the filter weights. The data covariance matrix will be inverted during the spatial filter computation, so it is valuable to plot the covariance matrix and its eigenvalues to gauge whether matrix inversion will be possible. Also, because we want to combine different channel types (magnetometers and gradiometers), we need to account for the different amplitude scales of these channel types. To do this we will supply a noise covariance matrix to the beamformer, which will be used for whitening. The data covariance matrix should be estimated from a time window that includes the brain signal of interest, and incorporate enough samples for a stable estimate. A rule of thumb is to use more samples than there are channels in the data set; see 3 for more detailed advice on covariance estimation for beamformers. Here, we use a time window incorporating the expected auditory response at around 100 ms post stimulus and extend the period to account for a low number of trials (72) and low sampling rate of 150 Hz.

```
data_cov = mne.compute_covariance(epochs, tmin=0.01, tmax=0.25,
method='empirical')
noise_cov = mne.compute_covariance(epochs, tmin=tmin, tmax=0,
method='empirical')
data_cov.plot(epochs.info)
del epochs
```

Out:

```
Computing rank from data with rank=None
Using tolerance 4.1e-09 (2.2e-16 eps * 305 dim * 6.1e+04 max singular value)
Estimated rank (mag + grad): 302
MEG: rank 302 computed from 305 data channels with 3 projectors
Created an SSP operator (subspace dimension = 3)
Setting small MEG eigenvalues to zero (without PCA)
Reducing data rank from 305 -> 302
Estimating covariance using EMPIRICAL
Done.
Number of samples used : 2035
[done]
Computing rank from data with rank=None
Using tolerance 2.8e-09 (2.2e-16 eps * 305 dim * 4.2e+04 max singular value)
Estimated rank (mag + grad): 302
MEG: rank 302 computed from 305 data channels with 3 projectors
Created an SSP operator (subspace dimension = 3)
Setting small MEG eigenvalues to zero (without PCA)
Reducing data rank from 305 -> 302
Estimating covariance using EMPIRICAL
Done.
Number of samples used : 1705
[done]
Computing rank from covariance with rank=None
Using tolerance 4e-14 (2.2e-16 eps * 102 dim * 1.8 max singular value)
Estimated rank (mag): 99
MAG: rank 99 computed from 102 data channels with 0 projectors
Computing rank from covariance with rank=None
Using tolerance 4.3e-13 (2.2e-16 eps * 203 dim * 9.4 max singular value)
Estimated rank (grad): 203
GRAD: rank 203 computed from 203 data channels with 0 projectors
```

When looking at the covariance matrix plots, we can see that our data is
slightly rank-deficient as the rank is not equal to the number of channels.
Thus, we will have to regularize the covariance matrix before inverting it
in the beamformer calculation. This can be achieved by setting the parameter
`reg=0.05`

when calculating the spatial filter with
`make_lcmv()`

. This corresponds to loading the diagonal
of the covariance matrix with 5% of the sensor power.

## The forward model¶

The forward model is the other important ingredient for the computation of a
spatial filter. Here, we will load the forward model from disk; more
information on how to create a forward model can be found in this tutorial:
Head model and forward computation.
Note that beamformers are usually computed in a `volume source space`

, because estimating only cortical surface
activation can misrepresent the data.

```
# Read forward model
fwd_fname = data_path + '/MEG/sample/sample_audvis-meg-vol-7-fwd.fif'
forward = mne.read_forward_solution(fwd_fname)
```

Out:

```
Reading forward solution from /home/circleci/mne_data/MNE-sample-data/MEG/sample/sample_audvis-meg-vol-7-fwd.fif...
Reading a source space...
[done]
1 source spaces read
Desired named matrix (kind = 3523) not available
Read MEG forward solution (3757 sources, 306 channels, free orientations)
Source spaces transformed to the forward solution coordinate frame
```

## Handling depth bias¶

The forward model solution is inherently biased toward superficial sources. When analyzing single conditions it is best to mitigate the depth bias somehow. There are several ways to do this:

`mne.beamformer.make_lcmv()`

has a`depth`

parameter that normalizes the forward model prior to computing the spatial filters. See the docstring for details.Unit-noise gain beamformers handle depth bias by normalizing the weights of the spatial filter. Choose this by setting

`weight_norm='unit-noise-gain'`

.When computing the Neural activity index, the depth bias is handled by normalizing both the weights and the estimated noise (see 1). Choose this by setting

`weight_norm='nai'`

.

Note that when comparing conditions, the depth bias will cancel out and it is
possible to set both parameters to `None`

.

## Compute the spatial filter¶

Now we can compute the spatial filter. We’ll use a unit-noise gain beamformer
to deal with depth bias, and will also optimize the orientation of the
sources such that output power is maximized.
This is achieved by setting `pick_ori='max-power'`

.
This gives us one source estimate per source (i.e., voxel), which is known
as a scalar beamformer.

```
filters = make_lcmv(evoked.info, forward, data_cov, reg=0.05,
noise_cov=noise_cov, pick_ori='max-power',
weight_norm='unit-noise-gain', rank=None)
# You can save the filter for later use with:
# filters.save('filters-lcmv.h5')
```

Out:

```
Computing rank from covariance with rank=None
Using tolerance 7.1e-13 (2.2e-16 eps * 305 dim * 10 max singular value)
Estimated rank (mag + grad): 302
MEG: rank 302 computed from 305 data channels with 3 projectors
Computing rank from covariance with rank=None
Using tolerance 2.9e-13 (2.2e-16 eps * 305 dim * 4.3 max singular value)
Estimated rank (mag + grad): 302
MEG: rank 302 computed from 305 data channels with 3 projectors
Making LCMV beamformer with rank {'meg': 302}
Computing inverse operator with 305 channels.
305 out of 306 channels remain after picking
Selected 305 channels
Whitening the forward solution.
Created an SSP operator (subspace dimension = 3)
Computing rank from covariance with rank={'meg': 302}
Setting small MEG eigenvalues to zero (without PCA)
Creating the source covariance matrix
Adjusting source covariance matrix.
Computing beamformer filters for 3757 sources
Filter computation complete
```

It is also possible to compute a vector beamformer, which gives back three
estimates per voxel, corresponding to the three direction components of the
source. This can be achieved by setting
`pick_ori='vector'`

and will yield a `volume vector source estimate`

. So we will compute another set of filters
using the vector beamformer approach:

Out:

```
Computing rank from covariance with rank=None
Using tolerance 7.1e-13 (2.2e-16 eps * 305 dim * 10 max singular value)
Estimated rank (mag + grad): 302
MEG: rank 302 computed from 305 data channels with 3 projectors
Computing rank from covariance with rank=None
Using tolerance 2.9e-13 (2.2e-16 eps * 305 dim * 4.3 max singular value)
Estimated rank (mag + grad): 302
MEG: rank 302 computed from 305 data channels with 3 projectors
Making LCMV beamformer with rank {'meg': 302}
Computing inverse operator with 305 channels.
305 out of 306 channels remain after picking
Selected 305 channels
Whitening the forward solution.
Created an SSP operator (subspace dimension = 3)
Computing rank from covariance with rank={'meg': 302}
Setting small MEG eigenvalues to zero (without PCA)
Creating the source covariance matrix
Adjusting source covariance matrix.
Computing beamformer filters for 3757 sources
Filter computation complete
```

## Apply the spatial filter¶

The spatial filter can be applied to different data types: raw, epochs,
evoked data or the data covariance matrix to gain a static image of power.
The function to apply the spatial filter to `Evoked`

data is
`apply_lcmv()`

which is
what we will use here. The other functions are
`apply_lcmv_raw()`

,
`apply_lcmv_epochs()`

, and
`apply_lcmv_cov()`

.

```
stc = apply_lcmv(evoked, filters, max_ori_out='signed')
stc_vec = apply_lcmv(evoked, filters_vec, max_ori_out='signed')
del filters, filters_vec
```

## Visualize the reconstructed source activity¶

We can visualize the source estimate in different ways, e.g. as a volume rendering, an overlay onto the MRI, or as an overlay onto a glass brain.

The plots for the scalar beamformer show brain activity in the right temporal lobe around 100 ms post stimulus. This is expected given the left-ear auditory stimulation of the experiment.

```
lims = [0.3, 0.45, 0.6]
kwargs = dict(src=src, subject='sample', subjects_dir=subjects_dir,
initial_time=0.087, verbose=True)
```

### On MRI slices (orthoview; 2D)¶

Out:

```
Fixing initial time: 0.087 sec
Showing: t = 0.087 s, (50.7, 2.0, -13.3) mm, [18, 12, 9] vox, 5184 vertex
```

### On MNI glass brain (orthoview; 2D)¶

Out:

```
Transforming subject RAS (non-zero origin) -> MNI Talairach
1.022485 -0.008449 -0.036217 5.60 mm
0.071071 0.914866 0.406098 -19.82 mm
0.008756 -0.433700 1.028119 -1.55 mm
0.000000 0.000000 0.000000 1.00
Fixing initial time: 0.087 sec
Showing: t = 0.087 s, (57.9, -19.7, -15.6) mm, [18, 12, 9] vox, 5184 vertex
```

### Volumetric rendering (3D) with vectors¶

These plots can also be shown using a volumetric rendering via
`plot_3d()`

. Let’s try visualizing the
vector beamformer case. Here we get three source time courses out per voxel
(one for each component of the dipole moment: x, y, and z), which appear
as small vectors in the visualization (in the 2D plotters, only the
magnitude can be shown):

## Visualize the activity of the maximum voxel with all three components¶

We can also visualize all three components in the peak voxel. For this, we will first find the peak voxel and then plot the time courses of this voxel.

```
peak_vox, _ = stc_vec.get_peak(tmin=0.08, tmax=0.1, vert_as_index=True)
ori_labels = ['x', 'y', 'z']
fig, ax = plt.subplots(1)
for ori, label in zip(stc_vec.data[peak_vox, :, :], ori_labels):
ax.plot(stc_vec.times, ori, label='%s component' % label)
ax.legend(loc='lower right')
ax.set(title='Activity per orientation in the peak voxel', xlabel='Time (s)',
ylabel='Amplitude (a. u.)')
mne.viz.utils.plt_show()
del stc_vec
```

## Morph the output to fsaverage¶

We can also use volumetric morphing to get the data to fsaverage space. This
is for example necessary when comparing activity across subjects. Here, we
will use the scalar beamformer example.
We pass a `mne.SourceMorph`

as the `src`

argument to
`mne.VolSourceEstimate.plot`

. To save some computational load when applying
the morph, we will crop the `stc`

:

```
fetch_fsaverage(subjects_dir) # ensure fsaverage src exists
fname_fs_src = subjects_dir + '/fsaverage/bem/fsaverage-vol-5-src.fif'
src_fs = mne.read_source_spaces(fname_fs_src)
morph = mne.compute_source_morph(
src, subject_from='sample', src_to=src_fs, subjects_dir=subjects_dir,
niter_sdr=[10, 10, 5], niter_affine=[10, 10, 5], # just for speed
verbose=True)
stc_fs = morph.apply(stc)
del stc
stc_fs.plot(
src=src_fs, mode='stat_map', initial_time=0.085, subjects_dir=subjects_dir,
clim=dict(kind='value', pos_lims=lims), verbose=True)
```

Out:

```
12 files missing from /home/circleci/project/mne/datasets/_fsaverage/root.txt in /home/circleci/mne_data/MNE-sample-data/subjects
Downloading missing files remotely
Downloading https://files.osf.io/v1/resources/rxvq7/providers/osfstorage/5cbdba4ef2be3c0019091890?revision=2&action=download&direct&version=2 (186.7 MB)
0%| | Downloading : 0.00/187M [00:00<?, ?B/s]
0%| | Downloading : 184k/187M [00:00<00:22, 8.53MB/s]
0%| | Downloading : 568k/187M [00:00<00:13, 14.3MB/s]
1%|1 | Downloading : 2.30M/187M [00:00<00:05, 36.9MB/s]
2%|2 | Downloading : 4.30M/187M [00:00<00:03, 56.4MB/s]
6%|5 | Downloading : 10.3M/187M [00:00<00:01, 102MB/s]
8%|7 | Downloading : 14.3M/187M [00:00<00:01, 98.1MB/s]
10%|9 | Downloading : 18.3M/187M [00:00<00:03, 52.5MB/s]
11%|# | Downloading : 20.3M/187M [00:00<00:03, 45.8MB/s]
12%|#1 | Downloading : 22.3M/187M [00:00<00:03, 49.1MB/s]
15%|#5 | Downloading : 28.3M/187M [00:00<00:02, 60.0MB/s]
17%|#7 | Downloading : 32.3M/187M [00:00<00:02, 63.8MB/s]
19%|#9 | Downloading : 36.3M/187M [00:00<00:02, 68.9MB/s]
22%|##1 | Downloading : 40.3M/187M [00:00<00:02, 74.6MB/s]
24%|##3 | Downloading : 44.3M/187M [00:00<00:01, 79.4MB/s]
26%|##5 | Downloading : 48.3M/187M [00:00<00:01, 83.9MB/s]
28%|##8 | Downloading : 52.3M/187M [00:00<00:01, 86.8MB/s]
30%|### | Downloading : 56.3M/187M [00:00<00:01, 90.3MB/s]
32%|###2 | Downloading : 60.3M/187M [00:00<00:01, 92.8MB/s]
34%|###4 | Downloading : 64.3M/187M [00:00<00:01, 95.2MB/s]
37%|###6 | Downloading : 68.3M/187M [00:00<00:01, 99.4MB/s]
39%|###8 | Downloading : 72.3M/187M [00:00<00:01, 101MB/s]
41%|#### | Downloading : 76.3M/187M [00:00<00:01, 102MB/s]
43%|####3 | Downloading : 80.3M/187M [00:00<00:01, 105MB/s]
45%|####5 | Downloading : 84.3M/187M [00:00<00:01, 107MB/s]
47%|####7 | Downloading : 88.3M/187M [00:00<00:00, 109MB/s]
49%|####9 | Downloading : 92.3M/187M [00:00<00:00, 110MB/s]
52%|#####1 | Downloading : 96.3M/187M [00:01<00:00, 111MB/s]
54%|#####3 | Downloading : 100M/187M [00:01<00:00, 113MB/s]
56%|#####5 | Downloading : 104M/187M [00:01<00:00, 117MB/s]
58%|#####8 | Downloading : 108M/187M [00:01<00:00, 118MB/s]
60%|###### | Downloading : 112M/187M [00:01<00:00, 120MB/s]
62%|######2 | Downloading : 116M/187M [00:01<00:00, 123MB/s]
64%|######4 | Downloading : 120M/187M [00:01<00:00, 124MB/s]
67%|######6 | Downloading : 124M/187M [00:01<00:00, 126MB/s]
69%|######8 | Downloading : 128M/187M [00:01<00:00, 124MB/s]
71%|####### | Downloading : 132M/187M [00:01<00:00, 121MB/s]
73%|#######3 | Downloading : 136M/187M [00:01<00:00, 115MB/s]
75%|#######5 | Downloading : 140M/187M [00:01<00:00, 114MB/s]
77%|#######7 | Downloading : 144M/187M [00:01<00:00, 112MB/s]
79%|#######9 | Downloading : 148M/187M [00:01<00:00, 71.1MB/s]
81%|######## | Downloading : 150M/187M [00:02<00:00, 59.3MB/s]
81%|########1 | Downloading : 151M/187M [00:02<00:00, 54.6MB/s]
81%|########1 | Downloading : 152M/187M [00:02<00:00, 52.4MB/s]
82%|########1 | Downloading : 152M/187M [00:02<00:00, 49.9MB/s]
82%|########1 | Downloading : 153M/187M [00:02<00:00, 48.0MB/s]
82%|########2 | Downloading : 153M/187M [00:02<00:00, 46.1MB/s]
82%|########2 | Downloading : 154M/187M [00:02<00:00, 44.5MB/s]
83%|########2 | Downloading : 154M/187M [00:02<00:00, 43.1MB/s]
83%|########2 | Downloading : 155M/187M [00:02<00:00, 41.6MB/s]
83%|########3 | Downloading : 155M/187M [00:02<00:00, 40.2MB/s]
83%|########3 | Downloading : 156M/187M [00:02<00:00, 38.7MB/s]
84%|########3 | Downloading : 156M/187M [00:02<00:00, 36.9MB/s]
84%|########3 | Downloading : 157M/187M [00:02<00:00, 35.0MB/s]
84%|########4 | Downloading : 157M/187M [00:02<00:00, 33.7MB/s]
85%|########4 | Downloading : 158M/187M [00:03<00:00, 31.7MB/s]
85%|########4 | Downloading : 158M/187M [00:03<00:00, 30.0MB/s]
85%|########5 | Downloading : 159M/187M [00:03<00:01, 28.7MB/s]
85%|########5 | Downloading : 159M/187M [00:03<00:01, 27.8MB/s]
86%|########5 | Downloading : 160M/187M [00:03<00:01, 26.8MB/s]
86%|########5 | Downloading : 160M/187M [00:03<00:01, 25.9MB/s]
86%|########6 | Downloading : 161M/187M [00:03<00:01, 25.1MB/s]
86%|########6 | Downloading : 161M/187M [00:03<00:01, 24.4MB/s]
87%|########6 | Downloading : 162M/187M [00:03<00:01, 23.8MB/s]
87%|########6 | Downloading : 162M/187M [00:03<00:01, 23.1MB/s]
87%|########7 | Downloading : 163M/187M [00:03<00:01, 22.5MB/s]
87%|########7 | Downloading : 163M/187M [00:03<00:01, 21.9MB/s]
88%|########7 | Downloading : 164M/187M [00:03<00:01, 21.4MB/s]
88%|########8 | Downloading : 164M/187M [00:03<00:01, 20.9MB/s]
88%|########8 | Downloading : 165M/187M [00:03<00:01, 20.5MB/s]
89%|########8 | Downloading : 165M/187M [00:03<00:01, 20.1MB/s]
89%|########8 | Downloading : 166M/187M [00:03<00:01, 19.5MB/s]
89%|########9 | Downloading : 166M/187M [00:04<00:01, 18.7MB/s]
89%|########9 | Downloading : 167M/187M [00:04<00:01, 18.0MB/s]
90%|########9 | Downloading : 167M/187M [00:04<00:01, 17.5MB/s]
90%|########9 | Downloading : 168M/187M [00:04<00:01, 16.7MB/s]
90%|######### | Downloading : 168M/187M [00:04<00:01, 16.1MB/s]
90%|######### | Downloading : 169M/187M [00:04<00:01, 15.4MB/s]
91%|######### | Downloading : 169M/187M [00:04<00:01, 15.5MB/s]
91%|######### | Downloading : 170M/187M [00:04<00:01, 15.7MB/s]
92%|#########1| Downloading : 171M/187M [00:04<00:00, 16.6MB/s]
93%|#########3| Downloading : 174M/187M [00:04<00:00, 18.9MB/s]
94%|#########4| Downloading : 176M/187M [00:04<00:00, 20.4MB/s]
96%|#########5| Downloading : 178M/187M [00:04<00:00, 21.3MB/s]
97%|#########6| Downloading : 180M/187M [00:04<00:00, 22.2MB/s]
98%|#########7| Downloading : 182M/187M [00:04<00:00, 23.6MB/s]
99%|#########8| Downloading : 184M/187M [00:04<00:00, 20.6MB/s]
99%|#########9| Downloading : 185M/187M [00:04<00:00, 20.9MB/s]
100%|#########9| Downloading : 186M/187M [00:04<00:00, 21.5MB/s]
100%|##########| Downloading : 187M/187M [00:04<00:00, 39.3MB/s]
Verifying hash 5133fe92b7b8f03ae19219d5f46e4177.
File saved as /tmp/tmpf8j_qv0j/temp.zip.
Extracting missing files
Successfully extracted 12 files
10 files missing from /home/circleci/project/mne/datasets/_fsaverage/bem.txt in /home/circleci/mne_data/MNE-sample-data/subjects/fsaverage
Downloading missing files remotely
Downloading https://files.osf.io/v1/resources/rxvq7/providers/osfstorage/5cbdb9f5353c58001aa02025?revision=4&action=download&direct&version=4 (227.8 MB)
0%| | Downloading : 0.00/228M [00:00<?, ?B/s]
0%| | Downloading : 120k/228M [00:00<00:31, 7.62MB/s]
0%| | Downloading : 504k/228M [00:00<00:22, 10.6MB/s]
0%| | Downloading : 760k/228M [00:00<00:29, 8.16MB/s]
0%| | Downloading : 0.99M/228M [00:00<00:29, 8.00MB/s]
1%| | Downloading : 1.24M/228M [00:00<00:29, 8.04MB/s]
1%| | Downloading : 1.49M/228M [00:00<00:28, 8.23MB/s]
1%| | Downloading : 1.74M/228M [00:00<00:28, 8.19MB/s]
1%| | Downloading : 1.99M/228M [00:00<00:30, 7.78MB/s]
1%| | Downloading : 2.24M/228M [00:00<00:29, 8.07MB/s]
1%|1 | Downloading : 2.49M/228M [00:00<00:29, 8.07MB/s]
1%|1 | Downloading : 2.74M/228M [00:00<00:30, 7.82MB/s]
1%|1 | Downloading : 2.99M/228M [00:00<00:28, 8.25MB/s]
2%|1 | Downloading : 3.74M/228M [00:00<00:22, 10.4MB/s]
2%|2 | Downloading : 5.24M/228M [00:00<00:16, 14.5MB/s]
3%|2 | Downloading : 6.24M/228M [00:00<00:13, 16.7MB/s]
3%|3 | Downloading : 7.24M/228M [00:00<00:12, 18.7MB/s]
4%|3 | Downloading : 8.24M/228M [00:00<00:11, 20.7MB/s]
4%|4 | Downloading : 9.24M/228M [00:00<00:10, 22.6MB/s]
4%|4 | Downloading : 10.2M/228M [00:00<00:09, 24.4MB/s]
5%|4 | Downloading : 11.2M/228M [00:00<00:08, 26.0MB/s]
5%|5 | Downloading : 12.2M/228M [00:00<00:08, 27.3MB/s]
7%|6 | Downloading : 15.2M/228M [00:00<00:06, 32.3MB/s]
8%|7 | Downloading : 17.2M/228M [00:00<00:06, 33.1MB/s]
8%|8 | Downloading : 19.2M/228M [00:00<00:05, 36.7MB/s]
9%|9 | Downloading : 21.2M/228M [00:00<00:05, 38.1MB/s]
10%|# | Downloading : 23.2M/228M [00:00<00:05, 40.3MB/s]
11%|#1 | Downloading : 25.2M/228M [00:00<00:04, 42.7MB/s]
12%|#1 | Downloading : 27.2M/228M [00:00<00:04, 44.7MB/s]
13%|#2 | Downloading : 29.2M/228M [00:00<00:04, 46.9MB/s]
14%|#3 | Downloading : 31.2M/228M [00:00<00:04, 49.0MB/s]
15%|#4 | Downloading : 33.2M/228M [00:00<00:04, 50.7MB/s]
15%|#5 | Downloading : 35.2M/228M [00:00<00:03, 51.5MB/s]
16%|#6 | Downloading : 37.2M/228M [00:00<00:03, 54.1MB/s]
17%|#7 | Downloading : 39.2M/228M [00:00<00:03, 53.4MB/s]
18%|#8 | Downloading : 41.2M/228M [00:01<00:03, 54.5MB/s]
20%|#9 | Downloading : 45.2M/228M [00:01<00:03, 58.6MB/s]
21%|## | Downloading : 47.2M/228M [00:01<00:03, 60.3MB/s]
22%|##1 | Downloading : 49.2M/228M [00:01<00:03, 62.2MB/s]
23%|##3 | Downloading : 53.2M/228M [00:01<00:02, 66.1MB/s]
26%|##6 | Downloading : 59.2M/228M [00:01<00:02, 70.6MB/s]
28%|##7 | Downloading : 63.2M/228M [00:01<00:02, 74.4MB/s]
30%|##9 | Downloading : 67.2M/228M [00:01<00:02, 78.0MB/s]
31%|###1 | Downloading : 71.2M/228M [00:01<00:02, 81.9MB/s]
33%|###3 | Downloading : 75.2M/228M [00:01<00:01, 83.1MB/s]
35%|###4 | Downloading : 79.2M/228M [00:01<00:01, 82.6MB/s]
37%|###6 | Downloading : 83.2M/228M [00:01<00:01, 83.1MB/s]
38%|###8 | Downloading : 87.2M/228M [00:01<00:01, 85.6MB/s]
40%|#### | Downloading : 91.2M/228M [00:01<00:02, 57.5MB/s]
41%|#### | Downloading : 93.2M/228M [00:02<00:02, 48.6MB/s]
41%|####1 | Downloading : 94.2M/228M [00:02<00:03, 46.2MB/s]
42%|####1 | Downloading : 95.2M/228M [00:02<00:03, 43.6MB/s]
42%|####2 | Downloading : 96.2M/228M [00:02<00:03, 41.2MB/s]
43%|####2 | Downloading : 97.2M/228M [00:02<00:03, 39.1MB/s]
43%|####3 | Downloading : 98.2M/228M [00:02<00:03, 37.1MB/s]
44%|####3 | Downloading : 99.2M/228M [00:02<00:03, 35.7MB/s]
44%|####4 | Downloading : 100M/228M [00:02<00:03, 33.8MB/s]
44%|####4 | Downloading : 101M/228M [00:02<00:04, 32.3MB/s]
45%|####4 | Downloading : 102M/228M [00:02<00:04, 30.9MB/s]
45%|####5 | Downloading : 103M/228M [00:02<00:04, 29.6MB/s]
46%|####5 | Downloading : 104M/228M [00:02<00:04, 28.4MB/s]
46%|####6 | Downloading : 105M/228M [00:03<00:04, 27.2MB/s]
47%|####6 | Downloading : 106M/228M [00:03<00:04, 26.4MB/s]
47%|####7 | Downloading : 107M/228M [00:03<00:04, 25.4MB/s]
48%|####7 | Downloading : 108M/228M [00:03<00:05, 24.6MB/s]
48%|####7 | Downloading : 109M/228M [00:03<00:05, 23.2MB/s]
48%|####8 | Downloading : 110M/228M [00:03<00:05, 22.7MB/s]
48%|####8 | Downloading : 110M/228M [00:03<00:05, 21.8MB/s]
49%|####8 | Downloading : 111M/228M [00:03<00:05, 21.9MB/s]
50%|##### | Downloading : 114M/228M [00:03<00:04, 23.8MB/s]
51%|#####1 | Downloading : 116M/228M [00:03<00:04, 25.0MB/s]
52%|#####1 | Downloading : 118M/228M [00:03<00:04, 26.0MB/s]
53%|#####2 | Downloading : 120M/228M [00:03<00:04, 27.0MB/s]
54%|#####3 | Downloading : 122M/228M [00:03<00:04, 27.7MB/s]
55%|#####4 | Downloading : 124M/228M [00:03<00:03, 28.9MB/s]
55%|#####5 | Downloading : 126M/228M [00:03<00:03, 30.0MB/s]
56%|#####6 | Downloading : 128M/228M [00:03<00:03, 31.2MB/s]
57%|#####7 | Downloading : 130M/228M [00:03<00:03, 32.4MB/s]
59%|#####8 | Downloading : 134M/228M [00:03<00:02, 35.1MB/s]
60%|#####9 | Downloading : 136M/228M [00:03<00:02, 36.5MB/s]
61%|###### | Downloading : 138M/228M [00:03<00:02, 37.5MB/s]
62%|######1 | Downloading : 140M/228M [00:03<00:02, 38.8MB/s]
62%|######2 | Downloading : 142M/228M [00:04<00:02, 40.3MB/s]
63%|######3 | Downloading : 144M/228M [00:04<00:02, 41.8MB/s]
64%|######4 | Downloading : 146M/228M [00:04<00:01, 43.3MB/s]
66%|######5 | Downloading : 150M/228M [00:04<00:01, 45.4MB/s]
67%|######6 | Downloading : 152M/228M [00:04<00:01, 46.1MB/s]
68%|######7 | Downloading : 154M/228M [00:04<00:01, 46.1MB/s]
69%|######8 | Downloading : 156M/228M [00:04<00:01, 47.3MB/s]
70%|####### | Downloading : 160M/228M [00:04<00:01, 50.6MB/s]
72%|#######2 | Downloading : 164M/228M [00:04<00:01, 53.4MB/s]
74%|#######3 | Downloading : 168M/228M [00:04<00:01, 56.4MB/s]
75%|#######4 | Downloading : 170M/228M [00:04<00:01, 46.4MB/s]
76%|#######6 | Downloading : 173M/228M [00:04<00:01, 48.6MB/s]
77%|#######6 | Downloading : 175M/228M [00:04<00:01, 49.9MB/s]
79%|#######8 | Downloading : 179M/228M [00:04<00:00, 52.5MB/s]
80%|######## | Downloading : 183M/228M [00:04<00:00, 55.5MB/s]
81%|########1 | Downloading : 185M/228M [00:04<00:00, 56.8MB/s]
82%|########2 | Downloading : 187M/228M [00:04<00:00, 58.1MB/s]
84%|########3 | Downloading : 191M/228M [00:04<00:00, 60.1MB/s]
86%|########5 | Downloading : 195M/228M [00:04<00:00, 62.5MB/s]
87%|########7 | Downloading : 199M/228M [00:04<00:00, 58.2MB/s]
88%|########7 | Downloading : 200M/228M [00:04<00:00, 53.6MB/s]
88%|########8 | Downloading : 201M/228M [00:04<00:00, 52.9MB/s]
89%|########9 | Downloading : 203M/228M [00:05<00:00, 53.6MB/s]
91%|######### | Downloading : 206M/228M [00:05<00:00, 55.6MB/s]
92%|#########2| Downloading : 210M/228M [00:05<00:00, 57.9MB/s]
93%|#########3| Downloading : 212M/228M [00:05<00:00, 58.9MB/s]
94%|#########4| Downloading : 214M/228M [00:05<00:00, 58.1MB/s]
95%|#########4| Downloading : 216M/228M [00:05<00:00, 58.7MB/s]
96%|#########5| Downloading : 218M/228M [00:05<00:00, 59.9MB/s]
97%|#########6| Downloading : 220M/228M [00:05<00:00, 60.7MB/s]
98%|#########7| Downloading : 222M/228M [00:05<00:00, 62.0MB/s]
98%|#########8| Downloading : 224M/228M [00:05<00:00, 56.3MB/s]
99%|#########8| Downloading : 225M/228M [00:05<00:00, 49.2MB/s]
99%|#########9| Downloading : 226M/228M [00:05<00:00, 46.5MB/s]
99%|#########9| Downloading : 226M/228M [00:05<00:00, 44.5MB/s]
100%|#########9| Downloading : 227M/228M [00:05<00:00, 42.5MB/s]
100%|#########9| Downloading : 227M/228M [00:05<00:00, 40.3MB/s]
100%|#########9| Downloading : 228M/228M [00:05<00:00, 38.5MB/s]
100%|##########| Downloading : 228M/228M [00:05<00:00, 41.2MB/s]
Verifying hash b31509cdcf7908af6a83dc5ee8f49fb1.
File saved as /tmp/tmpiil1jqc_/temp.zip.
Extracting missing files
Successfully extracted 10 files
Reading a source space...
[done]
1 source spaces read
Volume source space(s) present...
Loading /home/circleci/mne_data/MNE-sample-data/subjects/sample/mri/brain.mgz as "from" volume
Loading /home/circleci/mne_data/MNE-sample-data/subjects/fsaverage/mri/brain.mgz as "to" volume
Computing nonlinear Symmetric Diffeomorphic Registration...
Optimizing translation:
Optimizing level 2 [max iter: 10]
Optimizing level 1 [max iter: 10]
Optimizing level 0 [max iter: 5]
Optimizing rigid-body:
Optimizing level 2 [max iter: 10]
Optimizing level 1 [max iter: 10]
Optimizing level 0 [max iter: 5]
Translation: 22.7 mm
Rotation: 20.7°
R²: 96.5%
Optimizing full affine:
Optimizing level 2 [max iter: 10]
Optimizing level 1 [max iter: 10]
Optimizing level 0 [max iter: 5]
R²: 96.9%
Optimizing SDR:
R²: 99.0%
[done]
0%| | Time : 0/16 [00:00<?, ?it/s]
6%|6 | Time : 1/16 [00:00<00:02, 6.17it/s]
12%|#2 | Time : 2/16 [00:00<00:01, 7.58it/s]
19%|#8 | Time : 3/16 [00:00<00:01, 8.19it/s]
25%|##5 | Time : 4/16 [00:00<00:01, 8.56it/s]
31%|###1 | Time : 5/16 [00:00<00:01, 8.79it/s]
38%|###7 | Time : 6/16 [00:00<00:01, 8.94it/s]
44%|####3 | Time : 7/16 [00:00<00:00, 9.06it/s]
50%|##### | Time : 8/16 [00:00<00:00, 9.16it/s]
56%|#####6 | Time : 9/16 [00:00<00:00, 9.25it/s]
62%|######2 | Time : 10/16 [00:01<00:00, 9.31it/s]
69%|######8 | Time : 11/16 [00:01<00:00, 9.34it/s]
75%|#######5 | Time : 12/16 [00:01<00:00, 9.38it/s]
81%|########1 | Time : 13/16 [00:01<00:00, 9.41it/s]
88%|########7 | Time : 14/16 [00:01<00:00, 9.43it/s]
94%|#########3| Time : 15/16 [00:01<00:00, 9.44it/s]
100%|##########| Time : 16/16 [00:01<00:00, 9.43it/s]
100%|##########| Time : 16/16 [00:01<00:00, 9.34it/s]
Fixing initial time: 0.085 sec
Showing: t = 0.087 s, (50.0, -20.0, -15.0) mm, [26, 19, 12] vox, 16097 vertex
```

## References¶

- 1(1,2)
Barry D. Van Veen, Wim van Drongelen, Moshe Yuchtman, and Akifumi Suzuki. Localization of brain electrical activity via linearly constrained minimum variance spatial filtering.

*IEEE Transactions on Biomedical Engineering*, 44(9):867–880, 1997. doi:10.1109/10.623056.- 2
Joachim Groß, Jan Kujala, Matti S. Hämäläinen, Lars Timmermann, Alfons Schnitzler, and Riitta Salmelin. Dynamic imaging of coherent sources: studying neural interactions in the human brain.

*Proceedings of the National Academy of Sciences*, 98(2):694–699, 2001. doi:10.1073/pnas.98.2.694.- 3
Matthew J. Brookes, Jiri Vrba, Stephen E. Robinson, Claire M. Stevenson, Andrew M. Peters, Gareth R. Barnes, Arjan Hillebrand, and Peter G. Morris. Optimising experimental design for MEG beamformer imaging.

*NeuroImage*, 39(4):1788–1802, 2008. doi:10.1016/j.neuroimage.2007.09.050.

**Total running time of the script:** ( 1 minutes 28.404 seconds)

**Estimated memory usage:** 838 MB