create a
a	{
	insert cat1i 
	insert cat1g 
	insert cat1h 
	}
access a

tstop=100
celsius=22
vlow=-120
vhigh=0

objref gk, b,gt,vc, gs,c, gf,ic
b = new HBox()
b.intercept(1)
gk = new Graph(0)
gk.view(-100,0,100,1,0,0,200,200)
gk.exec_menu("New Axis")
gk.exec_menu("10% Zoom out")
gk.label(0.1,0.9,"Fig.7A, activation")
gk.addexpr("ninf_cat1i",2,2, 2*tstop,0,2)
gk.addexpr("ninf_cat1g",3,2, 2*tstop,0,2)
gk.addexpr("ninf_cat1h",1,2, 2*tstop,0,2)

gt = new Graph(0)
gt.view(vlow,0,80,1,0,0,200,200)
gt.exec_menu("New Axis")
gt.exec_menu("10% Zoom out")
gt.label(0.1,0.9,"Fig.7B, inactivation")
gt.addexpr("linf_cat1i",2,2, 2*tstop,0,2)
gt.addexpr("linf_cat1g",3,2, 2*tstop,0,2)
gt.addexpr("linf_cat1h",1,2, 2*tstop,0,2)

xpanel("")
xbutton("run ", "run()")
xpanel()
b.intercept(0)
b.map("CaT kinetics",200,200,600,200)

c = new HBox()
c.intercept(1)
gs = new Graph(0)
gs.view(-80,0,80,20,0,0,200,200)
gs.exec_menu("New Axis")
gs.exec_menu("10% Zoom out")
gs.label(0.1,0.9,"Figs.6B-C-D, tau_act.")
gs.addexpr("taun_cat1i",2,2, 2*tstop,0,2)
gs.addexpr("taun_cat1g",3,2, 2*tstop,0,2)
gs.addexpr("taun_cat1h",1,2, 2*tstop,0,2)

gf = new Graph(0)
gf.view(-80,0,80,400,0,0,200,200)
gf.exec_menu("New Axis")
gf.exec_menu("10% Zoom out")
gf.label(0.1,0.9,"Figs.6E-F-G, tau_inact.")
gf.addexpr("taul_cat1i",2,2, 2*tstop,0,2)
gf.addexpr("taul_cat1g*2",3,2, 2*tstop,0,2)
gf.addexpr("taul_cat1h",1,2, 2*tstop,0,2)

c.intercept(0)
c.map("CaT time constants",200,600,480,200)

proc run() {

gk.begin()
gk.color(2)
gk.label(0.1,0.7,"CaT-1i")
gk.color(3)
gk.label(0.1,0.63,"CaT-1g")
gk.color(1)
gk.label(0.1,0.56,"CaT-1h")
gf.color(3)
gf.label(0.1,0.2,"2x tau_1g")

for (v=vlow; v<vhigh; v=v+1) {
    rates_cat1i(v)
    rates_cat1g(v)
    rates_cat1h(v)
    gk.plot(v)
    gt.plot(v)
if (v>-60) {gs.plot(v)}
if (v>-65) {gf.plot(v)}
}
gk.flush()
gt.flush()
gs.flush()
gf.flush()
doNotify()
}