Result of comparing the SNR with and without EEG


In [5]:
import mne
import numpy as np
from glob import glob
import matplotlib.pyplot as plt

In [6]:
%matplotlib inline 
plt.style.use("seaborn")

In [7]:
# paths 
snr_path = "/Volumes/projects/MINDLAB2016_MEG-Language-PD-DBS/scratch/mje/hilbert_data/hilbert_mne/snr/"
epochs_path = "/Volumes/projects/MINDLAB2016_MEG-Language-PD-DBS/scratch/mje/hilbert_data/hilbert_epochs/"

In [9]:
epochs = mne.read_epochs(epochs_path + "0010_Alpha_ds_ica-epo.fif", preload=False)
times = epochs.times * 1e3


Reading /Volumes/projects/MINDLAB2016_MEG-Language-PD-DBS/scratch/mje/hilbert_data/hilbert_epochs/0010_Alpha_ds_ica-epo.fif ...
    Read a total of 1 projection items:
        Average EEG reference (1 x 71) active
    Found the data of interest:
        t =     -99.61 ...     900.39 ms
        0 CTF compensation matrices available
2400 matching events found
Not setting metadata
Created an SSP operator (subspace dimension = 1)
2400 matching events found
Not setting metadata
Created an SSP operator (subspace dimension = 1)
1 projection items activated

In [10]:
%pylab inline
pylab.rcParams['figure.figsize'] = (15, 10)


Populating the interactive namespace from numpy and matplotlib

In [11]:
band = "Alpha"

files_meg = glob(snr_path + "*_%s_snr_meg.npy" % band)
files_meg.sort()
files_full = glob(snr_path + "*_%s_snr_full.npy" % band)
files_full.sort()

files_est_meg = glob(snr_path + "*_%s_snr_est_meg.npy" % band)
files_est_meg.sort()
files_est_full = glob(snr_path + "*_%s_snr_est_full.npy" % band)
files_est_full.sort()

snr_meg = np.asarray([np.load(f) for f in files_meg])
snr_full = np.asarray([np.load(f) for f in files_full])
snr_est_meg = np.asarray([np.load(f) for f in files_est_meg])
snr_est_full = np.asarray([np.load(f) for f in files_est_full])


plt.figure()
plt.subplot(2,1, 1)
plt.plot(times, snr_full.mean(axis=0), 'b', label="MEG + EEG", linewidth=3)
plt.plot(times, snr_meg.mean(axis=0), 'r', label="MEG only", linewidth=3)
plt.legend()
plt.subplot(2,1,2)
plt.plot(times, snr_est_full.mean(axis=0), 'b', label="EST: MEG + EEG", linewidth=3)
plt.plot(times, snr_est_meg.mean(axis=0), 'r', label="EST: MEG only", linewidth=3)
plt.legend()


Out[11]:
<matplotlib.legend.Legend at 0x10de62290>

In [12]:
band = "Beta"

files_meg = glob(snr_path + "*_%s_snr_meg.npy" % band)
files_meg.sort()
files_full = glob(snr_path + "*_%s_snr_full.npy" % band)
files_full.sort()

files_est_meg = glob(snr_path + "*_%s_snr_est_meg.npy" % band)
files_est_meg.sort()
files_est_full = glob(snr_path + "*_%s_snr_est_full.npy" % band)
files_est_full.sort()

snr_meg = np.asarray([np.load(f) for f in files_meg])
snr_full = np.asarray([np.load(f) for f in files_full])
snr_est_meg = np.asarray([np.load(f) for f in files_est_meg])
snr_est_full = np.asarray([np.load(f) for f in files_est_full])


plt.figure()
plt.subplot(2,1, 1)
plt.plot(times, snr_full.mean(axis=0), 'b', label="MEG + EEG", linewidth=3)
plt.plot(times, snr_meg.mean(axis=0), 'r', label="MEG only", linewidth=3)
plt.legend()
plt.subplot(2,1,2)
plt.plot(times, snr_est_full.mean(axis=0), 'b', label="EST: MEG + EEG", linewidth=3)
plt.plot(times, snr_est_meg.mean(axis=0), 'r', label="EST: MEG only", linewidth=3)
plt.legend()


Out[12]:
<matplotlib.legend.Legend at 0x1093c3f90>

In [13]:
band = "Gamma_low"

files_meg = glob(snr_path + "*_%s_snr_meg.npy" % band)
files_meg.sort()
files_full = glob(snr_path + "*_%s_snr_full.npy" % band)
files_full.sort()

files_est_meg = glob(snr_path + "*_%s_snr_est_meg.npy" % band)
files_est_meg.sort()
files_est_full = glob(snr_path + "*_%s_snr_est_full.npy" % band)
files_est_full.sort()

snr_meg = np.asarray([np.load(f) for f in files_meg])
snr_full = np.asarray([np.load(f) for f in files_full])
snr_est_meg = np.asarray([np.load(f) for f in files_est_meg])
snr_est_full = np.asarray([np.load(f) for f in files_est_full])


plt.figure()
plt.subplot(2,1, 1)
plt.plot(times, snr_full.mean(axis=0), 'b', label="MEG + EEG", linewidth=3)
plt.plot(times, snr_meg.mean(axis=0), 'r', label="MEG only", linewidth=3)
plt.legend()
plt.subplot(2,1,2)
plt.plot(times, snr_est_full.mean(axis=0), 'b', label="EST: MEG + EEG", linewidth=3)
plt.plot(times, snr_est_meg.mean(axis=0), 'r', label="EST: MEG only", linewidth=3)
plt.legend()


Out[13]:
<matplotlib.legend.Legend at 0x10dd65c90>

In [14]:
band = "Gamma_high_1"

files_meg = glob(snr_path + "*_%s_snr_meg.npy" % band)
files_meg.sort()
files_full = glob(snr_path + "*_%s_snr_full.npy" % band)
files_full.sort()

files_est_meg = glob(snr_path + "*_%s_snr_est_meg.npy" % band)
files_est_meg.sort()
files_est_full = glob(snr_path + "*_%s_snr_est_full.npy" % band)
files_est_full.sort()

snr_meg = np.asarray([np.load(f) for f in files_meg])
snr_full = np.asarray([np.load(f) for f in files_full])
snr_est_meg = np.asarray([np.load(f) for f in files_est_meg])
snr_est_full = np.asarray([np.load(f) for f in files_est_full])


plt.figure()
plt.subplot(2,1, 1)
plt.plot(times, snr_full.mean(axis=0), 'b', label="MEG + EEG", linewidth=3)
plt.plot(times, snr_meg.mean(axis=0), 'r', label="MEG only", linewidth=3)
plt.legend()
plt.subplot(2,1,2)
plt.plot(times, snr_est_full.mean(axis=0), 'b', label="EST: MEG + EEG", linewidth=3)
plt.plot(times, snr_est_meg.mean(axis=0), 'r', label="EST: MEG only", linewidth=3)
plt.legend()


Out[14]:
<matplotlib.legend.Legend at 0x10e654050>

In [15]:
band = "Gamma_high_2"

files_meg = glob(snr_path + "*_%s_snr_meg.npy" % band)
files_meg.sort()
files_full = glob(snr_path + "*_%s_snr_full.npy" % band)
files_full.sort()

files_est_meg = glob(snr_path + "*_%s_snr_est_meg.npy" % band)
files_est_meg.sort()
files_est_full = glob(snr_path + "*_%s_snr_est_full.npy" % band)
files_est_full.sort()

snr_meg = np.asarray([np.load(f) for f in files_meg])
snr_full = np.asarray([np.load(f) for f in files_full])
snr_est_meg = np.asarray([np.load(f) for f in files_est_meg])
snr_est_full = np.asarray([np.load(f) for f in files_est_full])


plt.figure()
plt.subplot(2,1, 1)
plt.plot(times, snr_full.mean(axis=0), 'b', label="MEG + EEG", linewidth=3)
plt.plot(times, snr_meg.mean(axis=0), 'r', label="MEG only", linewidth=3)
plt.legend()
plt.subplot(2,1,2)
plt.plot(times, snr_est_full.mean(axis=0), 'b', label="EST: MEG + EEG", linewidth=3)
plt.plot(times, snr_est_meg.mean(axis=0), 'r', label="EST: MEG only", linewidth=3)
plt.legend()


Out[15]:
<matplotlib.legend.Legend at 0x10ecc11d0>

In [ ]: