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
import mne
from mne.datasets import sample
from mne.time_frequency import csd_fourier, csd_multitaper, csd_morlet
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] sec
Applying baseline correction (mode: mean)
3 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)
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 cross-spectral density from epochs...
0%| | CSD epoch blocks : 0/72 [00:00<?, ?it/s]
1%|1 | CSD epoch blocks : 1/72 [00:00<00:03, 21.30it/s]
3%|2 | CSD epoch blocks : 2/72 [00:00<00:02, 28.23it/s]
4%|4 | CSD epoch blocks : 3/72 [00:00<00:02, 32.92it/s]
6%|5 | CSD epoch blocks : 4/72 [00:00<00:01, 36.77it/s]
7%|6 | CSD epoch blocks : 5/72 [00:00<00:01, 39.57it/s]
8%|8 | CSD epoch blocks : 6/72 [00:00<00:01, 41.72it/s]
10%|9 | CSD epoch blocks : 7/72 [00:00<00:01, 43.42it/s]
11%|#1 | CSD epoch blocks : 8/72 [00:00<00:01, 44.78it/s]
12%|#2 | CSD epoch blocks : 9/72 [00:00<00:01, 45.90it/s]
14%|#3 | CSD epoch blocks : 10/72 [00:00<00:01, 46.76it/s]
15%|#5 | CSD epoch blocks : 11/72 [00:00<00:01, 47.54it/s]
17%|#6 | CSD epoch blocks : 12/72 [00:00<00:01, 48.27it/s]
18%|#8 | CSD epoch blocks : 13/72 [00:00<00:01, 48.81it/s]
19%|#9 | CSD epoch blocks : 14/72 [00:00<00:01, 49.13it/s]
21%|## | CSD epoch blocks : 15/72 [00:00<00:01, 49.23it/s]
22%|##2 | CSD epoch blocks : 16/72 [00:00<00:01, 49.57it/s]
24%|##3 | CSD epoch blocks : 17/72 [00:00<00:01, 49.89it/s]
25%|##5 | CSD epoch blocks : 18/72 [00:00<00:01, 50.21it/s]
26%|##6 | CSD epoch blocks : 19/72 [00:00<00:01, 50.50it/s]
28%|##7 | CSD epoch blocks : 20/72 [00:00<00:01, 50.78it/s]
29%|##9 | CSD epoch blocks : 21/72 [00:00<00:00, 51.03it/s]
31%|### | CSD epoch blocks : 22/72 [00:00<00:00, 51.27it/s]
32%|###1 | CSD epoch blocks : 23/72 [00:00<00:00, 51.49it/s]
33%|###3 | CSD epoch blocks : 24/72 [00:00<00:00, 51.69it/s]
35%|###4 | CSD epoch blocks : 25/72 [00:00<00:00, 51.83it/s]
36%|###6 | CSD epoch blocks : 26/72 [00:00<00:00, 51.68it/s]
38%|###7 | CSD epoch blocks : 27/72 [00:00<00:00, 51.92it/s]
39%|###8 | CSD epoch blocks : 28/72 [00:00<00:00, 52.07it/s]
40%|#### | CSD epoch blocks : 29/72 [00:00<00:00, 52.17it/s]
42%|####1 | CSD epoch blocks : 30/72 [00:00<00:00, 52.20it/s]
43%|####3 | CSD epoch blocks : 31/72 [00:00<00:00, 52.30it/s]
44%|####4 | CSD epoch blocks : 32/72 [00:00<00:00, 52.46it/s]
46%|####5 | CSD epoch blocks : 33/72 [00:00<00:00, 52.45it/s]
47%|####7 | CSD epoch blocks : 34/72 [00:00<00:00, 52.55it/s]
49%|####8 | CSD epoch blocks : 35/72 [00:00<00:00, 52.67it/s]
50%|##### | CSD epoch blocks : 36/72 [00:00<00:00, 52.78it/s]
51%|#####1 | CSD epoch blocks : 37/72 [00:00<00:00, 52.97it/s]
53%|#####2 | CSD epoch blocks : 38/72 [00:00<00:00, 53.12it/s]
54%|#####4 | CSD epoch blocks : 39/72 [00:00<00:00, 53.24it/s]
56%|#####5 | CSD epoch blocks : 40/72 [00:00<00:00, 53.40it/s]
57%|#####6 | CSD epoch blocks : 41/72 [00:00<00:00, 53.48it/s]
58%|#####8 | CSD epoch blocks : 42/72 [00:00<00:00, 53.38it/s]
60%|#####9 | CSD epoch blocks : 43/72 [00:00<00:00, 53.43it/s]
61%|######1 | CSD epoch blocks : 44/72 [00:00<00:00, 53.50it/s]
62%|######2 | CSD epoch blocks : 45/72 [00:00<00:00, 53.46it/s]
64%|######3 | CSD epoch blocks : 46/72 [00:00<00:00, 53.53it/s]
65%|######5 | CSD epoch blocks : 47/72 [00:00<00:00, 52.74it/s]
67%|######6 | CSD epoch blocks : 48/72 [00:00<00:00, 52.71it/s]
68%|######8 | CSD epoch blocks : 49/72 [00:00<00:00, 52.67it/s]
69%|######9 | CSD epoch blocks : 50/72 [00:00<00:00, 52.68it/s]
71%|####### | CSD epoch blocks : 51/72 [00:00<00:00, 52.72it/s]
72%|#######2 | CSD epoch blocks : 52/72 [00:01<00:00, 52.79it/s]
74%|#######3 | CSD epoch blocks : 53/72 [00:01<00:00, 52.91it/s]
75%|#######5 | CSD epoch blocks : 54/72 [00:01<00:00, 52.97it/s]
76%|#######6 | CSD epoch blocks : 55/72 [00:01<00:00, 52.99it/s]
78%|#######7 | CSD epoch blocks : 56/72 [00:01<00:00, 53.08it/s]
79%|#######9 | CSD epoch blocks : 57/72 [00:01<00:00, 53.23it/s]
81%|######## | CSD epoch blocks : 58/72 [00:01<00:00, 53.27it/s]
82%|########1 | CSD epoch blocks : 59/72 [00:01<00:00, 53.35it/s]
83%|########3 | CSD epoch blocks : 60/72 [00:01<00:00, 53.02it/s]
85%|########4 | CSD epoch blocks : 61/72 [00:01<00:00, 53.07it/s]
86%|########6 | CSD epoch blocks : 62/72 [00:01<00:00, 52.80it/s]
88%|########7 | CSD epoch blocks : 63/72 [00:01<00:00, 52.78it/s]
89%|########8 | CSD epoch blocks : 64/72 [00:01<00:00, 52.73it/s]
90%|######### | CSD epoch blocks : 65/72 [00:01<00:00, 52.78it/s]
92%|#########1| CSD epoch blocks : 66/72 [00:01<00:00, 52.83it/s]
93%|#########3| CSD epoch blocks : 67/72 [00:01<00:00, 52.90it/s]
94%|#########4| CSD epoch blocks : 68/72 [00:01<00:00, 52.94it/s]
96%|#########5| CSD epoch blocks : 69/72 [00:01<00:00, 53.05it/s]
97%|#########7| CSD epoch blocks : 70/72 [00:01<00:00, 53.08it/s]
99%|#########8| CSD epoch blocks : 71/72 [00:01<00:00, 53.17it/s]
100%|##########| CSD epoch blocks : 72/72 [00:01<00:00, 53.29it/s]
100%|##########| CSD epoch blocks : 72/72 [00:01<00:00, 52.12it/s]
[done]
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>
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%|1 | CSD epoch blocks : 1/72 [00:00<00:16, 4.30it/s]
3%|2 | CSD epoch blocks : 2/72 [00:00<00:12, 5.53it/s]
4%|4 | CSD epoch blocks : 3/72 [00:00<00:11, 6.14it/s]
6%|5 | CSD epoch blocks : 4/72 [00:00<00:10, 6.48it/s]
7%|6 | CSD epoch blocks : 5/72 [00:00<00:09, 6.71it/s]
8%|8 | CSD epoch blocks : 6/72 [00:00<00:09, 6.88it/s]
10%|9 | CSD epoch blocks : 7/72 [00:01<00:09, 6.99it/s]
11%|#1 | CSD epoch blocks : 8/72 [00:01<00:09, 6.81it/s]
12%|#2 | CSD epoch blocks : 9/72 [00:01<00:09, 6.64it/s]
14%|#3 | CSD epoch blocks : 10/72 [00:01<00:09, 6.60it/s]
15%|#5 | CSD epoch blocks : 11/72 [00:01<00:09, 6.71it/s]
17%|#6 | CSD epoch blocks : 12/72 [00:01<00:08, 6.80it/s]
18%|#8 | CSD epoch blocks : 13/72 [00:01<00:08, 6.88it/s]
19%|#9 | CSD epoch blocks : 14/72 [00:02<00:08, 6.96it/s]
21%|## | CSD epoch blocks : 15/72 [00:02<00:08, 7.02it/s]
22%|##2 | CSD epoch blocks : 16/72 [00:02<00:07, 7.09it/s]
24%|##3 | CSD epoch blocks : 17/72 [00:02<00:07, 7.13it/s]
25%|##5 | CSD epoch blocks : 18/72 [00:02<00:07, 7.14it/s]
26%|##6 | CSD epoch blocks : 19/72 [00:02<00:07, 7.11it/s]
28%|##7 | CSD epoch blocks : 20/72 [00:02<00:07, 7.10it/s]
29%|##9 | CSD epoch blocks : 21/72 [00:02<00:07, 7.12it/s]
31%|### | CSD epoch blocks : 22/72 [00:03<00:06, 7.16it/s]
32%|###1 | CSD epoch blocks : 23/72 [00:03<00:06, 7.14it/s]
33%|###3 | CSD epoch blocks : 24/72 [00:03<00:06, 7.03it/s]
35%|###4 | CSD epoch blocks : 25/72 [00:03<00:06, 6.98it/s]
36%|###6 | CSD epoch blocks : 26/72 [00:03<00:06, 7.03it/s]
38%|###7 | CSD epoch blocks : 27/72 [00:03<00:06, 7.07it/s]
39%|###8 | CSD epoch blocks : 28/72 [00:03<00:06, 7.11it/s]
40%|#### | CSD epoch blocks : 29/72 [00:04<00:06, 7.14it/s]
42%|####1 | CSD epoch blocks : 30/72 [00:04<00:05, 7.17it/s]
43%|####3 | CSD epoch blocks : 31/72 [00:04<00:05, 7.21it/s]
44%|####4 | CSD epoch blocks : 32/72 [00:04<00:05, 7.23it/s]
46%|####5 | CSD epoch blocks : 33/72 [00:04<00:05, 7.26it/s]
47%|####7 | CSD epoch blocks : 34/72 [00:04<00:05, 7.29it/s]
49%|####8 | CSD epoch blocks : 35/72 [00:04<00:05, 7.32it/s]
50%|##### | CSD epoch blocks : 36/72 [00:05<00:04, 7.35it/s]
51%|#####1 | CSD epoch blocks : 37/72 [00:05<00:04, 7.37it/s]
53%|#####2 | CSD epoch blocks : 38/72 [00:05<00:04, 7.39it/s]
54%|#####4 | CSD epoch blocks : 39/72 [00:05<00:04, 7.41it/s]
56%|#####5 | CSD epoch blocks : 40/72 [00:05<00:04, 7.42it/s]
57%|#####6 | CSD epoch blocks : 41/72 [00:05<00:04, 7.44it/s]
58%|#####8 | CSD epoch blocks : 42/72 [00:05<00:04, 7.46it/s]
60%|#####9 | CSD epoch blocks : 43/72 [00:05<00:03, 7.48it/s]
61%|######1 | CSD epoch blocks : 44/72 [00:06<00:03, 7.49it/s]
62%|######2 | CSD epoch blocks : 45/72 [00:06<00:03, 7.51it/s]
64%|######3 | CSD epoch blocks : 46/72 [00:06<00:03, 7.52it/s]
65%|######5 | CSD epoch blocks : 47/72 [00:06<00:03, 7.53it/s]
67%|######6 | CSD epoch blocks : 48/72 [00:06<00:03, 7.55it/s]
68%|######8 | CSD epoch blocks : 49/72 [00:06<00:03, 7.55it/s]
69%|######9 | CSD epoch blocks : 50/72 [00:06<00:02, 7.56it/s]
71%|####### | CSD epoch blocks : 51/72 [00:06<00:02, 7.57it/s]
72%|#######2 | CSD epoch blocks : 52/72 [00:07<00:02, 7.58it/s]
74%|#######3 | CSD epoch blocks : 53/72 [00:07<00:02, 7.58it/s]
75%|#######5 | CSD epoch blocks : 54/72 [00:07<00:02, 7.59it/s]
76%|#######6 | CSD epoch blocks : 55/72 [00:07<00:02, 7.60it/s]
78%|#######7 | CSD epoch blocks : 56/72 [00:07<00:02, 7.61it/s]
79%|#######9 | CSD epoch blocks : 57/72 [00:07<00:01, 7.62it/s]
81%|######## | CSD epoch blocks : 58/72 [00:07<00:01, 7.62it/s]
82%|########1 | CSD epoch blocks : 59/72 [00:07<00:01, 7.63it/s]
83%|########3 | CSD epoch blocks : 60/72 [00:08<00:01, 7.64it/s]
85%|########4 | CSD epoch blocks : 61/72 [00:08<00:01, 7.64it/s]
86%|########6 | CSD epoch blocks : 62/72 [00:08<00:01, 7.64it/s]
88%|########7 | CSD epoch blocks : 63/72 [00:08<00:01, 7.65it/s]
89%|########8 | CSD epoch blocks : 64/72 [00:08<00:01, 7.66it/s]
90%|######### | CSD epoch blocks : 65/72 [00:08<00:00, 7.66it/s]
92%|#########1| CSD epoch blocks : 66/72 [00:08<00:00, 7.67it/s]
93%|#########3| CSD epoch blocks : 67/72 [00:09<00:00, 7.67it/s]
94%|#########4| CSD epoch blocks : 68/72 [00:09<00:00, 7.67it/s]
96%|#########5| CSD epoch blocks : 69/72 [00:09<00:00, 7.67it/s]
97%|#########7| CSD epoch blocks : 70/72 [00:09<00:00, 7.67it/s]
99%|#########8| CSD epoch blocks : 71/72 [00:09<00:00, 7.62it/s]
100%|##########| CSD epoch blocks : 72/72 [00:09<00:00, 7.63it/s]
100%|##########| CSD epoch blocks : 72/72 [00:09<00:00, 7.43it/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)
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 cross-spectral density from epochs...
0%| | CSD epoch blocks : 0/72 [00:00<?, ?it/s]
1%|1 | CSD epoch blocks : 1/72 [00:00<00:08, 8.36it/s]
3%|2 | CSD epoch blocks : 2/72 [00:00<00:06, 10.07it/s]
4%|4 | CSD epoch blocks : 3/72 [00:00<00:06, 10.96it/s]
6%|5 | CSD epoch blocks : 4/72 [00:00<00:05, 11.48it/s]
7%|6 | CSD epoch blocks : 5/72 [00:00<00:05, 11.78it/s]
8%|8 | CSD epoch blocks : 6/72 [00:00<00:05, 11.94it/s]
10%|9 | CSD epoch blocks : 7/72 [00:00<00:05, 12.05it/s]
11%|#1 | CSD epoch blocks : 8/72 [00:00<00:05, 12.06it/s]
12%|#2 | CSD epoch blocks : 9/72 [00:00<00:05, 12.09it/s]
14%|#3 | CSD epoch blocks : 10/72 [00:00<00:05, 12.12it/s]
15%|#5 | CSD epoch blocks : 11/72 [00:00<00:05, 12.15it/s]
17%|#6 | CSD epoch blocks : 12/72 [00:00<00:04, 12.23it/s]
18%|#8 | CSD epoch blocks : 13/72 [00:01<00:04, 12.32it/s]
19%|#9 | CSD epoch blocks : 14/72 [00:01<00:04, 12.38it/s]
21%|## | CSD epoch blocks : 15/72 [00:01<00:04, 12.43it/s]
22%|##2 | CSD epoch blocks : 16/72 [00:01<00:04, 12.49it/s]
24%|##3 | CSD epoch blocks : 17/72 [00:01<00:04, 12.53it/s]
25%|##5 | CSD epoch blocks : 18/72 [00:01<00:04, 12.58it/s]
26%|##6 | CSD epoch blocks : 19/72 [00:01<00:04, 12.64it/s]
28%|##7 | CSD epoch blocks : 20/72 [00:01<00:04, 12.70it/s]
29%|##9 | CSD epoch blocks : 21/72 [00:01<00:04, 12.75it/s]
31%|### | CSD epoch blocks : 22/72 [00:01<00:03, 12.78it/s]
32%|###1 | CSD epoch blocks : 23/72 [00:01<00:03, 12.82it/s]
33%|###3 | CSD epoch blocks : 24/72 [00:01<00:03, 12.85it/s]
35%|###4 | CSD epoch blocks : 25/72 [00:01<00:03, 12.88it/s]
36%|###6 | CSD epoch blocks : 26/72 [00:02<00:03, 12.91it/s]
38%|###7 | CSD epoch blocks : 27/72 [00:02<00:03, 12.94it/s]
39%|###8 | CSD epoch blocks : 28/72 [00:02<00:03, 12.91it/s]
40%|#### | CSD epoch blocks : 29/72 [00:02<00:03, 12.78it/s]
42%|####1 | CSD epoch blocks : 30/72 [00:02<00:03, 12.67it/s]
43%|####3 | CSD epoch blocks : 31/72 [00:02<00:03, 12.56it/s]
44%|####4 | CSD epoch blocks : 32/72 [00:02<00:03, 12.41it/s]
46%|####5 | CSD epoch blocks : 33/72 [00:02<00:03, 12.31it/s]
47%|####7 | CSD epoch blocks : 34/72 [00:02<00:03, 12.35it/s]
49%|####8 | CSD epoch blocks : 35/72 [00:02<00:02, 12.39it/s]
50%|##### | CSD epoch blocks : 36/72 [00:02<00:02, 12.40it/s]
51%|#####1 | CSD epoch blocks : 37/72 [00:02<00:02, 12.38it/s]
53%|#####2 | CSD epoch blocks : 38/72 [00:03<00:02, 12.40it/s]
54%|#####4 | CSD epoch blocks : 39/72 [00:03<00:02, 12.44it/s]
56%|#####5 | CSD epoch blocks : 40/72 [00:03<00:02, 12.48it/s]
57%|#####6 | CSD epoch blocks : 41/72 [00:03<00:02, 12.52it/s]
58%|#####8 | CSD epoch blocks : 42/72 [00:03<00:02, 12.57it/s]
60%|#####9 | CSD epoch blocks : 43/72 [00:03<00:02, 12.59it/s]
61%|######1 | CSD epoch blocks : 44/72 [00:03<00:02, 12.63it/s]
62%|######2 | CSD epoch blocks : 45/72 [00:03<00:02, 12.66it/s]
64%|######3 | CSD epoch blocks : 46/72 [00:03<00:02, 12.68it/s]
65%|######5 | CSD epoch blocks : 47/72 [00:03<00:01, 12.71it/s]
67%|######6 | CSD epoch blocks : 48/72 [00:03<00:01, 12.74it/s]
68%|######8 | CSD epoch blocks : 49/72 [00:03<00:01, 12.54it/s]
69%|######9 | CSD epoch blocks : 50/72 [00:03<00:01, 12.56it/s]
71%|####### | CSD epoch blocks : 51/72 [00:04<00:01, 12.58it/s]
72%|#######2 | CSD epoch blocks : 52/72 [00:04<00:01, 12.61it/s]
74%|#######3 | CSD epoch blocks : 53/72 [00:04<00:01, 12.65it/s]
75%|#######5 | CSD epoch blocks : 54/72 [00:04<00:01, 12.68it/s]
76%|#######6 | CSD epoch blocks : 55/72 [00:04<00:01, 12.69it/s]
78%|#######7 | CSD epoch blocks : 56/72 [00:04<00:01, 12.71it/s]
79%|#######9 | CSD epoch blocks : 57/72 [00:04<00:01, 12.75it/s]
81%|######## | CSD epoch blocks : 58/72 [00:04<00:01, 12.77it/s]
82%|########1 | CSD epoch blocks : 59/72 [00:04<00:01, 12.77it/s]
83%|########3 | CSD epoch blocks : 60/72 [00:04<00:00, 12.79it/s]
85%|########4 | CSD epoch blocks : 61/72 [00:04<00:00, 12.82it/s]
86%|########6 | CSD epoch blocks : 62/72 [00:04<00:00, 12.72it/s]
88%|########7 | CSD epoch blocks : 63/72 [00:04<00:00, 12.70it/s]
89%|########8 | CSD epoch blocks : 64/72 [00:05<00:00, 12.74it/s]
90%|######### | CSD epoch blocks : 65/72 [00:05<00:00, 12.77it/s]
92%|#########1| CSD epoch blocks : 66/72 [00:05<00:00, 12.80it/s]
93%|#########3| CSD epoch blocks : 67/72 [00:05<00:00, 12.81it/s]
94%|#########4| CSD epoch blocks : 68/72 [00:05<00:00, 12.74it/s]
96%|#########5| CSD epoch blocks : 69/72 [00:05<00:00, 12.78it/s]
97%|#########7| CSD epoch blocks : 70/72 [00:05<00:00, 12.82it/s]
99%|#########8| CSD epoch blocks : 71/72 [00:05<00:00, 12.86it/s]
100%|##########| CSD epoch blocks : 72/72 [00:05<00:00, 12.89it/s]
100%|##########| CSD epoch blocks : 72/72 [00:05<00:00, 12.68it/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.047 seconds)
Estimated memory usage: 258 MB