-
Notifications
You must be signed in to change notification settings - Fork 0
/
figure9.py
49 lines (37 loc) · 2.61 KB
/
figure9.py
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
import numpy as np
import time
import matplotlib.pyplot as plt
from EDPRmodel.EDPRmodel import *
from functions.solve_EDPRmodel import *
from functions.print_final_values import *
from functions.calculate_axial_transport import *
start_time = time.time()
t_dur = 30 # [s]
alpha = 2.0
I_stim = 27e-12 # [A]
stim_start = 10 # [s]
stim_end = 20 # [s]
sol = solve_EDPRmodel(t_dur, alpha, I_stim, stim_start, stim_end)
Na_si, Na_se, Na_di, Na_de, K_si, K_se, K_di, K_de, Cl_si, Cl_se, Cl_di, Cl_de, Ca_si, Ca_se, Ca_di, Ca_de, \
X_si, X_se, X_di, X_de, n, h, s, c, q, z = sol.y
t = sol.t
my_cell = EDPRmodel(309.14, Na_si, Na_se, Na_di, Na_de, K_si, K_se, K_di, K_de, Cl_si, Cl_se, Cl_di, Cl_de, Ca_si, Ca_se, Ca_di, Ca_de, X_si, X_se, X_di, X_de, alpha, 0.01, 0.01, n, h, s, c, q, z)
#print_final_values(my_cell)
phi_si, phi_se, phi_di, phi_de, phi_sm, phi_dm = my_cell.membrane_potentials()
E_Na_s, E_Na_d, E_K_s, E_K_d, E_Cl_s, E_Cl_d, E_Ca_s, E_Ca_d = my_cell.reversal_potentials()
#print("----------------------------")
#print('elapsed time: ', round(time.time() - start_time, 1), 'seconds')
f1 = plt.figure(1)
plt.plot(t, phi_sm*1000, '-', label='V_s')
plt.plot(t, phi_dm*1000, '-', label='V_d')
plt.title('Membrane potentials')
plt.xlabel('time [s]')
plt.ylabel('[mV]')
plt.legend(loc='upper right')
j_e_drift_i, j_e_diff_i, e_akkum_drift_i, e_akkum_diff_i, Na_akkum_drift_i, Na_akkum_diff_i, K_akkum_drift_i, K_akkum_diff_i, Cl_akkum_drift_i, Cl_akkum_diff_i, Ca_akkum_drift_i, Ca_akkum_diff_i, j_e_drift_e, j_e_diff_e, e_akkum_drift_e, e_akkum_diff_e, Na_akkum_drift_e, Na_akkum_diff_e, K_akkum_drift_e, K_akkum_diff_e, Cl_akkum_drift_e, Cl_akkum_diff_e, Ca_akkum_drift_e, Ca_akkum_diff_e = calculate_axial_transport(my_cell, t)
np.savez('data/figure9', t=t, phi_si=phi_si, phi_se=phi_se, phi_di=phi_di, phi_de=phi_de, phi_sm=phi_sm, phi_dm=phi_dm, \
j_e_drift_i=j_e_drift_i, j_e_diff_i=j_e_diff_i, e_akkum_drift_i=e_akkum_drift_i, e_akkum_diff_i=e_akkum_diff_i, Na_akkum_drift_i=Na_akkum_drift_i, Na_akkum_diff_i=Na_akkum_diff_i, \
K_akkum_drift_i=K_akkum_drift_i, K_akkum_diff_i=K_akkum_diff_i, Cl_akkum_drift_i=Cl_akkum_drift_i, Cl_akkum_diff_i=Cl_akkum_diff_i, Ca_akkum_drift_i=Ca_akkum_drift_i, Ca_akkum_diff_i=Ca_akkum_diff_i, \
j_e_drift_e=j_e_drift_e, j_e_diff_e=j_e_diff_e, e_akkum_drift_e=e_akkum_drift_e, e_akkum_diff_e=e_akkum_diff_e, Na_akkum_drift_e=Na_akkum_drift_e, Na_akkum_diff_e=Na_akkum_diff_e, \
K_akkum_drift_e=K_akkum_drift_e, K_akkum_diff_e=K_akkum_diff_e, Cl_akkum_drift_e=Cl_akkum_drift_e, Cl_akkum_diff_e=Cl_akkum_diff_e, Ca_akkum_drift_e=Ca_akkum_drift_e, Ca_akkum_diff_e=Ca_akkum_diff_e)
#plt.show()