In [1]:
from my_settings import *

In [2]:
import mne
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import os
    
%matplotlib qt
# change \"qt\" to \"inline\" for the figures to be place in the notebook"

In [3]:
from tf_analyses_functions import calc_spatial_resolution, calc_wavelet_duration

Calculate wavelet durations


In [10]:
freqs = np.arange(6,90, 2)
n_cycles_2 = freqs/2.
n_cycles_3 = freqs/3.
n_cycles_33 = freqs/3.3
n_cycles_4 = freqs/4.

In [11]:
wd_2 = calc_wavelet_duration(freqs=freqs, n_cycles=n_cycles_2)
wd_3 = calc_wavelet_duration(freqs=freqs, n_cycles=n_cycles_3)
wd_33 = calc_wavelet_duration(freqs=freqs, n_cycles=n_cycles_33)
wd_4 = calc_wavelet_duration(freqs=freqs, n_cycles=n_cycles_4)

In [12]:
plt.figure()
plt.plot(freqs, wd_2, label="cycles = freqs / 2")
plt.plot(freqs, wd_3, label="cycles = freqs / 3")
plt.plot(freqs, wd_33, label="cycles = freqs / 3.3")
plt.plot(freqs, wd_4, label="cycles = freqs / 4")
plt.legend()
plt.title("Wavelet duration")
plt.show()

Calculate spatial resolution


In [7]:
sr_2 = calc_spatial_resolution(freqs=freqs, n_cycles=n_cycles_2)
sr_3 = calc_spatial_resolution(freqs=freqs, n_cycles=n_cycles_3)
sr_33 = calc_spatial_resolution(freqs=freqs, n_cycles=n_cycles_33)
sr_4 = calc_spatial_resolution(freqs=freqs, n_cycles=n_cycles_4)

In [8]:
sr_33


Out[8]:
array([6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
       6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6])

In [9]:
plt.figure()
plt.plot(freqs, sr_2, label="cycles = freqs / 2")
plt.plot(freqs, sr_3, label="cycles = freqs / 3")
plt.plot(freqs, sr_33, label="cycles = freqs / 3.3")
plt.plot(freqs, sr_4, label="cycles = freqs / 4")
plt.legend()
plt.title("Spatial resolution")
plt.show()

In [ ]:


In [4]:
cd data/tf_data/


/home/mje/Projects/malthe_alpha_project/data/tf_data

In [ ]:


In [5]:
itc_ctl_left = []

for subject in subjects[-3:]:
    data = np.load("itc_%s_8-12_Brodmann.17-lh_ctl_left_dSPM.npy" % subject)
    itc_ctl_left.append(data.mean(axis=0).mean(axis=0))

In [6]:
itc_ctl_left = np.asarray(itc_ctl_left)

In [7]:
itc_ctl_left.shape


Out[7]:
(3, 1251)

In [8]:
np.save("Foo.npy", itc_ctl_left)

In [ ]:


In [ ]:


In [ ]:


In [ ]: