-
Notifications
You must be signed in to change notification settings - Fork 1
/
protocolsA.hoc
173 lines (155 loc) · 3.23 KB
/
protocolsA.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
/*
Find excitation threshold to 4 significant figures.
Case A (bipolar electrode)
Threshold in mA
Parameters
waveform
waveform type
monophasic pulse
biphasic square wave
sine
number of cycles
phase (half cycle) duration TP (ms)
electrode coordinates
anode coords XA, YA (cm)
cathode coords XC, YC
Case B (uniform gradient field)
Threshold in V/m
Parameters
waveform
waveform type
monophasic pulse
biphasic square wave
TP (ms)
axon diameter D (um)
*/
TRUE = 1
FALSE = 0
// stimulus waveform
waveform = 0
PULSE = 1 // single pulse
SQUARE = 2 // biphasic square wave
SINE = 3 // sine with NC cycles
TP = 0 // phase duration (ms)
NC = 0 // number of cycles, a nonnegative integer
// note: xc is reserved in NEURON
// therefore all protocol params use upper case
XA = 0 // electrode coordinates (cm) relative to middle of axon
YA = 0
XC = 0
YC = 0
strdef wstr
func protocol() {
waveform = TP = NC = XA = YA = XC = YC = 0
if ($1==1) {
waveform = PULSE
wstr = "pls"
TP = 5e-3
NC = 1
XA = 50 YA = 0.25 XC = 0 YC = 0.25
}
if ($1==2) {
waveform = PULSE
wstr = "pls"
TP = 2.0
NC = 1
XA = 50 YA = 0.25 XC = 0 YC = 0.25
}
if ($1==3) {
waveform = PULSE
wstr = "pls"
TP = 5e-3
NC = 1
XA = 50 YA = 0.25 XC = 0 YC = 1
}
if ($1==4) {
waveform = PULSE
wstr = "pls"
TP = 2.0
NC = 1
XA = 50 YA = 0.25 XC = 0 YC = 1
}
if ($1==5) {
waveform = PULSE
wstr = "pls"
TP = 2.0
NC = 1
XA = 0 YA = 0.25 XC = 50 YC = 0.25
}
if ($1==6) {
waveform = PULSE
wstr = "pls"
TP = 2.0
NC = 1
XA = 0 YA = 1 XC = 1 YC = 1
}
if ($1==7) {
waveform = SQUARE
wstr = "sqr"
TP = 5e-3
NC = 1
XA = 50 YA = 0.25 XC = 0 YC = 0.25
}
if ($1==8) {
waveform = SQUARE
wstr = "sqr"
TP = 2.0
NC = 1
XA = 50 YA = 0.25 XC = 0 YC = 0.25
}
if ($1==9) {
waveform = SINE
wstr = "sin"
TP = 5e-3
NC = 1
XA = 50 YA = 0.25 XC = 0 YC = 0.25
}
if ($1==10) {
waveform = SINE
wstr = "sin"
TP = 0.1
NC = 1
XA = 50 YA = 0.25 XC = 0 YC = 0.25
}
if ($1==11) {
waveform = SINE
wstr = "sin"
TP = 5e-3
NC = 2e4
XA = 50 YA = 0.25 XC = 0 YC = 0.25
}
if ($1==12) {
waveform = SINE
wstr = "sin"
TP = 0.1
NC = 10
XA = 50 YA = 0.25 XC = 0 YC = 0.25
}
/*
pstr = "" // start anew
if (waveform>0) {
sprint(pstr, "%s tp %5.3f ", wstr, TP) // common to all
wstr = pstr
if (waveform==SINE) sprint(pstr, "%snc %7.1f \t", wstr, NC) // peculiar to sine
wstr = pstr
sprint(pstr, "%sxa,ya %5.2f,%5.2f xc,yc %5.2f,%5.2f thresh ", wstr, XA, YA, XC, YC) // common to all
}
print pstr, $1
*/
return waveform>0
}
strdef pstr
proc testprotocols() { local ii
for ii=0,15 {
pstr = "" // start anew
protocol(ii)
if (waveform>0) {
sprint(pstr, "%s tp %5.3f ", wstr, TP) // common to all
wstr = pstr
if (waveform==SINE) sprint(pstr, "%snc %7.1f \t", wstr, NC) // peculiar to sine
wstr = pstr
sprint(pstr, "%sxa,ya %5.2f,%5.2f xc,yc %5.2f,%5.2f thresh ", wstr, XA, YA, XC, YC) // common to all
}
print ii, pstr
}
}