Reading/Writing a noise covariance matrixΒΆ

Plot a noise covariance matrix.

# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)

from os import path as op
import mne
from mne.datasets import sample

print(__doc__)

data_path = sample.data_path()
fname_cov = op.join(data_path, 'MEG', 'sample', 'sample_audvis-cov.fif')
fname_evo = op.join(data_path, 'MEG', 'sample', 'sample_audvis-ave.fif')

cov = mne.read_cov(fname_cov)
print(cov)
evoked = mne.read_evokeds(fname_evo)[0]

Script output:

<Covariance  |  size : 366 x 366, n_samples : 15972, data : [[  2.27235589e-23   4.79818505e-24   7.12852747e-25 ...,   4.85348042e-18
    2.02846360e-18   8.26727393e-18]
 [  4.79818505e-24   5.33468523e-24   1.80261790e-25 ...,   2.33583009e-19
   -6.93161055e-19   2.35199238e-18]
 [  7.12852747e-25   1.80261790e-25   5.79073915e-26 ...,   1.09498615e-19
    6.16924072e-21   2.93873875e-19]
 ...,
 [  4.85348042e-18   2.33583009e-19   1.09498615e-19 ...,   1.40677185e-11
    1.27444183e-11   1.08634620e-11]
 [  2.02846360e-18  -6.93161055e-19   6.16924072e-21 ...,   1.27444183e-11
    1.59818134e-11   8.51070563e-12]
 [  8.26727393e-18   2.35199238e-18   2.93873875e-19 ...,   1.08634620e-11
    8.51070563e-12   1.53708918e-11]]>

Show covariance

cov.plot(evoked.info, exclude='bads', show_svd=False)
../../_images/sphx_glr_plot_read_noise_covariance_matrix_001.png

Total running time of the script: (0 minutes 0.510 seconds)

Download Python source code: plot_read_noise_covariance_matrix.py