-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_MNstim.py
More file actions
92 lines (56 loc) · 1.61 KB
/
Copy pathplot_MNstim.py
File metadata and controls
92 lines (56 loc) · 1.61 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import matplotlib.pyplot as plt
import numpy as np
from kuramoto import rho, MNflash, rhoMN, rhoPerm
"""Visualize various stimuation paradigms (cf. Fig 2)
"""
#%% Parameters
mean_w = np.pi
T_w = 2*np.pi/mean_w
T = T_w
m = 2.25
n = 1.5
Tmn = (m+n)*T
Tm = m*T
N_c = 4
tstep=0.001
t0 = 0.
tf = (m+n)*T*2
t = np.arange(t0, tf+tstep, tstep)
#%% Create axes
nplots = 5
fig, ax = plt.subplots(nrows=nplots, sharex='col')
for a in range(len(ax)):
ax[a].set_yticks([])
for k in range(int(np.ceil(tf/T))):
ax[a].axvline(k*T, linestyle=':', color='k', linewidth=1)
#%% Generate plots
a = -1
a+=1
r = rho(t, N_c, T)
fl = MNflash(t, Tmn, Tm)
for i in range(N_c):
ax[a].fill_between(t, fl*r[:,i]+i, np.zeros(t.shape)+i)
ax[a].set_ylabel('Periodic flashing')
a+=1
rhPerm = np.full((t.size, N_c), np.nan)
fl = MNflash(t, Tmn, Tm)
for ti in range(len(t)):
rhPerm[ti,:] = rhoPerm(t[ti], N_c, T, T)
for i in range(N_c):
ax[a].fill_between(t, fl*rhPerm[:,i]+i, np.zeros(t.shape)+i)
ax[a].set_ylabel('Periodic flashing\nrandomized')
a+=1
rMN = rhoMN(t,N_c,m,n,T,Tmn,Tm)
for i in range(N_c):
ax[a].fill_between(t, rMN[:,i]+i, np.zeros(t.shape)+i)
ax[a].set_ylabel('Lysyansky')
a+=1
rh = rho(t, N_c, T)
for i in range(N_c):
ax[a].fill_between(t, rh[:,i]+i, np.zeros(t.shape)+i)
ax[a].set_ylabel('Chronic CR')
a+=1
ax[a].plot(t, np.mod(mean_w*t, 2*np.pi))
ax[a].plot(t, np.zeros(t.shape), linestyle='-', color='k', linewidth=0.5)
ax[a].set_ylabel('$\Omega t$ (mod 2$\pi$)')
ax[a].set_xlabel('Time')