-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.hoc
233 lines (167 loc) · 6.53 KB
/
setup.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
// Salto
// (c) Charles CH Cohen, 2014-present
// this software is released to the public under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
// International license (CC BY-NC-ND 4.0, in English).
// for any questions, please email c.cohen@gmx.com
print "Salto – Setup"
print "Simulation setup details"
print "Run once per cell"
// ------------------------------Directories---------------------------------------
strdef root, lib, ses
root = getcwd()
sprint(lib, "%s%s", root, "lib/")
sprint(ses, "%s%s", root, "ses/")
// --------------------------------------------------------------------------------
// -------------------------------Libraries----------------------------------------
load_file("stdgui.hoc")
chdir(lib)
load_file("startlib.hoc")
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// cell type
setcelltype()
// Is there recording data?
strdef idataqstr
sprint(idataqstr, "%s", "Is there current-clamp recording data?\t[y/n]")
idata = sred(idataqstr, "y", "ny")
writebit(ses, "idata.dat", idata)
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
if (idata) {
print "\n-------------------Import Recorded Data-----------------------"
// Recording temperature
strdef tempqstr
sprint(tempqstr, "%s", "Please enter recording temperature (degrees celsius):\t")
temprec = xred(tempqstr, 35.3, 0, 100)
writenum(ses, "temprec.dat", temprec)
// Bessel filter setting
strdef bessqstr
bessqstr = "Please enter Bessel filter (\"Vm filter\") setting on the recording amplifier (kHz):\t"
bess = xred(bessqstr, 10, 1, 30)
writenum(ses, "bessfil.dat", bess)
// Recording location data
importreclocdata()
// Passive or active data?
strdef modeqstr
modeqstr = "\nDo you wish to set up passive conditions only, active conditions only, or both? Currently requires recording data for each condition.\nPassive = 0\nActive = 1\nBoth = 2\t"
ans = xred(modeqstr, 2, 0, 2)
if (ans == 2) {
print "\nPlease import passive data:\n"
mode_ = 0
writebit(ses, "mode.dat", mode_)
setfilestr(mode_, idata)
// delay before current injection (ms)
strdef idelqstr
idelqstr = "Please enter delay to injection start (ms):\t"
idel = xred(idelqstr, 9.375, 0, 1000)
writenum(ses, idelfilestr, idel)
// duration of current injection (ms)
strdef idurqstr
idurqstr = "Please enter duration of current injections (ms):\t"
idur = xred(idurqstr, 1.875, 0, 1000)
writenum(ses, idurfilestr, idur)
// import injection and recorded voltage data
importdata()
writenum(ses, "iamp-pas.dat", iampvec.x[0])
print "\nPlease import active data:\n"
mode_ = 1
writebit(ses, "mode.dat", mode_)
setfilestr(mode_, idata)
// delay before current injection (ms)
strdef idelqstr
idelqstr = "Please enter delay to injection start (ms):\t"
idel = xred(idelqstr, 5, 0, 1000)
writenum(ses, idelfilestr, idel)
// duration of current injection (ms)
strdef idurqstr
idurqstr = "Please enter duration of current injections (ms):\t"
idur = xred(idurqstr, 3, 0, 1000)
writenum(ses, idurfilestr, idur)
// import injection amplitudes and recorded voltage
importdata()
writenum(ses, "iamp-act.dat", iampvec.x[0])
writebit(ses, "mode.dat", 0)
}
if (ans == 0) {
print "\nPlease import passive data:\n"
mode_ = 0
writebit(ses, "mode.dat", mode_)
setfilestr(mode_, idata)
// delay before current injection (ms)
strdef idelqstr
idelqstr = "Please enter delay to injection start (ms):\t"
idel = xred(idelqstr, 9.375, 0, 1000)
writenum(ses, idelfilestr, idel)
// duration of current injection (ms)
strdef idurqstr
idurqstr = "Please enter duration of current injections (ms):\t"
idur = xred(idurqstr, 1.875, 0, 1000)
writenum(ses, idurfilestr, idur)
// import injection amplitudes and recorded voltage
importdata()
writenum(ses, "iamp-pas.dat", iampvec.x[0])
}
if (ans == 1) {
print "\nPlease import active data:\n"
mode_ = 1
writebit(ses, "mode.dat", 1)
setfilestr(mode_, idata)
// delay before current injection (ms)
strdef idelqstr
idelqstr = "Please enter delay to injection start (ms):\t"
idel = xred(idelqstr, 5, 0, 1000)
writenum(ses, idelfilestr, idel)
// duration of current injection (ms)
strdef idurqstr
idurqstr = "Please enter duration of current injections (ms):\t"
idur = xred(idurqstr, 3, 0, 1000)
writenum(ses, idurfilestr, idur)
// import injection amplitudes and recorded voltage
importdata()
writenum(ses, "iamp-act.dat", iampvec.x[0])
}
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Morphological detail
// get AIS sections
importaisloc()
// Define axon type
strdef axonqstr
axonqstr = "\nPlease select an axon type:\n1 = no myelin\n2 = single cable\n3 = double cable without paranodes\n4 = double cable with paranodes\t"
axontype = xred(axonqstr, 4, 1, 4)
writebit(ses, "axontype.dat", axontype)
if (axontype > 1) {
strdef grqstr
grqstr = "\nPlease enter expected g ratio:\t"
gr = xred(grqstr, 0.7, 0.001, 0.999)
writenum(ses, "gr.dat", gr)
strdef mintqstr
mintqstr = "\nPlease enter minimum internode length:\t"
mint = xred(mintqstr, 15, 10, 500)
writenum(ses, "mint.dat", mint)
strdef blebqstr
blebqstr = "\nPlease indicate whether the final section of the principal axon is myelinated:\t[y/n]"
bleb = sred(blebqstr, "n", "ny")
writebit(ses, "axbleb_exists.dat", !bleb)
if (!bleb) {
importblebdata()
}
}
// simulation time
set_maxtime()
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
print "\n-----------------------------------------------------------"
print "Model setup complete..."
print "\nYou may now open the model via openmodel.hoc (after compilation)."
print "-----------------------------------------------------------\n"
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
strdef compilemodqstr
sprint(compilemodqstr, "%s", "Do you wish to compile the required mod files now?\t[y/n]")
ans = sred(compilemodqstr, "y", "ny")
if (ans) {
loadfile(root, "compilemod.hoc")
}
// --------------------------------------------------------------------------------