-
Notifications
You must be signed in to change notification settings - Fork 21
/
Proj1.py
61 lines (44 loc) · 1.52 KB
/
Proj1.py
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
# Project 1
from __future__ import division
from WC_net import *
#from PyDSTool.Toolbox.phaseplane import *
builder = rate_network()
S1 = thresh_Naka_Rushton_fndef(2, '120', 100)
S2 = thresh_Naka_Rushton_fndef(2, '120', 100)
builder.add_neuron('E_RE', tau=20, ic=1, thresh_fn=S2)
builder.add_neuron('E_RI', tau=20, ic=1, thresh_fn=S2)
builder.add_neuron('I', tau=20, ic=1, thresh_fn=S2)
builder.add_syn_input_to_neuron('E_RI', 'I', 3)
builder.add_syn_input_to_neuron('I', 'E_RE', -5)
## Add adaptation to response
#builder.add_rate('A1', tau=4000, ic=0)
#builder.add_rate('A2', tau=4000, ic=0)
#builder.add_interaction('E1', 'A1', 0.7)
#builder.add_interaction('E2', 'A2', 0.7)
builder.add_bias_input('E_RE', 0, 'sE')
builder.add_bias_input('E_RI', 0, 'sI')
net = builder.make_network()
net.set(tdata=[0,8000],
algparams={'init_step': 0.75})
# Uncomment if you want to get a single trajectory computed
##traj = net.compute('test')
##pts = traj.sample()
# Piecewise protocol
protocol = []
protocol.append({'pars': {'sE': 0},
'tdur': 30})
protocol.append({'pars': {'sE': 50},
'tdur': 100})
protocol.append({'pars': {'sE': 50,
'sI': 50},
'tdur': 200})
protocol.append({'pars': {'sE': 50,
'sI': 0},
'tdur': 200})
protocol.append({'pars': {'sE': 0},
'tdur': 500})
traj, pts = pcw_protocol(net, protocol)
plt.figure(0)
plt.plot(pts['t'], pts['E_RE'], 'g')
plt.plot(pts['t'], pts['E_RI'], 'r')
plt.show()