-
Notifications
You must be signed in to change notification settings - Fork 3
/
function_ConnectInputs_invivo_op.hoc
96 lines (67 loc) · 3.03 KB
/
function_ConnectInputs_invivo_op.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
// Created by FF (2018)
// Procs here are used to introduce generated external spike trains to network
objref Inputvecplay_E[Inputnum_E][E_connectnum],Inputspikes_E[Inputnum_E]
objref Inputsyn_E[Inputnum_E][E_connectnum],Inputnc_E[Inputnum_E][E_connectnum]
objref rc_E2P
objref Inputvecplay_I[Inputnum_I][I_connectnum],Inputspikes_I[Inputnum_I]
objref Inputsyn_I[Inputnum_I][I_connectnum],Inputnc_I[Inputnum_I][I_connectnum]
objref rc_E2I
proc ConnectInputs_E() { local i,j,k,cellgid,inputid,synid,thr,wgt,del localobj target ///connect spike trains to PNs
{pc.barrier()}
for i = 0,Inputnum_E-1 {
ind_start=0+2*i
ind_stop=1+2*i
if (Etn_spikes_ind.x[ind_start]<=Etn_spikes_ind.x[ind_stop]) { ///only connect when there is spikes coming
Inputspikes_E[i]=Etn_spikes.at(Etn_spikes_ind.x[ind_start],Etn_spikes_ind.x[ind_stop]) ///to get all external spikes
for j = 0,E_connectnum-1 {
cellgid = E2P_matrix.x[i][j]
if (cellgid >= 0) {
if(!pc.gid_exists(cellgid)) { continue }
target = pc.gid2cell(cellgid)
target.dend Inputsyn_E[i][j] = new pyrD2pyrD_STFD(0.9)
{rc_E2P = new Random(i*E_connectnum+j+1)}
wgt = rc_E2P.lognormal(9,0.05)
del = rc_E2P.uniform(0.5,1)
Inputsyn_E[i][j].initW=wgt
Inputvecplay_E[i][j] = new VecStim()
Inputvecplay_E[i][j].play(Inputspikes_E[i])
Inputnc_E[i][j] = new NetCon(Inputvecplay_E[i][j],Inputsyn_E[i][j])
Inputnc_E[i][j].weight = 1
Inputnc_E[i][j].delay = del
Inputnc_E[i][j].threshold = -10//nc.threshold = thr
}
}
}
}
{pc.barrier()}
}
proc ConnectInputs_I() { local i,j,k,cellgid,inputid,synid,thr,wgt,del localobj target ///connect spike trains to FSIs
{pc.barrier()}
for i = 0,Inputnum_I-1 {
ind_start=0+2*i
ind_stop=1+2*i
if (Etn_spikes_ind.x[ind_start]<=Etn_spikes_ind.x[ind_stop]) { ///only connect when there is spikes coming
Inputspikes_I[i]=Etn_spikes.at(Etn_spikes_ind.x[ind_start],Etn_spikes_ind.x[ind_stop]) ///to get all external spikes
for j = 0,I_connectnum-1 {
//inputid = i
cellgid = E2I_matrix.x[i][j]
if (cellgid >= 0) {
if(!pc.gid_exists(cellgid)) { continue }
target = pc.gid2cell(cellgid)
target.dend Inputsyn_I[i][j] = new pyrD2interD_STFD(0.9)
{rc_E2I = new Random(i*I_connectnum+j+1)}
wgt = rc_E2I.lognormal(2,0.2)
del = rc_E2I.uniform(0.5,1)
Inputsyn_I[i][j].initW=wgt
Inputvecplay_I[i][j] = new VecStim()
Inputvecplay_I[i][j].play(Inputspikes_I[i])
Inputnc_I[i][j] = new NetCon(Inputvecplay_I[i][j],Inputsyn_I[i][j])
Inputnc_I[i][j].weight = 1
Inputnc_I[i][j].delay = del
Inputnc_I[i][j].threshold = -10//nc.threshold = thr
}
}
}
}
{pc.barrier()}
}