-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalyticFunctions.hoc
156 lines (142 loc) · 4.11 KB
/
analyticFunctions.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
/*
* Prints to stdout a table containing the voltage at all points in a
* dendritic tree, after 10 ms of simulation in response to a recorded somatic
* action potential.
*
* globals:
* voltage_vec
* time_vec
* which_secs
*
* Arguments:
* $o1: soma -> A SectionRef pointing to the soma.
* $o2: voltage_vec -> A vector containing an experimentally measured somatic
* action potential.
* $o3: time_vec -> A vector containing the time points for voltage_vec
* $s4: which_secs -> A regular expression that specifies all the dendritic
* sections over which the function should iterate.
*
*/
objref graphs
proc BAPvalues() { local real_diam, real_L, rt, rtstart, ts localobj voltage_vec, time_vec, distances, voltages,\
output_matrix, soma
soma = $o1
soma.sec {
nseg = 1
real_diam = diam(0.5)
real_L = L
diam = 2.0 * STD_SOMA
L = 2.0 * STD_SOMA
}
voltage_vec = $o2
time_vec = $o3
strdef which_secs
which_secs = $s4
access soma.sec
// Set up the attenuation values by playing an action potential into the
// soma for ten seconds. The action potential itself only lasts 2.
v_init = E_PAS
finitialize(v_init)
tstop = 10
dt = 0.025
// voltage_vec.play(&soma.sec.v(0.5), time_vec)
voltage_vec.play(&soma.sec.v(0.5), .025)
run()
/*
// Replace run() with its implementation, for debugging
running_ = 1
stdinit()
realtime = 0 rt = screen_update_invl rtstart = startsw()
eventcount=0
eventslow=1
stoprun = 0
if (using_cvode_) {
cvode.event(tstop)
ts = tstop
if (cvode.use_local_dt) {
cvode.solve(ts)
flushPlot()
realtime = startsw() - rtstart
return
}
}else{
ts = tstop - dt/2
}
soma {
print "soma stats:"
print nseg
print L
print diam(0)
print diam(0.5)
print diam(1)
print area(0)
print area(0.5)
print area(1)
}
while(t < ts && stoprun == 0) {
soma print v(0.5)
step()
realtime = startsw() - rtstart
if (realtime >= rt) {
screen_update()
//really compute for at least screen_update_invl
realtime = startsw() - rtstart
rt = realtime + screen_update_invl
}
}
if (using_cvode_ && stoprun == 0) { // handle the "tstop" event
step() // so all recordings take place at tstop
}
flushPlot()
realtime = startsw() - rtstart
// Done with replacement of run with its implementation
*/
distances = new Vector()
voltages = new Vector()
// Baseline for distance is set at the midpoint of the soma, where both of
// the dendritic trees are attached.
distance(0, 0.5)
// Iterate over the dendritic tree.
forsec which_secs {
for(x) {
distances.append(distance(x))
voltages.append(val_max(x) - v_init) // Assumes the "max" mechanism is
// installed in the neuron.
}
}
// Output the data
output_matrix = new Matrix(voltages.size(), 2)
output_matrix.setcol(0, distances)
output_matrix.setcol(1, voltages)
output_matrix.printf()
soma.sec {
diam = real_diam
L = real_L
}
}
/*
* Calculates the steady-state voltage in response to current steps of
* ranging from -120 pA to 80 pA, in 20 pA increments, for a duration of 200
* ms each. These should fall along a line, the slope of which is the input
* resistance. The values are printed in a single line, tab-delimited.
*
* $o1: a SectionRef pointing to the section into which the current should
* be injected.
*/
proc inputResistance() { local equilibrium_value, i localobj stim, stim_target
$o1.sec stim_target = new SectionRef()
tstop = 250 //200
dt = 0.025
stim_target.sec { stim = new IClamp(0) }
stim.del = 150 //0 //cmw 8/25/11: allow some delay for 'initialization'
stim.dur = 200
tstop=stim.del+200 // cmw 8/25/11
for (i = -.120; i <= 0.080; i += 0.02) {
v_init = E_PAS
stim.amp = i
finitialize(v_init)
run()
equilibrium_value = stim_target.sec.v(0.5)
printf("%f\t", equilibrium_value)
}
}