-
Notifications
You must be signed in to change notification settings - Fork 0
/
single_test.hoc
229 lines (199 loc) · 5.32 KB
/
single_test.hoc
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/*==========================================
TEST SUIT FOR NEURON MODULE of
Calcium-based plasticity model,
Graupner and Brunel PNAS 2012
RTH Midnight Project by
Ruben A. Tikidji-Hamburyan <[email protected]>
May 2015
============================================*/
// tpre-tpost is varied from -TPOST to +TPOST
TPOST = 101 // time of postsynaptic spike
NREPETITIONS = 60 //Number of repetitions
ITERREPETINTERVAL = 1000 //interval between stimulus
SPIKEAPMLITUDE = 30
STDPSTEPSIZE = 10
load_file("nrngui.hoc")
///// model cell /////
create soma
access soma
L = 10
diam = 100/L/PI
insert pas
// postsynaptic depol: to 30 mv x 0.1 ms at TPOST
objref sec
sec = new SEClamp(0.5)
sec.rs = 1e-3
sec.dur1 = 1e9
sec.amp1 = -65
sec.dur2 = 0.1
sec.amp2 = 30 // mV peak depol
sec.dur3 = 1e9
sec.amp3 = -65
objref syn, netcon1, netcon2, netstim1, netstim2
//Synapse
syn = new exp2synGBstdp(0.5)
//Presynaptic input for STDP
netstim1 = new NetStim(0.5)
netstim1.interval = 10
netstim1.number = 1
netstim1.start = 10
netstim1.noise = 0
//Connections
netcon1 = new NetCon(netstim1,syn)
netcon1.weight[0] = 1e-3 // synaptic conductance
netcon1.weight[1] = 0.5 // rho - synaptic efficacy
netcon1.weight[2] = 0.0 // calcium concentration
netcon1.delay = 0
/*
// If variable step is active very strange lines appear on graphs.....
// but rule works perfect!
objref cvode
cvode = new CVode()
cvode.active(1)
*/
strdef workind
objref tpostvec,vpostvec
tpostvec = new Vector(NREPETITIONS*2+1)
vpostvec = new Vector(NREPETITIONS*2+1)
func runtest(){ local Delta, tmax
Delta = $1
sprint(workind,"WORKING on DT=%g",Delta)
tmax = 0
for k=0,NREPETITIONS-1 {
tpostvec.x[k*2] = TPOST + k*ITERREPETINTERVAL
tpostvec.x[k*2+1] = TPOST + k*ITERREPETINTERVAL+0.25
tmax = TPOST + k*ITERREPETINTERVAL+0.25
vpostvec.x[k*2] = SPIKEAPMLITUDE
vpostvec.x[k*2+1] = -65
}
tstop = tmax + TPOST + abs(Delta)*3
//tstop = 2*tmax
tpostvec.x[NREPETITIONS*2] = tstop
vpostvec.x[NREPETITIONS*2] = -65
vpostvec.play(&sec.amp1,tpostvec)
netstim1.interval = ITERREPETINTERVAL
netstim1.start = TPOST - Delta
netstim1.number = NREPETITIONS
//reinit connection
netcon1.weight[0] = 1e-3
netcon1.weight[1] = 0.5
netcon1.weight[2] = 0.0
//to make a simulation faster
dt=0.25
steps_per_ms = 4
stdinit()
run()
//DB>>
print "DELAT T=",Delta," STDP=",netcon1.weight[1]*2.
//<<DB
return netcon1.weight[1]*2.
}
//Uncomment next line if you want to see traces
//load_file("init.ses")
//to draw STDP curve
objref st, g
st = new Vector()
g = new Graph()
g.size(-100,100,0.4,1.6)
proc testrule(){
st.indgen(-100,100,STDPSTEPSIZE)
g.beginline()
for m=0, st.size()-1 {
dd = runtest(st.x[m])
g.line(st.x[m],dd)
g.flush()
}
}
proc testDP(){
syn.tau1 = 0.8
syn.tau2 = 2
syn.e = 0
syn.gammad = 200
syn.gammap = 321.808
syn.thetad = 1
syn.thetap = 1.3
syn.taurho = 150e3
syn.rho12 = 0.5
syn.tauca = 20
syn.cpre = 1
syn.cpost = 2
syn.cdelay = 13.7
syn.bistable = 1
syn.plastic = 1
syn.learningdependence = 0
syn.STDPstep = 0.25
STDPSTEPSIZE = 10
testrule()
}
proc testDPD(){
syn.tau1 = 0.8
syn.tau2 = 2
syn.e = 0
syn.gammad = 250
syn.gammap = 550
syn.thetad = 1
syn.thetap = 1.3
syn.taurho = 150e3
syn.rho12 = 0.5
syn.tauca = 20
syn.cpre = 0.9
syn.cpost = 0.9
syn.cdelay = 4.6
syn.bistable = 1
syn.plastic = 1
syn.learningdependence = 0
syn.STDPstep = 0.25
STDPSTEPSIZE = 2
testrule()
}
proc testDPd(){
syn.tau1 = 0.8
syn.tau2 = 2
syn.e = 0
syn.gammad = 50
syn.gammap = 600
syn.thetad = 1
syn.thetap = 2.5
syn.taurho = 150e3
syn.rho12 = 0.5
syn.tauca = 20
syn.cpre = 1
syn.cpost = 2
syn.cdelay = 2.2
syn.bistable = 1
syn.plastic = 1
syn.learningdependence = 0
syn.STDPstep = 0.25
STDPSTEPSIZE = 2
testrule()
}
//==== Some extra functionality just for fun ====//
//syn.learningdependence = 1
//syn.cpre = 2
xpanel("Cell Parameters", 0)
xvarlabel(workind)
xlabel("=============================")
xvalue("Synaptic tau rise","syn.tau1", 0.1,"", 0, 0 )
xvalue("Synaptic tau fall","syn.tau2", 0.1,"", 0, 0 )
xvalue("Synaptic Rev. Pot.","syn.e", 0.1,"", 0, 0 )
xvalue("Gamma Depression","syn.gammad", 0.1,"", 0, 0 )
xvalue("Gamma Potentiation","syn.gammap", 0.1,"", 0, 0 )
xvalue("Threshold Depression","syn.thetad", 0.1,"", 0, 0 )
xvalue("Threshold Potentiation","syn.thetap", 0.1,"", 0, 0 )
xvalue("Plasticity Time const.","syn.taurho", 0.1,"", 0, 0 )
xvalue("Plasticity unstable point","syn.rho12", 0.1,"", 0, 0 )
xvalue("Calcium Time const.","syn.tauca", 0.1,"", 0, 0 )
xvalue("Calcium presyn influx","syn.cpre", 0.1,"", 0, 0 )
xvalue("Calcium postsyn influx","syn.cpost", 0.1,"", 0, 0 )
xvalue("Delay of presyn influx","syn.cdelay", 0.1,"", 0, 0 )
xvalue("BISTABILITY 1/0 ON/OFF","syn.bistable", 0.1,"", 0, 0 )
xvalue("PLASTICITY 1/0 ON/OFF","syn.plastic", 0.1,"", 0, 0 )
xvalue("LEARN DEP. 1/0 ON/OFF","syn.learningdependence", 0.1,"", 0, 0 )
xvalue("STDP solv. time step","syn.STDPstep", 0.1,"", 0, 0 )
xvalue("STDP test time step","STDPSTEPSIZE", 0.1,"", 0, 0 )
xbutton("Run Test","testrule()")
xlabel("=============================")
xbutton("DP","testDP()")
xbutton("DPD","testDPD()")
xbutton("DPD\'","testDPd()")
xpanel(0)