-
Notifications
You must be signed in to change notification settings - Fork 3
/
vclampg.hoc
132 lines (122 loc) · 3.43 KB
/
vclampg.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
objref gnamelist
gnamelist = new List()
gnamelist.append(new String("gna"))
gnamelist.append(new String("gk"))
gnamelist.append(new String("gca"))
gnamelist.append(new String("gca_high"))
gnamelist.append(new String("gar"))
gnamelist.append(new String("total"))
objref vmat, gmat[gnamelist.count], voutlist, vinlist
objref goutlist[gnamelist.count], tout, tin
proc vclampg() { local i, j, y, numcomp localobj vv, f, s, clist, c, rsav, cdvdt
s = new String()
voutlist = new List()
vinlist = new List()
for i=0, gnamelist.count-1 {
goutlist[i] = new List()
}
clist = new List()
f = new File()
numcomp=0 forsec cell.all numcomp += 1
vmat = new Matrix(100*tf-1, numcomp+1)
classname(cell, s.s)
sprint(s.s, "../p2c/state/v_%s.dat", s.s)
f.ropen(s.s)
vmat.scanf(f, vmat.nrow, vmat.ncol)
for i=0, gnamelist.count-2 {
gmat[i] = new Matrix(100*tf-1, numcomp+1)
classname(cell, s.s)
sprint(s.s, "../p2c/state/%s_%s.dat", gnamelist.object(i).s, s.s)
f.ropen(s.s)
gmat[i].scanf(f, vmat.nrow, vmat.ncol)
}
gmat[5] = new Matrix(100*tf-1, numcomp+1)
gmat[5].setcol(0,gmat[0].getcol(0))
i = 1
tout = new Vector()
cell.comp[1] {tout.record(&t)}
tin = vmat.getcol(0)
rsav = new Vector()
for i=1, vmat.ncol-1 cell.comp[i] {
rsav.append(Ra)
insert cal insert ar insert cat_a
Ra = 1e9
c = new SEClamp(.5)
c.dur1 = 1e9
c.rs = .01
clist.append(c)
for j=0, gnamelist.count-2 {
vv = new Vector()
if (j == 0) vv.record(&ina(.5))
if (j == 1) vv.record(&ik(.5))
if (j == 2) vv.record(&i_cat_a(.5))
if (j == 3) vv.record(&ica_cal(.5))
if (j == 4) vv.record(&i_ar(.5))
goutlist[j].append(vv)
}
vv = new Vector()
vv.record(&v(.5))
voutlist.append(vv)
vv = vmat.getcol(i)
vv.play(&c.amp1, tin, 1)
vinlist.append(vv)
}
stdinit()
continuerun(tf)
for i=1, vmat.ncol-1 cell.comp[i] {
for j=0, gnamelist.count-2 {
if (j == 0) y = ena(.5)
if (j == 1) y = ek(.5)
if (j == 2) y = 125
if (j == 3) y = 125
if (j == 4) y = erev_ar(.5)
if (j == 2) {
goutlist[2].object(i-1).add(goutlist[3].object(i-1))
}
vv = vinlist.object(i-1).c.sub(y)
gmat[j].setcol(i, gmat[j].getcol(i).mul(vv))
goutlist[j].object(i-1).mul(area(.5)/100)
}
}
for j=1, gmat[0].ncol-1 {
goutlist[5].append(new Vector(goutlist[0].object(j-1).size))
for case(&i, 0, 1, 2, 4) {
gmat[5].setcol(j, gmat[5].getcol(j).add(gmat[i].getcol(j)))
goutlist[5].object(j-1).add(goutlist[i].object(j-1))
}
}
for i=1, vmat.ncol-1 cell.comp[i] {
Ra = rsav.x[i-1] // but no longer is traub_exact
}
seefv(2, 0)
}
proc seefv() {localobj s
s = new String()
gg.erase_all()
seetype = $2
if (seetype > 5) { seetype = 5 }
if (seetype < 0) { seetype = 0 }
seewhich = $1
if (seewhich > voutlist.count) {seewhich = voutlist.count}
if (seewhich < 1) { seewhich = 1 }
cell.comp[seewhich] { sprint(s.s,"%s(.5) %s", secname(), gnamelist.object(seetype).s) }
gg.label(.5,.8,s.s,2,1,0,0,1)
gmat[seetype].getcol(seewhich).line(gg, tin, 2, 1)
goutlist[seetype].object(seewhich-1).line(gg, tout)
}
proc mkseefv() {
xpanel("compare compartment currents")
xvalue("type na=0 k=1", "seetype", 1, "seefv(seewhich, seetype)")
xvalue("which", "seewhich", 1, "seefv(seewhich, seetype)")
xpanel()
}
func maxdiff() {local i localobj gf, gn, r
gf = gmat[$1]
gn = goutlist[$1]
r = new Vector(gn.count)
for i=0,r.size-1 {
r.x[i] = gn.object(i).c.interpolate(tin, tout).sub(gf.getcol(i+1)).sumsq
}
print r.max
return r.max_ind
}