def f4d(f=2e-3, new=0, title='f4d.eps'): print "\nFigure 4D" #dxe=plm(gx=0,xt=1600,two=0,tt=3000,f4d=f,neww=0,graph=1,p=(10**(-3))/(F),pkcc=1e-3/F) dxe = plm(gx=0, xt=360, two=0, tt=1800, f4d=f, neww=0) a0, a1, a2 = minithreefig([ dxe[11][1:-1], dxe[14][1:-1], dxe[13][1:-1], dxe[16][1:-1], dxe[10][1:-1], dxe[23][1:-1] ], xcolor, yl=[[-100, -70], [1.85e-12, 2.0e-12], [0, 0.09]]) print(dxe[16][-1] - dxe[14][-1]) #print (dxe[16][350]-dxe[14][350]) if new == 1: delta = plm(gx=0, xt=360, two=0, tt=1800, f4d=f, neww=1, graph=0) a0.plot(delta[11][1:-1], delta[14][1:-1], color=clcolor, linestyle='--') a0.plot(delta[11][1:-1], delta[13][1:-1], color=kcolor, ls='--') a0.plot(delta[11][1:-1], delta[16][1:-1], 'k', ls='--') a1.plot(delta[11][1:-1], delta[10][1:-1], color=wcolor, ls='--') #volume a2.plot(delta[11][1:-1], delta[23][1:-1], color=xcolor, ls='--') #conc X plt.savefig(title) plt.show() return dxe
def f4e(Z=range(-120, -50), moldelt=1e-12 ): # extra function needed in figure 5 molinit = plm(gx=1e-8, xt=25, tt=100, two=1, paratwo=True, moldelt=moldelt) zee = zp(Z=Z, molinit=molinit, moldelt=moldelt) newx = [] for i in zee[9]: newx.append(i) return zee[0], Z, zee, newx
def f1c(new=0, l='-', g1=0, g2=0, g3=0): g = 1 if new != 0: g = 2 print("\nFigure 1C") offpump = plm(graph=g, ton=3000, toff=9000, tt=12000, title='f1c.eps', neww=new, ls=l, a0=g1, a1=g2, a2=g3) return offpump
def f4a(init_x=[40e-3, 80e-3, 120e-3, 160e-3]): print "Figure 4A" plt.figure() for i in range(len(init_x)): endcl = plm(xinit=init_x[i], tt=1800, k_init=0, osmofix=True) plt.subplot(2, 1, 1) plt.plot(endcl[11][1:-1], endcl[20][1:-1], color=xcolor, linestyle=sym[i]) plt.subplot(2, 1, 2) plt.plot(endcl[11][0:-1], endcl[10][0:-1], 'k' + sym[i]) #plt.savefig('f4a.eps') plt.show() return endcl[20], endcl
def sf4fa(): XF = [5e-14, 1e-13, 2e-13] GX = [-10, -9, -8] col = ['mo', 'bo', 'go'] plt.figure() for a in XF: for g in GX: dez = plm(tt=2500, moldelt=a, two=1, gx=10**g, xt=25, xend=0, ratio=0.8) #minithreefig([dez[11][1:-1],dez[14][1:-1],dez[13][1:-1],dez[16][1:-1],dez[10][1:-1],dez[22][1:-1]],'k') plt.plot(g, dez[22][-1], col[XF.index(a)]) plt.show() return
def f3a(): dg = plm(tk=120, tt=600) print "Figure 3A" a1, a2, a3 = minithreefig([ dg[11][4:-1], dg[14][4:-1], dg[13][4:-1], dg[16][4:-1], dg[10][4:-1], dg[24][4:-1] ], 'k', yl=[[-100, -70], [1.92e-12, 1.98e-12], [0, 6e-7]]) #plt.savefig('f3a.eps') plt.show() print dg[24][-1] print dg[14][0] print dg[17][0] print dg[17][-1] print dg[14][-1] return dg
def f3d(new=0, title='f3d.eps'): #doubles as f6f when new==1 molint = plm(gx=1e-8, xt=25, tt=100, two=1, paratwo=True, moldelt=0) if new == 0: gp = zplm(molinit=molint) print "\nFigure 3D" minifig([gp[0], gp[3], gp[2], [], [], gp[5], gp[11]], x=0) else: gp = zplm() gp_nokcc = zplm(gkcc=0) print "\nFigure 6F" plt.figure() plt.plot(gp[-1], np.subtract(gp[5], gp[3]), color='k') plt.plot(gp_nokcc[-1], np.subtract(gp_nokcc[5], gp_nokcc[3]), linestyle='--', color='k') #plt.savefig(title) plt.show() return
def f4b(init_x=range(25, 586, 40), new=0, l='-', title='f4b.eps', a=0, b=0): endv = [] endk = [] endcl = [] endw = [] print "\nFigure 4B" for i in init_x: end = plm(xinit=i * 1e-3, k_init=0, tt=2000, osmofix=False, neww=new, ls=l) endv.append(end[9]) endk.append(end[6]) endcl.append(end[7]) endw.append(end[21]) print end[9] print end[6] print end[7] plt.figure() gs = gridspec.GridSpec(2, 1, height_ratios=[1.5, 1]) if a == 0: a = plt.subplot(gs[0]) a.plot(init_x, endcl, color=clcolor, linestyle=l) a.plot(init_x, endcl, 'bo', linestyle=l) a.plot(init_x, endk, color=kcolor, linestyle=l) a.plot(init_x, endk, 'ro', linestyle=l) a.plot(init_x, endv, 'k', linestyle=l) a.plot(init_x, endv, 'ko', linestyle=l) a.set_ylim([-100, -70]) if b == 0: b = plt.subplot(gs[1]) b.plot(init_x, endw, color=wcolor, linestyle=l) b.plot(init_x, endw, 'ko', linestyle=l) b.set_ylim([0, 8e-12]) #plt.savefig(title) plt.show() return a, b
def sf4fb(): XF = [5e-14, 1e-13, 2e-13] rat = [0.2, 0.4, 0.6, 0.8] GX = [-10, -9, -8] col = ['mo', 'bo', 'go', 'ro'] plt.figure() for s in XF: for r in rat: dez = plm(tt=500, moldelt=s, two=1, gx=10**(-8), xt=25, xend=0, ratio=r) #minithreefig([dez[11][1:-1],dez[14][1:-1],dez[13][1:-1],dez[16][1:-1],dez[10][1:-1],dez[22][1:-1]],'k') plt.plot(r, dez[22][-1], col[XF.index(s)]) #plt.ylim((-0.83,-0.85)) plt.show() return
def f1b(init_cl=[1e-3, 15e-3, 50e-3, 90e-3], ham=0): leg = [] print("Figure 1B") plt.figure() for i in range(len(init_cl)): endcl = plm(clinit=init_cl[i], tt=1800, osmofix=False, k_init=0, hamada=ham) plt.subplot(2, 1, 1) plt.plot(endcl[11][13:-1], endcl[17][13:-1], color=clcolor, linestyle=sym[i]) plt.subplot(2, 1, 2) plt.plot(endcl[11][13:-1], endcl[10][13:-1], 'k' + sym[i]) leg.append(str(init_cl[i] * 1000) + ' mM') plt.savefig('f1bham.eps') plt.show() return
def sf4c(GX=[5e-10, 1e-9, 5e-9, 7e-9, 1e-8, 2e-8], tt=600, xt=25, ratio=0.98, xend=0): deltecl = [] maxdeltecl = [] deltw = [] deltx = [] for i in GX: dex = plm(gx=i, xt=xt, tt=tt, ratio=ratio, xend=xend) deltecl.append(dex[14][-1] - dex[14][1]) maxdeltecl.append(max(np.absolute((dex[14] - dex[14][1])))) deltw.append((dex[10][-1]) / dex[10][1]) deltx.append(max(np.absolute((dex[20] - dex[20][1])))) minithreefig([ dex[11][1:-1], dex[14][1:-1], dex[13][1:-1], dex[16][1:-1], dex[10][1:-1], dex[20][1:-1] ], xcolor) print maxdeltecl twoaxes(GX, deltecl, maxdeltecl, deltx, deltw) return
def f6b(moldelt=0): print "\nFigure 6B" XF = [ -1.20, -1.15, -1.1, -1.05, -1.0, -0.95, -0.9, -0.85, -0.8, -0.75, -0.7, -0.65, -0.6, -0.55, -0.501 ] XFp = [] cl = [] vm = [] k = [] w = [] Z = [] x = [] df = [] newpr = [] nai = [] ki = [] cli = [] xi = [] vm = [] pi = [] ena = [] ek = [] ecl = [] exi = [] ev = [] df2 = [] nai2 = [] pi, zi, zee, newx = f4e(moldelt=moldelt) for i in range(len(zi)): for b in XF: if zi[i] / 100.0 == b: #XFp.append(pi[i]) XFp.append(default_p) for a in range(len(XFp)): dez = plm(z=XF[a], tt=1000, p=(10**(XFp[a])) / F, graph=0, osmofix=True, xinit=0) newpr.append(dez[-3]) cl.append(dez[7]) k.append(dez[6]) vm.append(dez[9]) w.append(dez[10][-1]) Z.append(dez[22][-1] * 100) x.append(dez[3]) df.append(dez[9] - dez[7]) pi = [] pi1 = [] pi2 = [] df3 = [] for m, o in enumerate(newpr, 0): q = 10**(default_P / 10000.0) / (F * R) pi1.append(q * R) z = XF[m] theta = (-z * (ose) + np.sqrt( z**2 * (ose)**2 + 4 * (1 - z**2) * cle * np.exp(-2 * q * gkcc * beta) * (nae * np.exp(-3 * q / gna) + ke * np.exp(2 * q * (gcl + gkcc) * beta))) ) / (2 * (1 - z) * ((nae * np.exp(-3 * q / gna) + ke * np.exp(2 * q * (gcl + gkcc) * beta)))) v = (-np.log(theta)) * R nai2.append(nae * np.exp(-v / R - 3 * q / gna)) pi2.append(np.log10(F * R * q / (((np.exp(-v / R - 3 * q / gna)))**3))) df3.append(1000.0 * v - 1000 * R * np.log(cle * np.exp(+v / R - 2 * q * gkcc * beta) / cle)) for m, o in enumerate(newpr, 0): q = 10**(o) / (F * R) z = XF[m] theta = (-z * (ose) + np.sqrt( z**2 * (ose)**2 + 4 * (1 - z**2) * cle * np.exp(-2 * q * gkcc * beta) * (nae * np.exp(-3 * q / gna) + ke * np.exp(2 * q * (gcl + gkcc) * beta))) ) / (2 * (1 - z) * ((nae * np.exp(-3 * q / gna) + ke * np.exp(2 * q * (gcl + gkcc) * beta)))) v = (-np.log(theta)) * R nai.append(nae * np.exp(-v / R - 3 * q / gna)) ki.append(ke * np.exp(-v / R + 2 * q * (gcl + gkcc) * beta)) cli.append(cle * np.exp(+v / R - 2 * q * gkcc * beta)) xi.append(ose - nai[-1] - cli[-1] - ki[-1]) pi.append(q * R) ek.append(1000 * R * np.log(ke / ki[-1])) ena.append(1000 * R * np.log(nae / nai[-1])) ecl.append(1000 * R * np.log(cli[-1] / cle)) exi.append(z * 1000 * R * np.log(xe / xi[-1])) ev.append(1000.0 * v) df2.append(ev[-1] - ecl[-1]) Z = XF[0:14] twoaxes(Z, pi, pi1, nai) plt.figure() plt.plot(Z, df2, 'k') plt.plot(Z, df3, 'k--') #plt.savefig('f6b.eps') plt.show() return
def delta_gs3(Gk=[70], Gna=[20], Gkcc=[20], Gcl=[20], molinit=0): vm = [] cli = [] nai = [] ki = [] xi = [] w = [] ek = [] ecl = [] ev = [] exi = [] ena = [] df = [] chosen = [] kpflux = [] kaflux = [] kaflux1 = [] kaflux2 = [] molinit = plm(gx=1e-8, xt=25, tt=100, two=1, paratwo=True, moldelt=0) # only operate on conductance which is changing for i in range(max(len(Gcl), len(Gkcc), len(Gk), len(Gna))): for a in Gk, Gna, Gkcc, Gcl: if len(a) <= i: a.append(a[-1]) if len(a) > i + 1: chosen = a gkcc = Gkcc[i] * 1.0e-4 / F gna = Gna[i] * 1.0e-4 / F gk = Gk[i] * 1.0e-4 / F gcl = Gcl[i] * 1.0e-4 / F found = False # run through all pump rates (analytical solution) for l in prange: q = np.float64(10**(l / 10000.0) / (F * R)) if gk * gcl + gkcc * gcl + gk * gkcc != 0: beta = 1.0 / (gk * gcl + gkcc * gcl + gk * gkcc) else: print "invalid conductances: division by 0" if z == -1: theta = 0.5 * ose / (nae * np.exp(-3 * q / gna) + ke * np.exp(2 * q * (gcl + gkcc) * beta)) else: theta = (-z * ose + np.sqrt( z**2 * ose**2 + 4 * (1 - z**2) * cle * np.exp(-2 * q * gkcc * beta) * (nae * np.exp(-3 * q / gna) + ke * np.exp(2 * q * (gcl + gkcc) * beta)))) / (2 * (1 - z) * ( (nae * np.exp(-3 * q / gna) + ke * np.exp(2 * q * (gcl + gkcc) * beta)))) v = (-np.log(theta)) * R # efficient coding for expression pi=np.log10(F*R*q/(((np.exp(-v/R-3*q/gna)))**3)) pi = np.exp(-v / R - 3 * q / gna) pi = -3 * np.log10(pi) pi += np.log10(F * R * q) # match constant pump rates to determine which pair (l, na) produce (very close to) the default pump rate # append to arrays if np.abs(pi - default_p) < 0.01 and found == False: vm.append(v) nai.append(nae * np.exp(-v / R - 3 * q / gna)) ki.append(ke * np.exp(-v / R + 2 * q * (gcl + gkcc) * beta)) cli.append(cle * np.exp(+v / R - 2 * q * gkcc * beta)) xi.append(ose - nai[-1] - cli[-1] - ki[-1]) w.append((molinit) / xi[-1]) ek.append(1000 * R * np.log(ke / ki[-1])) ena.append(1000 * R * np.log(nae / nai[-1])) ecl.append(1000 * R * np.log(cli[-1] / cle)) exi.append(z * 1000 * R * np.log(xe / xi[-1])) ev.append(1000.0 * v) df.append(ev[-1] - ecl[-1]) found = True kpflux.append(gk * (v - ek[-1] / 1000.0)) kaflux.append(-(2 * q * R + gkcc * (ek[-1] - ecl[-1]) / 1000.0)) kaflux1.append(-(2 * q * R)) kaflux2.append(-(gkcc * (ek[-1] - ecl[-1]) / 1000.0)) # if when checking for correct pair (l, na) none is found, notify (this will mean that no figure is generated) if found == False: print 'no match', i, pi, default_p # may be fixed by increasing bounds of prange (i.e. larger search space) return np.log10( chosen), ecl, ek, ena, ki, ev, w, kpflux, kaflux, kaflux1, kaflux2
def delta_gs(Gk=[70], Gna=[20], Gkcc=[20], Gcl=[20], molinit=0): vm = [] cli = [] nai = [] ki = [] xi = [] w = [] ek = [] ecl = [] ev = [] exi = [] ena = [] df = [] chosen = [] q = 10**(default_P / 10000.0) for i in range(max(len(Gcl), len(Gkcc), len(Gk), len(Gna))): for a in Gk, Gna, Gkcc, Gcl: if len(a) <= i: a.append(a[-1]) if len(a) > i + 1: chosen = a gkcc = Gkcc[i] * 1.0e-4 / F gna = Gna[i] * 1.0e-4 / F gk = Gk[i] * 1.0e-4 / F gcl = Gcl[i] * 1.0e-4 / F molinit = plm(gx=1e-8, xt=25, tt=100, two=1, paratwo=True, moldelt=0) if gk * gcl + gkcc * gcl + gk * gkcc != 0: beta = 1.0 / (gk * gcl + gkcc * gcl + gk * gkcc) else: print "invalid conductances: division by 0" if z == -1: theta = 0.5 * ose / (nae * np.exp(-3 * q / gna) + ke * np.exp(2 * q * (gcl + gkcc) * beta)) else: theta = (-z * ose + np.sqrt(z**2 * ose**2 + 4 * (1 - z**2) * cle * np.exp(-2 * q * gkcc * beta) * (nae * np.exp(-3 * q / gna) + ke * np.exp(2 * q * (gcl + gkcc) * beta)))) / ( 2 * (1 - z) * ((nae * np.exp(-3 * q / gna) + ke * np.exp(2 * q * (gcl + gkcc) * beta)))) v = (-np.log(theta)) * R vm.append(v) nai.append(nae * np.exp(-v / R - 3 * q / gna)) ki.append(ke * np.exp(-v / R + 2 * q * (gcl + gkcc) * beta)) cli.append(cle * np.exp(+v / R - 2 * q * gkcc * beta)) xi.append(ose - nai[-1] - cli[-1] - ki[-1]) w.append((molinit) / xi[-1]) ek.append(1000 * R * np.log(ke / ki[-1])) ena.append(1000 * R * np.log(nae / nai[-1])) ecl.append(1000 * R * np.log(cli[-1] / cle)) exi.append(z * 1000 * R * np.log(xe / xi[-1])) ev.append(1000.0 * v) df.append(ev[-1] - ecl[-1]) print ecl[-1], ek[-1], ev[-1] return np.log10(chosen), ecl, ek, ena, df, ev, w, kpflux, kaflux
def f1d(time=25000, ham=0, l=0): T = [ -7000, -6000, -5000, -4500, -4000, -3500, -3000, -2000, -1000, 0, 1000, 2000 ] #T=[-2000,0,1000,2000] ti = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []] # numerical solutions if ham == 0: for k in T: q = 10**(k / 1000.0) / F # optimisations (alternative is to start sims at any values and allow each to run for a long time) if k == -7000: a = plm(p=q, tt=time, graph=0, k_init=0, xinit=30e-3, clinit=120e-3, na_init=140e-3, f1d=True, lin=l) elif k == -6000: a = plm(p=q, tt=time, graph=0, k_init=0, xinit=36e-3, clinit=113e-3, na_init=140e-3, f1d=True, lin=l) else: a = plm(p=q, tt=time, graph=0, k_init=0, xinit=75e-3, clinit=75e-3, na_init=135e-3, f1d=True, lin=l) for i in range(25): ti[i].append(a[i]) else: L = [] for a in T: L.append((a - 3500.0) / 4.5) #y=(x-3500)/4.5 for k in T: q = 10**(k / 1000.0 - default_p) # optimisations (alternative is to start sims at any values and allow each to run for a long time) if k == -7000: a = plm(p=q, tt=time, graph=1, k_init=0, xinit=30e-3, clinit=120e-3, na_init=140e-3, f1d=True, hamada=q) elif k == -6000: a = plm(p=q, tt=time, graph=1, k_init=0, xinit=33e-3, clinit=118e-3, na_init=142e-3, f1d=True, hamada=q) elif -3000 > k: a = plm(p=q, tt=time, graph=1, k_init=0, xinit=45e-3, clinit=105e-3, na_init=140e-3, f1d=True, hamada=q) elif k == -3000: a = plm(p=q, tt=time, graph=1, k_init=0, xinit=50e-3, clinit=100e-3, na_init=140e-3, f1d=True, hamada=q) elif k == -2000: a = plm(p=q, tt=time, graph=1, k_init=0, xinit=120e-3, clinit=35e-3, na_init=135e-3, f1d=True, hamada=q) else: a = plm(p=q, tt=5000, graph=1, k_init=0, xinit=75e-3, clinit=75e-3, na_init=135e-3, f1d=True, hamada=q) for i in range(25): ti[i].append(a[i]) # parametric solutions molinit = plm(gx=1e-8, xt=25, tt=100, two=1, paratwo=True, moldelt=0) para = zplm(molinit=molinit) # plotting print("\nFigure 1D") gs = gridspec.GridSpec(3, 1, height_ratios=[1.5, 1, 1]) plt.subplot(gs[0]) plt.plot(para[0], para[8], color=clcolor, linestyle='-') plt.plot(para[0], para[7], color=kcolor, linestyle='-') plt.plot(para[0], para[6], color=nacolor, linestyle='-') plt.plot(para[0], para[9], color=xcolor, linestyle='-') plt.plot(T, ti[0], 'o--', color=nacolor) plt.plot(T, ti[1], 'o--', color=kcolor) plt.plot(T, ti[2], 'o--', color=clcolor) plt.plot(T, ti[3], 'o--', color=xcolor) plt.subplot(gs[1]) plt.plot(para[0], para[10], 'k-') plt.plot(T, ti[4], 'ko--') plt.subplot(gs[2]) plt.plot(para[0], para[11], color=wcolor, linestyle='-') plt.plot(T, ti[21], 'ko--') plt.savefig('f1d.eps') plt.show() return ti
def f4c(gX=1e-8, tt=3600, xt=360, xend=420, xflux=4e-7, new=0, title='f4c.eps', ham=0): #doubles as f6c when new!=0 dex = plm(gx=gX, xt=xt, tt=tt, xflux=xflux, xend=xend, graph=0, hamada=0) delta = [] delta1 = [] if new == 0: print "\nFigure 4C" ax0, ax1, ax2 = minithreefig([ dex[11][1:-1], dex[14][1:-1], dex[13][1:-1], dex[16][1:-1], dex[10][1:-1], dex[20][1:-1] ], xcolor, yl=[[-100, -70], [1.9e-12, 2.5e-12], [154, 157]]) else: print "\nFigure 6C" ax0, ax1, ax2 = minithreefig([ dex[11][1:-1], dex[14][1:-1], dex[13][1:-1], dex[16][1:-1], dex[18][1:-1], dex[10][1:-1] ], 'k', yl=[[-100, -70], [13, 19], [1.8e-12, 2.2e-12]]) delta = plm(gx=gX, xt=xt, tt=tt, xflux=xflux, xend=xend, neww=3, graph=0, hamada=ham) ax0.plot(delta[11][1:-1], delta[14][1:-1], color=clcolor, linestyle='--') ax0.plot(delta[11][1:-1], delta[13][1:-1], color=kcolor, ls='--') ax0.plot(delta[11][1:-1], delta[16][1:-1], 'k', ls='--') print(delta[16][-1] - delta[14][-1]) print(delta[16][350] - delta[14][350]) print len(delta[16]) ax1.plot(delta[11][1:-1], delta[18][1:-1], color=nacolor, ls='--') #nai ax2.plot(delta[11][1:-1], delta[10][1:-1], color='k', ls='--') #volume delta1 = plm(gx=gX, xt=xt, tt=tt, xflux=xflux, xend=xend, neww=5, graph=0, hamada=ham) if ham == 1: delta2 = plm(gx=gX, xt=xt, tt=tt, xflux=xflux, xend=xend, graph=0, hamada=ham) ax0.plot(delta2[11][1:-1], delta2[14][1:-1], color=clcolor, linestyle=':') ax0.plot(delta2[11][1:-1], delta2[13][1:-1], color=kcolor, ls=':') ax0.plot(delta2[11][1:-1], delta2[16][1:-1], 'k', ls=':') ax1.plot(delta2[11][1:-1], delta2[18][1:-1], color=nacolor, ls=':') #nai ax2.plot(delta2[11][1:-1], delta2[10][1:-1], color='k', ls=':') #volume print(delta2[16][-1] - delta2[14][-1]) print len(delta2[16]) ax0.plot(delta1[11][1:-1], delta1[14][1:-1], color=clcolor, linestyle='-.') ax0.plot(delta1[11][1:-1], delta1[13][1:-1], color=kcolor, ls='-.') ax0.plot(delta1[11][1:-1], delta1[16][1:-1], 'k', ls='-.') ax1.plot(delta1[11][1:-1], delta1[18][1:-1], color=nacolor, ls='-.') #nai ax2.plot(delta1[11][1:-1], delta1[10][1:-1], color='k', ls='-.') #volume print(delta1[16][-1] - delta1[14][-1]) print len(delta1[16]) plt.savefig(title) plt.show() return dex, delta, delta1
def f6d(os=range(-100, 100)): print "\nFigure 6D" nai = [] ki = [] cli = [] ecl = [] ev = [] pi = [] os2 = [] os3 = [] q = 10**(default_P / 10000.0) / (F * R) for o in os: theta = (-z * (ose + o / 10000.0) + np.sqrt( z**2 * (ose + o / 10000.0)**2 + 4 * (1 - z**2) * cle * np.exp(-2 * q * gkcc * beta) * (nae * np.exp(-3 * q / gna) + ke * np.exp(2 * q * (gcl + gkcc) * beta))) ) / (2 * (1 - z) * ((nae * np.exp(-3 * q / gna) + ke * np.exp(2 * q * (gcl + gkcc) * beta)))) v = (-np.log(theta)) * R nai.append(nae * np.exp(-v / R - 3 * q / gna)) ki.append(ke * np.exp(-v / R + 2 * q * (gcl + gkcc) * beta)) cli.append(cle * np.exp(+v / R - 2 * q * gkcc * beta)) pi.append(q * R) ecl.append(1000.0 * R * np.log(cli[-1] / cle)) ev.append(1000.0 * v) on = [-0.1, -0.075, -0.05, -0.025, -0.01, 0, 0.01, 0.025, 0.05, 0.075, 0.1] p_plm_osmo = [] for a, i in enumerate(os, 0): for b in on: if a == b * 1000: p_plm_osmo.append(pi[i]) for m in (2, 7): if m == 1: shape = '*' elif m == 2: shape = 's' elif m == 3: shape = 'o' for l, o in enumerate(on, 0): d = plm(neww=m, osmofix=True, os_choose=o / 10.0, tt=1000, areascale=1, xflux=o * 1e-5, xt=180, xend=180, graph=0) oh = (d[-2] - d[-1]) * 10000 os2.append(10**(d[-3]) / (F)) os3.append(oh) nai2 = [] ki2 = [] cli2 = [] xi2 = [] ecl2 = [] ev2 = [] pi2 = [] for x, o in enumerate(os3, 0): q = os2[x] / R theta = (-z * (ose + o / 10000.0) + np.sqrt( z**2 * (ose + o / 10000.0)**2 + 4 * (1 - z**2) * cle * np.exp(-2 * q * gkcc * beta) * (nae * np.exp(-3 * q / gna) + ke * np.exp(2 * q * (gcl + gkcc) * beta))) ) / (2 * (1 - z) * ((nae * np.exp(-3 * q / gna) + ke * np.exp(2 * q * (gcl + gkcc) * beta)))) v = (-np.log(theta)) * R nai2.append(nae * np.exp(-v / R - 3 * q / gna)) ki2.append(ke * np.exp(-v / R + 2 * q * (gcl + gkcc) * beta)) cli2.append(cle * np.exp(+v / R - 2 * q * gkcc * beta)) pi2.append(np.log10(F * R * q / (((np.exp(-v / R - 3 * q / gna)))**3))) ecl2.append(1000.0 * R * np.log(cli2[-1] / cle)) ev2.append(1000.0 * v) twoaxes(os, pi, os2, nai, os3) plt.figure() plt.plot(os, np.array(ev) - np.array(ecl), color='k') plt.plot(os3, np.array(ev2) - np.array(ecl2), 'k--') #plt.savefig('f6d.eps') plt.show() return