-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVoffset.mod
More file actions
61 lines (51 loc) · 1.32 KB
/
Voffset.mod
File metadata and controls
61 lines (51 loc) · 1.32 KB
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
COMMENT
Voffset.mod
Shifts voltage by the steady state level just before the onset of a current step. This is useful when fitting passive/subthreshold parameters.
Implemented by Christina Weaver, 2007 (christina.weaver@mssm.edu)
ENDCOMMENT
NEURON {
SUFFIX offst
RANGE Voff, Vshift, Vsum
}
PARAMETER {
Vraise = -71.3 (mV) : how much to shift voltage overall
on = 300 (ms) : onset time of current step
W = 50 (ms) : length of window to average over
we = 10 (ms) : time before step onset to end averaging window
didAvg = 0 (1) : flag to minimize computation
}
UNITS {
(mV) = (millivolt)
}
ASSIGNED {
v (millivolt)
: t (ms)
Vsum (mV)
npts (1)
Voff (mV)
Vshift (mV)
}
INITIAL {
Vsum = 0
Vshift = 0
npts = 0
Voff = v - Voff + Vraise
didAvg = 0
: printf("Set npts = %g, Voff %g\n",npts,Voff)
}
BREAKPOINT {
if( t >= on-we-W && t <= on-we ) {
Vsum = Vsum + v
npts = npts + 1
: printf("time %g\tv %g\tVsum %g\tnpts %g\n",t,v,Vsum,npts)
}
if( didAvg == 0 && t > on-we ) { : past averaging window
didAvg = 1
Voff = Vsum / npts
:printf("***TIME %g\tFound offset %g = %g / %g\n",t,Voff,Vsum,npts)
}
Vshift = v - Voff + Vraise
: if( t > on-we ) {
: printf("SH time %g\tVshift %g = v %g\t- Voff %g\t+ Vraise %g\n",t,Vshift,v,Voff,Vraise)
: }
}