/
init-ConeHz.hoc
150 lines (134 loc) · 4.11 KB
/
init-ConeHz.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
// Starts a NEURON session for testing a network containing cone photoreceptors
// and horizontal cells.
// create cells
load_file("network.hoc")
load_file("util.hoc")
createCones()
createHzCells()
createConeHzSynapses()
// createSimHzPrInputs()
/////////////////////////////////////////////////////////////////////
// intracellular stimulus
objref stimCone[25]
objref stimHzCell[25]
proc intraStim() { local i, r, c
i = 0
for r = 0,4 {
for c = 0,4 {
gCones[CTR-2+r][CTR-2+c].soma stimCone[i] = new IClamp(0.5)
stimCone[i].del = 1200
stimCone[i].dur = 0.5
if (r == 0 || r == 4 || c == 0 || c == 4) {
stimCone[i].amp = 0.2
} else {
stimCone[i].amp = 0.4
}
i = i + 1
}
}
i = 0
for r = 0,4 {
for c = 0,4 {
gHzCells[CTR-2+r][CTR-2+c].soma stimHzCell[i] = new IClamp(0.5)
stimHzCell[i].del = 1200
stimHzCell[i].dur = 0.5
if (r == 0 || r == 4 || c == 0 || c == 4) {
stimHzCell[i].amp = 0.2
} else {
stimHzCell[i].amp = 0.4
}
i = i + 1
}
}
printf("INFO: Using intracellular stimulation\n")
}
// extracellular stimulus
gExtraStimFlag = 0
proc extraStim() {
forall {
insert extracellular
insert xtra
}
load_file("interpxyz.hoc")
load_file("stim.hoc")
gExtraStimFlag = 1 // note extracellular stim
printf("INFO: Using extracellular stimulation\n")
}
/////////////////////////////////////////////////////////////////////
// graphs
objref g1, g2
g1 = new Graph(0)
addplot(g1, 0) // GUI to update this graph
g1.view(0, -60, 1600, 20, 255, 77, 450, 300) //xmin ymin xlen ylen ...
g1.addvar("gCones[CTR-2][CTR-2].soma.v(0.5)", 2, 1)
g1.addvar("gCones[CTR-1][CTR-1].soma.v(0.5)", 3, 1)
g1.addvar("gCones[CTR][CTR].soma.v(0.5)", 4, 1)
g1.addvar("gCones[CTR+1][CTR+1].soma.v(0.5)", 5, 1)
g1.addvar("gCones[10][10].soma.v(0.5)", 6, 1)
g2 = new Graph(0)
addplot(g2, 0) // GUI to update this graph
g2.view(0, -60, 1600, 20, 255, 405, 450, 300) //xmin ymin xlen ylen ...
g2.addvar("gHzCells[CTR-2][CTR-2].soma.v(0.5)", 2, 1)
g2.addvar("gHzCells[CTR-1][CTR-1].soma.v(0.5)", 3, 1)
g2.addvar("gHzCells[CTR][CTR].soma.v(0.5)", 4, 1)
g2.addvar("gHzCells[CTR+1][CTR+1].soma.v(0.5)", 5, 1)
g2.addvar("gHzCells[10][10].soma.v(0.5)", 6, 1)
/////////////////////////////////////////////////////////////////////
// execution
v_init = -45.0
tstop = 1600
celsius = 35
access gHzCells[CTR][CTR].soma
load_file("runCtrl.ses")
extraStim()
// parallel processing doesn't work for extracellular & linear mech
{ load_file("parcom.hoc") }
if (gExtraStimFlag == 0) {
ParallelComputeTool[0].nthread(4)
}
// recording
objref dv_cone[CONES][CONES], dv_hz[HZ_CELLS][HZ_CELLS]
objref fsave
strdef fname
proc rec() { local r, c
for r = 0,CONES-1 {
for c = 0,CONES-1 {
dv_cone[r][c] = new Vector()
dv_cone[r][c].record(&gCones[r][c].soma.v(0.5))
}
}
for r = 0,HZ_CELLS-1 {
for c = 0,HZ_CELLS-1 {
dv_hz[r][c] = new Vector()
dv_hz[r][c].record(&gHzCells[r][c].soma.v(0.5))
}
}
}
proc save() { local r, c
for r = 0,CONES-1 {
for c = 0,CONES-1 {
sprint(fname, "../netConeHz-results/conehz_cone_%dM_%.2d_%.2d.txt", \
HZ_GAP_R, r, c)
fsave = new File()
fsave.wopen(fname)
dv_cone[r][c].printf(fsave, "%f\n")
fsave.close()
}
}
for r = 0,HZ_CELLS-1 {
for c = 0,HZ_CELLS-1 {
sprint(fname, "../netConeHz-results/conehz_hz_%dM_%.2d_%.2d.txt", \
HZ_GAP_R, r, c)
fsave = new File()
fsave.wopen(fname)
dv_hz[r][c].printf(fsave, "%f\n")
fsave.close()
}
}
printf("INFO: results saved to ../netConeHz-results\n")
}
uRecord(&gHzCells[CTR][CTR].soma.v(0.5))
proc saveCenter() {
uSave("../netConeHz-results/tmp.txt")
printf("INFO: gHzCells[CTR][CTR].soma.v(0.5) -> ../netConeHz-results/tmp.txt\n")
}