[074d3d]: / examples / inverse / snr_estimate.py

Download this file

33 lines (24 with data), 821 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
.. _ex-snr-estimate:
==================================
Estimate data SNR using an inverse
==================================
This estimates the SNR as a function of time for a set of data
using a minimum-norm inverse operator.
"""
# Author: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD-3-Clause
# Copyright the MNE-Python contributors.
# %%
from mne import read_evokeds
from mne.datasets.sample import data_path
from mne.minimum_norm import read_inverse_operator
from mne.viz import plot_snr_estimate
print(__doc__)
data_dir = data_path() / "MEG" / "sample"
fname_inv = data_dir / "sample_audvis-meg-oct-6-meg-inv.fif"
fname_evoked = data_dir / "sample_audvis-ave.fif"
inv = read_inverse_operator(fname_inv)
evoked = read_evokeds(fname_evoked, baseline=(None, 0))[0]
plot_snr_estimate(evoked, inv)