-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcaKi.py
More file actions
executable file
·72 lines (55 loc) · 1.56 KB
/
caKi.py
File metadata and controls
executable file
·72 lines (55 loc) · 1.56 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
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python3
from cai_lib import *
def main(args):
pars=np.zeros(10)
#grel (1/ms), ka (1/[muM^2 ms]), kom (ms^-1), csr = muM
pars[0] = 0.556 ; pars[1] = 12; pars[2] = 0.12; pars[3] = 500/1e3;
#co, tdiff, kim, ki
pars[4] = 0.1/1e3 ; pars[5] = 2; pars[6] = 0.002 ; pars[7] = 0.5;
#T, Io
pars[8] = 500;
pars[9] = 5/1e3;
M=100;
if len(args)==4:
pars[8] = float(args[1]);
pars[6] = 1.0/float(args[2]);
M=float(args[3]);
dt = 1e-1; dtp = 1;
tf = M*pars[8];
N = int(tf/dtp);
Kj = []
t = 0.0
tp = dtp;
x = np.zeros(2);
n = 0
sol = np.zeros((N,3))
Icaln = np.zeros(N)
sol[n,1:3] = x
Icaln[n] = Ical(0,pars[8],pars[9])
while t<tf:
#Uncomment to use the protokit or protocolsx functions
#pars[6] = protoki(t)
#pars[8] = protocolsxz(t)
#if pars[6] not in Kj:
# Kj.append(pars[6])
# print(pars[6])
K1 = Kn(t,x,pars)
K2 = Kn(t+0.5*dt,x+0.5*dt*K1,pars)
K3 = Kn(t+0.5*dt,x+dt*0.5*K2,pars)
K4 = Kn(t+dt,x+dt*K3,pars)
x = x + (dt/6.0)*(K1+2.0*K2+2.0*K3+K4)
Ij = Ical(t,pars[8],pars[9])
t = t+dt
if t > tp:
n+=1
Icaln[n] = Ij
sol[n,0] = t
sol[n,1:3]=x
tp+=dtp
if n == N-1:
np.save('KCa.npy',sol)
np.save('KIcal.npy',Icaln)
#np.save('Kj.npy',np.asarray(Kj))
break
if __name__ == "__main__":
main(sys.argv[:])