forked from ModelDBRepository/127388
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pBGinput.hoc
277 lines (181 loc) · 5.84 KB
/
pBGinput.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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
//----------------------------------------------------------------------------
// Initialize global variables
//----------------------------------------------------------------------------
objref preCtxSTN[numSTN], preStrGPe[numGPe], preStrGPi[numGPi] //list of input timing objects for each cell
objref ncCtxSTN[numSTN], ncStrGPe[numGPe], ncStrGPi[numGPi] //vector of nclist indices for each cell
objref ncCtxSTN2[numSTN], ncStrGPe2[numGPe], ncStrGPi2[numGPi] //vector of nclist indices for each cell
objref nclistINP
for tmpi=0,numSTN-1 {
if (pnm.gid_exists(cellID(ID_STN, tmpi))) {
preCtxSTN[tmpi] = new List()
ncCtxSTN[tmpi] = new Vector()
ncCtxSTN2[tmpi] = new Vector()
}
}
for tmpi=0,numGPe-1 {
if (pnm.gid_exists(cellID(ID_GPe, tmpi))) {
preStrGPe[tmpi] = new List()
ncStrGPe[tmpi] = new Vector()
ncStrGPe2[tmpi] = new Vector()
}
}
for tmpi=0,numGPi-1 {
if (pnm.gid_exists(cellID(ID_GPi, tmpi))) {
preStrGPi[tmpi] = new List()
ncStrGPi[tmpi] = new Vector()
ncStrGPi2[tmpi] = new Vector()
}
}
nclistINP = new List()
//-----------------------------------------
objref betaClk
betaClk = new twoStateGen(.5)
betaClk.start = 0
betaClk.iMean = 1000/16 // 16Hz trigger
//betaClk drives burst mode in twoStateGen that is connected to CtxSTN, StrGPe and StrGPi synapses
//----------------------------------------------------------------------------
// Functions to set up input from current value of global variables
//----------------------------------------------------------------------------
objref preSyn, nc
proc INPconnectNet() { local i,j
//-----------------------------------------
// connections to STN
for i=0,numSTN-1 {
if (pnm.gid_exists(cellID(ID_STN, i))) {
for j=0,numCtxSTN-1 {
preSyn = new twoStateGen(.5)
preCtxSTN[i].append(preSyn)
nc = new NetCon(betaClk, preSyn)
nc.weight = 1
ncCtxSTN[i].append(nclistINP.count)
nclistINP.append(nc)
synIndx = synNum(ID_Ctx, ID_STN, j)
nc = new NetCon(preSyn, pnm.pc.gid2obj(cellID(ID_STN, i)).synlist.o(synIndx))
ncCtxSTN2[i].append(nclistINP.count)
nclistINP.append(nc)
}
}
}
//-----------------------------------------
// connections to GPe
for i=0,numGPe-1 {
if (pnm.gid_exists(cellID(ID_GPe, i))) {
for j=0,numStrGPe-1 {
preSyn = new twoStateGen(.5)
preStrGPe[i].append(preSyn)
nc = new NetCon(betaClk, preSyn)
nc.weight = 1
ncStrGPe[i].append(nclistINP.count)
nclistINP.append(nc)
synIndx = synNum(ID_Str, ID_GPe, j)
nc = new NetCon(preSyn, pnm.pc.gid2obj(cellID(ID_GPe, i)).synlist.o(synIndx))
ncStrGPe2[i].append(nclistINP.count)
nclistINP.append(nc)
}
}
}
//-----------------------------------------
// connections to GPi
for i=0,numGPi-1 {
if (pnm.gid_exists(cellID(ID_GPi, i))) {
for j=0,numStrGPi-1 {
preSyn = new twoStateGen(.5)
preStrGPi[i].append(preSyn)
nc = new NetCon(betaClk, preSyn)
nc.weight = 1
ncStrGPi[i].append(nclistINP.count)
nclistINP.append(nc)
synIndx = synNum(ID_Str, ID_GPi, j)
nc = new NetCon(preSyn, pnm.pc.gid2obj(cellID(ID_GPi, i)).synlist.o(synIndx))
ncStrGPi2[i].append(nclistINP.count)
nclistINP.append(nc)
}
}
}
}
//----------------------------------------------------------------------------
proc INPupdateWeights() { local i,j
//-----------------------------------------
// connections to STN
for i=0,numSTN-1 {
if (pnm.gid_exists(cellID(ID_STN, i))) {
for j=0,numCtxSTN-1 {
ncIndx = ncCtxSTN[i].x(j)
if (ncIndx >= 0) {
nclistINP.o(ncIndx).weight = 1
nclistINP.o(ncIndx).delay = 0
}
preCtxSTN[i].o(j).iMean = imnCtxSTN
preCtxSTN[i].o(j).iStd = isdCtxSTN
preCtxSTN[i].o(j).bMean = bmnCtxSTN
preCtxSTN[i].o(j).bStd = bsdCtxSTN
preCtxSTN[i].o(j).bDurMean = bdmnCtxSTN
preCtxSTN[i].o(j).bDurStd = bdsdCtxSTN
preCtxSTN[i].o(j).p = probCtxSTN.x(j)
ncIndx = ncCtxSTN2[i].x(j)
if (ncIndx >= 0) {
nclistINP.o(ncIndx).weight = gDA_CtxSTN*gmaxCtxSTN/numCtxSTN
nclistINP.o(ncIndx).delay = delCtxSTN
}
}
}
}
//-----------------------------------------
// connections to GPe
for i=0,numGPe-1 {
if (pnm.gid_exists(cellID(ID_GPe, i))) {
for j=0,numStrGPe-1 {
ncIndx = ncStrGPe[i].x(j)
if (ncIndx >= 0) {
nclistINP.o(ncIndx).weight = 1
nclistINP.o(ncIndx).delay = 0
}
preStrGPe[i].o(j).iMean = imnStrGPe
preStrGPe[i].o(j).iStd = isdStrGPe
preStrGPe[i].o(j).bMean = bmnStrGPe
preStrGPe[i].o(j).bStd = bsdStrGPe
preStrGPe[i].o(j).bDurMean = bdmnStrGPe
preStrGPe[i].o(j).bDurStd = bdsdStrGPe
preStrGPe[i].o(j).p = probStrGPe.x(j)
ncIndx = ncStrGPe2[i].x(j)
if (ncIndx >= 0) {
nclistINP.o(ncIndx).weight = gDA_StrGPe*gmaxStrGPe/numStrGPe
nclistINP.o(ncIndx).delay = delStrGPe
}
}
}
}
//-----------------------------------------
// connections to GPi
for i=0,numGPi-1 {
if (pnm.gid_exists(cellID(ID_GPi, i))) {
for j=0,numStrGPi-1 {
ncIndx = ncStrGPi[i].x(j)
if (ncIndx >= 0) {
nclistINP.o(ncIndx).weight = 1
nclistINP.o(ncIndx).delay = 0
}
preStrGPi[i].o(j).iMean = imnStrGPi
preStrGPi[i].o(j).iStd = isdStrGPi
preStrGPi[i].o(j).bMean = bmnStrGPi
preStrGPi[i].o(j).bStd = bsdStrGPi
preStrGPi[i].o(j).bDurMean = bdmnStrGPi
preStrGPi[i].o(j).bDurStd = bdsdStrGPi
preStrGPi[i].o(j).p = probStrGPi.x(j)
ncIndx = ncStrGPi2[i].x(j)
if (ncIndx >= 0) {
nclistINP.o(ncIndx).weight = gDA_StrGPi*gmaxStrGPi/numStrGPi
nclistINP.o(ncIndx).delay = delStrGPi
}
}
}
}
}
//----------------------------------------------------------------------------
// Call setup functions when .hoc file is loaded
//----------------------------------------------------------------------------
INPconnectNet()
INPupdateWeights()
//----------------------------------------------------------------------------
// Dialog to update parameter values
//----------------------------------------------------------------------------