Note
Go to the end to download the full example code.
Compute a cross-spectral density (CSD) matrix#
A cross-spectral density (CSD) matrix is similar to a covariance matrix, but in the time-frequency domain. It is the first step towards computing sensor-to-sensor coherence or a DICS beamformer.
This script demonstrates the three methods that MNE-Python provides to compute the CSD:
Using short-term Fourier transform:
mne.time_frequency.csd_fourier()
Using a multitaper approach:
mne.time_frequency.csd_multitaper()
Using Morlet wavelets:
mne.time_frequency.csd_morlet()
# Author: Marijn van Vliet <w.m.vanvliet@gmail.com>
# License: BSD-3-Clause
# Copyright the MNE-Python contributors.
import mne
from mne.datasets import sample
from mne.time_frequency import csd_fourier, csd_morlet, csd_multitaper
print(__doc__)
In the following example, the computation of the CSD matrices can be
performed using multiple cores. Set n_jobs
to a value >1 to select the
number of cores to use.
n_jobs = 1
Loading the sample dataset.
data_path = sample.data_path()
meg_path = data_path / "MEG" / "sample"
fname_raw = meg_path / "sample_audvis_raw.fif"
fname_event = meg_path / "sample_audvis_raw-eve.fif"
raw = mne.io.read_raw_fif(fname_raw)
events = mne.read_events(fname_event)
Opening raw data file /home/circleci/mne_data/MNE-sample-data/MEG/sample/sample_audvis_raw.fif...
Read a total of 3 projection items:
PCA-v1 (1 x 102) idle
PCA-v2 (1 x 102) idle
PCA-v3 (1 x 102) idle
Range : 25800 ... 192599 = 42.956 ... 320.670 secs
Ready.
By default, CSD matrices are computed using all MEG/EEG channels. When interpreting a CSD matrix with mixed sensor types, be aware that the measurement units, and thus the scalings, differ across sensors. In this example, for speed and clarity, we select a single channel type: gradiometers.
picks = mne.pick_types(raw.info, meg="grad")
# Make some epochs, based on events with trigger code 1
epochs = mne.Epochs(
raw,
events,
event_id=1,
tmin=-0.2,
tmax=1,
picks=picks,
baseline=(None, 0),
reject=dict(grad=4000e-13),
preload=True,
)
Not setting metadata
72 matching events found
Setting baseline interval to [-0.19979521315838786, 0.0] s
Applying baseline correction (mode: mean)
0 projection items activated
Loading data for 72 events and 722 original time points ...
0 bad epochs dropped
Computing CSD matrices using short-term Fourier transform and (adaptive) multitapers is straightforward:
csd_fft = csd_fourier(epochs, fmin=15, fmax=20, n_jobs=n_jobs)
csd_mt = csd_multitaper(epochs, fmin=15, fmax=20, adaptive=True, n_jobs=n_jobs)
Computing cross-spectral density from epochs...
0%| | CSD epoch blocks : 0/72 [00:00<?, ?it/s]
1%|▏ | CSD epoch blocks : 1/72 [00:00<00:01, 37.48it/s]
3%|▎ | CSD epoch blocks : 2/72 [00:00<00:01, 37.62it/s]
4%|▍ | CSD epoch blocks : 3/72 [00:00<00:01, 37.29it/s]
6%|▌ | CSD epoch blocks : 4/72 [00:00<00:01, 38.65it/s]
7%|▋ | CSD epoch blocks : 5/72 [00:00<00:01, 40.35it/s]
8%|▊ | CSD epoch blocks : 6/72 [00:00<00:01, 41.30it/s]
10%|▉ | CSD epoch blocks : 7/72 [00:00<00:01, 42.32it/s]
11%|█ | CSD epoch blocks : 8/72 [00:00<00:01, 42.00it/s]
12%|█▎ | CSD epoch blocks : 9/72 [00:00<00:01, 41.85it/s]
14%|█▍ | CSD epoch blocks : 10/72 [00:00<00:01, 40.99it/s]
15%|█▌ | CSD epoch blocks : 11/72 [00:00<00:01, 40.95it/s]
17%|█▋ | CSD epoch blocks : 12/72 [00:00<00:01, 40.74it/s]
18%|█▊ | CSD epoch blocks : 13/72 [00:00<00:01, 40.86it/s]
19%|█▉ | CSD epoch blocks : 14/72 [00:00<00:01, 40.93it/s]
21%|██ | CSD epoch blocks : 15/72 [00:00<00:01, 41.12it/s]
22%|██▏ | CSD epoch blocks : 16/72 [00:00<00:01, 41.12it/s]
24%|██▎ | CSD epoch blocks : 17/72 [00:00<00:01, 41.30it/s]
25%|██▌ | CSD epoch blocks : 18/72 [00:00<00:01, 41.27it/s]
26%|██▋ | CSD epoch blocks : 19/72 [00:00<00:01, 40.66it/s]
28%|██▊ | CSD epoch blocks : 20/72 [00:00<00:01, 40.64it/s]
29%|██▉ | CSD epoch blocks : 21/72 [00:00<00:01, 40.82it/s]
31%|███ | CSD epoch blocks : 22/72 [00:00<00:01, 40.87it/s]
32%|███▏ | CSD epoch blocks : 23/72 [00:00<00:01, 41.14it/s]
33%|███▎ | CSD epoch blocks : 24/72 [00:00<00:01, 41.26it/s]
35%|███▍ | CSD epoch blocks : 25/72 [00:00<00:01, 41.50it/s]
36%|███▌ | CSD epoch blocks : 26/72 [00:00<00:01, 41.67it/s]
38%|███▊ | CSD epoch blocks : 27/72 [00:00<00:01, 41.98it/s]
39%|███▉ | CSD epoch blocks : 28/72 [00:00<00:01, 41.89it/s]
40%|████ | CSD epoch blocks : 29/72 [00:00<00:01, 42.02it/s]
42%|████▏ | CSD epoch blocks : 30/72 [00:00<00:01, 41.78it/s]
43%|████▎ | CSD epoch blocks : 31/72 [00:00<00:00, 41.55it/s]
44%|████▍ | CSD epoch blocks : 32/72 [00:00<00:00, 41.08it/s]
46%|████▌ | CSD epoch blocks : 33/72 [00:00<00:00, 40.82it/s]
47%|████▋ | CSD epoch blocks : 34/72 [00:00<00:00, 40.52it/s]
49%|████▊ | CSD epoch blocks : 35/72 [00:00<00:00, 40.40it/s]
50%|█████ | CSD epoch blocks : 36/72 [00:00<00:00, 39.96it/s]
51%|█████▏ | CSD epoch blocks : 37/72 [00:00<00:00, 39.73it/s]
53%|█████▎ | CSD epoch blocks : 38/72 [00:00<00:00, 39.63it/s]
54%|█████▍ | CSD epoch blocks : 39/72 [00:00<00:00, 39.89it/s]
56%|█████▌ | CSD epoch blocks : 40/72 [00:00<00:00, 40.02it/s]
57%|█████▋ | CSD epoch blocks : 41/72 [00:01<00:00, 40.12it/s]
58%|█████▊ | CSD epoch blocks : 42/72 [00:01<00:00, 40.03it/s]
60%|█████▉ | CSD epoch blocks : 43/72 [00:01<00:00, 40.23it/s]
61%|██████ | CSD epoch blocks : 44/72 [00:01<00:00, 40.27it/s]
62%|██████▎ | CSD epoch blocks : 45/72 [00:01<00:00, 40.40it/s]
64%|██████▍ | CSD epoch blocks : 46/72 [00:01<00:00, 40.34it/s]
65%|██████▌ | CSD epoch blocks : 47/72 [00:01<00:00, 40.42it/s]
67%|██████▋ | CSD epoch blocks : 48/72 [00:01<00:00, 40.35it/s]
68%|██████▊ | CSD epoch blocks : 49/72 [00:01<00:00, 40.34it/s]
69%|██████▉ | CSD epoch blocks : 50/72 [00:01<00:00, 40.21it/s]
71%|███████ | CSD epoch blocks : 51/72 [00:01<00:00, 40.07it/s]
72%|███████▏ | CSD epoch blocks : 52/72 [00:01<00:00, 39.90it/s]
74%|███████▎ | CSD epoch blocks : 53/72 [00:01<00:00, 39.82it/s]
75%|███████▌ | CSD epoch blocks : 54/72 [00:01<00:00, 39.65it/s]
76%|███████▋ | CSD epoch blocks : 55/72 [00:01<00:00, 39.59it/s]
78%|███████▊ | CSD epoch blocks : 56/72 [00:01<00:00, 39.48it/s]
79%|███████▉ | CSD epoch blocks : 57/72 [00:01<00:00, 39.48it/s]
81%|████████ | CSD epoch blocks : 58/72 [00:01<00:00, 39.43it/s]
82%|████████▏ | CSD epoch blocks : 59/72 [00:01<00:00, 39.42it/s]
83%|████████▎ | CSD epoch blocks : 60/72 [00:01<00:00, 39.35it/s]
85%|████████▍ | CSD epoch blocks : 61/72 [00:01<00:00, 39.35it/s]
86%|████████▌ | CSD epoch blocks : 62/72 [00:01<00:00, 39.24it/s]
88%|████████▊ | CSD epoch blocks : 63/72 [00:01<00:00, 37.49it/s]
89%|████████▉ | CSD epoch blocks : 64/72 [00:01<00:00, 37.38it/s]
90%|█████████ | CSD epoch blocks : 65/72 [00:01<00:00, 37.05it/s]
92%|█████████▏| CSD epoch blocks : 66/72 [00:01<00:00, 36.25it/s]
93%|█████████▎| CSD epoch blocks : 67/72 [00:01<00:00, 36.19it/s]
94%|█████████▍| CSD epoch blocks : 68/72 [00:01<00:00, 36.28it/s]
96%|█████████▌| CSD epoch blocks : 69/72 [00:01<00:00, 36.38it/s]
97%|█████████▋| CSD epoch blocks : 70/72 [00:01<00:00, 36.42it/s]
99%|█████████▊| CSD epoch blocks : 71/72 [00:01<00:00, 36.57it/s]
100%|██████████| CSD epoch blocks : 72/72 [00:01<00:00, 36.70it/s]
100%|██████████| CSD epoch blocks : 72/72 [00:01<00:00, 38.86it/s]
[done]
Using multitaper spectrum estimation with 7 DPSS windows
Computing cross-spectral density from epochs...
0%| | CSD epoch blocks : 0/72 [00:00<?, ?it/s]
1%|▏ | CSD epoch blocks : 1/72 [00:00<00:15, 4.71it/s]
3%|▎ | CSD epoch blocks : 2/72 [00:00<00:14, 4.98it/s]
4%|▍ | CSD epoch blocks : 3/72 [00:00<00:13, 5.13it/s]
6%|▌ | CSD epoch blocks : 4/72 [00:00<00:13, 5.20it/s]
7%|▋ | CSD epoch blocks : 5/72 [00:00<00:12, 5.23it/s]
8%|▊ | CSD epoch blocks : 6/72 [00:01<00:12, 5.25it/s]
10%|▉ | CSD epoch blocks : 7/72 [00:01<00:12, 5.27it/s]
11%|█ | CSD epoch blocks : 8/72 [00:01<00:12, 5.28it/s]
12%|█▎ | CSD epoch blocks : 9/72 [00:01<00:11, 5.29it/s]
14%|█▍ | CSD epoch blocks : 10/72 [00:01<00:11, 5.30it/s]
15%|█▌ | CSD epoch blocks : 11/72 [00:02<00:11, 5.32it/s]
17%|█▋ | CSD epoch blocks : 12/72 [00:02<00:11, 5.34it/s]
18%|█▊ | CSD epoch blocks : 13/72 [00:02<00:11, 5.34it/s]
19%|█▉ | CSD epoch blocks : 14/72 [00:02<00:10, 5.34it/s]
21%|██ | CSD epoch blocks : 15/72 [00:02<00:10, 5.34it/s]
22%|██▏ | CSD epoch blocks : 16/72 [00:03<00:10, 5.35it/s]
24%|██▎ | CSD epoch blocks : 17/72 [00:03<00:10, 5.35it/s]
25%|██▌ | CSD epoch blocks : 18/72 [00:03<00:10, 5.35it/s]
26%|██▋ | CSD epoch blocks : 19/72 [00:03<00:09, 5.35it/s]
28%|██▊ | CSD epoch blocks : 20/72 [00:03<00:09, 5.36it/s]
29%|██▉ | CSD epoch blocks : 21/72 [00:03<00:09, 5.35it/s]
31%|███ | CSD epoch blocks : 22/72 [00:04<00:09, 5.36it/s]
32%|███▏ | CSD epoch blocks : 23/72 [00:04<00:09, 5.36it/s]
33%|███▎ | CSD epoch blocks : 24/72 [00:04<00:08, 5.36it/s]
35%|███▍ | CSD epoch blocks : 25/72 [00:04<00:08, 5.36it/s]
36%|███▌ | CSD epoch blocks : 26/72 [00:04<00:08, 5.37it/s]
38%|███▊ | CSD epoch blocks : 27/72 [00:05<00:08, 5.37it/s]
39%|███▉ | CSD epoch blocks : 28/72 [00:05<00:08, 5.38it/s]
40%|████ | CSD epoch blocks : 29/72 [00:05<00:07, 5.38it/s]
42%|████▏ | CSD epoch blocks : 30/72 [00:05<00:07, 5.38it/s]
43%|████▎ | CSD epoch blocks : 31/72 [00:05<00:07, 5.37it/s]
44%|████▍ | CSD epoch blocks : 32/72 [00:05<00:07, 5.37it/s]
46%|████▌ | CSD epoch blocks : 33/72 [00:06<00:07, 5.37it/s]
47%|████▋ | CSD epoch blocks : 34/72 [00:06<00:07, 5.37it/s]
49%|████▊ | CSD epoch blocks : 35/72 [00:06<00:06, 5.37it/s]
50%|█████ | CSD epoch blocks : 36/72 [00:06<00:06, 5.37it/s]
51%|█████▏ | CSD epoch blocks : 37/72 [00:06<00:06, 5.36it/s]
53%|█████▎ | CSD epoch blocks : 38/72 [00:07<00:06, 5.36it/s]
54%|█████▍ | CSD epoch blocks : 39/72 [00:07<00:06, 5.36it/s]
56%|█████▌ | CSD epoch blocks : 40/72 [00:07<00:05, 5.36it/s]
57%|█████▋ | CSD epoch blocks : 41/72 [00:07<00:05, 5.36it/s]
58%|█████▊ | CSD epoch blocks : 42/72 [00:07<00:05, 5.36it/s]
60%|█████▉ | CSD epoch blocks : 43/72 [00:08<00:05, 5.36it/s]
61%|██████ | CSD epoch blocks : 44/72 [00:08<00:05, 5.36it/s]
62%|██████▎ | CSD epoch blocks : 45/72 [00:08<00:05, 5.36it/s]
64%|██████▍ | CSD epoch blocks : 46/72 [00:08<00:04, 5.36it/s]
65%|██████▌ | CSD epoch blocks : 47/72 [00:08<00:04, 5.37it/s]
67%|██████▋ | CSD epoch blocks : 48/72 [00:08<00:04, 5.37it/s]
68%|██████▊ | CSD epoch blocks : 49/72 [00:09<00:04, 5.36it/s]
69%|██████▉ | CSD epoch blocks : 50/72 [00:09<00:04, 5.36it/s]
71%|███████ | CSD epoch blocks : 51/72 [00:09<00:03, 5.37it/s]
72%|███████▏ | CSD epoch blocks : 52/72 [00:09<00:03, 5.37it/s]
74%|███████▎ | CSD epoch blocks : 53/72 [00:09<00:03, 5.36it/s]
75%|███████▌ | CSD epoch blocks : 54/72 [00:10<00:03, 5.37it/s]
76%|███████▋ | CSD epoch blocks : 55/72 [00:10<00:03, 5.37it/s]
78%|███████▊ | CSD epoch blocks : 56/72 [00:10<00:02, 5.36it/s]
79%|███████▉ | CSD epoch blocks : 57/72 [00:10<00:02, 5.36it/s]
81%|████████ | CSD epoch blocks : 58/72 [00:10<00:02, 5.36it/s]
82%|████████▏ | CSD epoch blocks : 59/72 [00:11<00:02, 5.36it/s]
83%|████████▎ | CSD epoch blocks : 60/72 [00:11<00:02, 5.36it/s]
85%|████████▍ | CSD epoch blocks : 61/72 [00:11<00:02, 5.36it/s]
86%|████████▌ | CSD epoch blocks : 62/72 [00:11<00:01, 5.37it/s]
88%|████████▊ | CSD epoch blocks : 63/72 [00:11<00:01, 5.38it/s]
89%|████████▉ | CSD epoch blocks : 64/72 [00:11<00:01, 5.39it/s]
90%|█████████ | CSD epoch blocks : 65/72 [00:12<00:01, 5.40it/s]
92%|█████████▏| CSD epoch blocks : 66/72 [00:12<00:01, 5.43it/s]
93%|█████████▎| CSD epoch blocks : 67/72 [00:12<00:00, 5.47it/s]
94%|█████████▍| CSD epoch blocks : 68/72 [00:12<00:00, 5.51it/s]
96%|█████████▌| CSD epoch blocks : 69/72 [00:12<00:00, 5.54it/s]
97%|█████████▋| CSD epoch blocks : 70/72 [00:12<00:00, 5.55it/s]
99%|█████████▊| CSD epoch blocks : 71/72 [00:13<00:00, 5.51it/s]
100%|██████████| CSD epoch blocks : 72/72 [00:13<00:00, 5.50it/s]
100%|██████████| CSD epoch blocks : 72/72 [00:13<00:00, 5.41it/s]
[done]
When computing the CSD with Morlet wavelets, you specify the exact frequencies at which to compute it. For each frequency, a corresponding wavelet will be constructed and convolved with the signal, resulting in a time-frequency decomposition.
The CSD is constructed by computing the correlation between the
time-frequency representations between all sensor-to-sensor pairs. The
time-frequency decomposition originally has the same sampling rate as the
signal, in our case ~600Hz. This means the decomposition is over-specified in
time and we may not need to use all samples during our CSD computation, just
enough to get a reliable correlation statistic. By specifying decim=10
,
we use every 10th sample, which will greatly speed up the computation and
will have a minimal effect on the CSD.
frequencies = [16, 17, 18, 19, 20]
csd_wav = csd_morlet(epochs, frequencies, decim=10, n_jobs=n_jobs)
Computing cross-spectral density from epochs...
0%| | CSD epoch blocks : 0/72 [00:00<?, ?it/s]
1%|▏ | CSD epoch blocks : 1/72 [00:00<00:06, 10.36it/s]
3%|▎ | CSD epoch blocks : 2/72 [00:00<00:06, 10.30it/s]
4%|▍ | CSD epoch blocks : 3/72 [00:00<00:06, 10.32it/s]
6%|▌ | CSD epoch blocks : 4/72 [00:00<00:06, 10.30it/s]
7%|▋ | CSD epoch blocks : 5/72 [00:00<00:06, 10.33it/s]
8%|▊ | CSD epoch blocks : 6/72 [00:00<00:06, 10.34it/s]
10%|▉ | CSD epoch blocks : 7/72 [00:00<00:06, 10.36it/s]
11%|█ | CSD epoch blocks : 8/72 [00:00<00:06, 10.37it/s]
12%|█▎ | CSD epoch blocks : 9/72 [00:00<00:06, 10.39it/s]
14%|█▍ | CSD epoch blocks : 10/72 [00:00<00:05, 10.39it/s]
15%|█▌ | CSD epoch blocks : 11/72 [00:01<00:05, 10.39it/s]
17%|█▋ | CSD epoch blocks : 12/72 [00:01<00:05, 10.39it/s]
18%|█▊ | CSD epoch blocks : 13/72 [00:01<00:05, 10.40it/s]
19%|█▉ | CSD epoch blocks : 14/72 [00:01<00:05, 10.40it/s]
21%|██ | CSD epoch blocks : 15/72 [00:01<00:05, 10.40it/s]
22%|██▏ | CSD epoch blocks : 16/72 [00:01<00:05, 10.40it/s]
24%|██▎ | CSD epoch blocks : 17/72 [00:01<00:05, 10.40it/s]
25%|██▌ | CSD epoch blocks : 18/72 [00:01<00:05, 10.39it/s]
26%|██▋ | CSD epoch blocks : 19/72 [00:01<00:05, 10.40it/s]
28%|██▊ | CSD epoch blocks : 20/72 [00:01<00:05, 10.40it/s]
29%|██▉ | CSD epoch blocks : 21/72 [00:02<00:04, 10.40it/s]
31%|███ | CSD epoch blocks : 22/72 [00:02<00:04, 10.39it/s]
32%|███▏ | CSD epoch blocks : 23/72 [00:02<00:04, 10.40it/s]
33%|███▎ | CSD epoch blocks : 24/72 [00:02<00:04, 10.39it/s]
35%|███▍ | CSD epoch blocks : 25/72 [00:02<00:04, 10.39it/s]
36%|███▌ | CSD epoch blocks : 26/72 [00:02<00:04, 10.39it/s]
38%|███▊ | CSD epoch blocks : 27/72 [00:02<00:04, 10.40it/s]
39%|███▉ | CSD epoch blocks : 28/72 [00:02<00:04, 10.39it/s]
40%|████ | CSD epoch blocks : 29/72 [00:02<00:04, 10.39it/s]
42%|████▏ | CSD epoch blocks : 30/72 [00:02<00:04, 10.39it/s]
43%|████▎ | CSD epoch blocks : 31/72 [00:02<00:03, 10.39it/s]
44%|████▍ | CSD epoch blocks : 32/72 [00:03<00:03, 10.38it/s]
46%|████▌ | CSD epoch blocks : 33/72 [00:03<00:03, 10.38it/s]
47%|████▋ | CSD epoch blocks : 34/72 [00:03<00:03, 10.38it/s]
49%|████▊ | CSD epoch blocks : 35/72 [00:03<00:03, 10.38it/s]
50%|█████ | CSD epoch blocks : 36/72 [00:03<00:03, 10.38it/s]
51%|█████▏ | CSD epoch blocks : 37/72 [00:03<00:03, 10.38it/s]
53%|█████▎ | CSD epoch blocks : 38/72 [00:03<00:03, 10.38it/s]
54%|█████▍ | CSD epoch blocks : 39/72 [00:03<00:03, 10.38it/s]
56%|█████▌ | CSD epoch blocks : 40/72 [00:03<00:03, 10.38it/s]
57%|█████▋ | CSD epoch blocks : 41/72 [00:03<00:02, 10.38it/s]
58%|█████▊ | CSD epoch blocks : 42/72 [00:04<00:02, 10.39it/s]
60%|█████▉ | CSD epoch blocks : 43/72 [00:04<00:02, 10.39it/s]
61%|██████ | CSD epoch blocks : 44/72 [00:04<00:02, 10.39it/s]
62%|██████▎ | CSD epoch blocks : 45/72 [00:04<00:02, 10.39it/s]
64%|██████▍ | CSD epoch blocks : 46/72 [00:04<00:02, 10.39it/s]
65%|██████▌ | CSD epoch blocks : 47/72 [00:04<00:02, 10.39it/s]
67%|██████▋ | CSD epoch blocks : 48/72 [00:04<00:02, 10.40it/s]
68%|██████▊ | CSD epoch blocks : 49/72 [00:04<00:02, 10.39it/s]
69%|██████▉ | CSD epoch blocks : 50/72 [00:04<00:02, 10.40it/s]
71%|███████ | CSD epoch blocks : 51/72 [00:04<00:02, 10.40it/s]
72%|███████▏ | CSD epoch blocks : 52/72 [00:05<00:01, 10.40it/s]
74%|███████▎ | CSD epoch blocks : 53/72 [00:05<00:01, 10.40it/s]
75%|███████▌ | CSD epoch blocks : 54/72 [00:05<00:01, 10.40it/s]
76%|███████▋ | CSD epoch blocks : 55/72 [00:05<00:01, 10.40it/s]
78%|███████▊ | CSD epoch blocks : 56/72 [00:05<00:01, 10.40it/s]
79%|███████▉ | CSD epoch blocks : 57/72 [00:05<00:01, 10.39it/s]
81%|████████ | CSD epoch blocks : 58/72 [00:05<00:01, 10.40it/s]
82%|████████▏ | CSD epoch blocks : 59/72 [00:05<00:01, 10.40it/s]
83%|████████▎ | CSD epoch blocks : 60/72 [00:05<00:01, 10.40it/s]
85%|████████▍ | CSD epoch blocks : 61/72 [00:05<00:01, 10.40it/s]
86%|████████▌ | CSD epoch blocks : 62/72 [00:05<00:00, 10.41it/s]
88%|████████▊ | CSD epoch blocks : 63/72 [00:06<00:00, 10.40it/s]
89%|████████▉ | CSD epoch blocks : 64/72 [00:06<00:00, 10.41it/s]
90%|█████████ | CSD epoch blocks : 65/72 [00:06<00:00, 10.40it/s]
92%|█████████▏| CSD epoch blocks : 66/72 [00:06<00:00, 10.41it/s]
93%|█████████▎| CSD epoch blocks : 67/72 [00:06<00:00, 10.41it/s]
94%|█████████▍| CSD epoch blocks : 68/72 [00:06<00:00, 10.41it/s]
96%|█████████▌| CSD epoch blocks : 69/72 [00:06<00:00, 10.41it/s]
97%|█████████▋| CSD epoch blocks : 70/72 [00:06<00:00, 10.40it/s]
99%|█████████▊| CSD epoch blocks : 71/72 [00:06<00:00, 10.40it/s]
100%|██████████| CSD epoch blocks : 72/72 [00:06<00:00, 10.40it/s]
100%|██████████| CSD epoch blocks : 72/72 [00:06<00:00, 10.40it/s]
[done]
The resulting mne.time_frequency.CrossSpectralDensity
objects have a
plotting function we can use to compare the results of the different methods.
We’re plotting the mean CSD across frequencies.
mne.time_frequency.CrossSpectralDensity.plot()
returns a list of
created figures; in this case, each returned list has only one figure
so we use a Python trick of including a comma after our variable name
to assign the figure (not the list) to our fig
variable:
Total running time of the script: (0 minutes 23.672 seconds)