model clarity improvement

This commit is contained in:
ralf 2024-08-08 13:45:53 +03:00
parent bb67e34f73
commit 6633e99003
2 changed files with 15 additions and 13 deletions

View File

@ -2,10 +2,10 @@ import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from scipy.integrate import ode from scipy.integrate import ode
R = 8.314 # ideal gas constant (J/(mol*K)) R: float = 8.314 # ideal gas constant (J/(mol*K))
F = 96.485 # coulomb_per_millimole, Faraday constant F: float = 96.485 # coulomb_per_millimole, Faraday constant
T = 298 # room temperature (K) T: float = 298 # room temperature (K)
RT = R * T RT: float = R * T # J/mol
class Model: class Model:
@ -22,13 +22,13 @@ class Model:
self.Nai: float = 11000 # uM, Myoplasmic Na+ concentration self.Nai: float = 11000 # uM, Myoplasmic Na+ concentration
self.Nao: float = 150000 # uM, Extracellular Na+ concentration self.Nao: float = 150000 # uM, Extracellular Na+ concentration
self.eta: float = 0.35 # Controls voltage dependance of Na/Ca2+ exchange self.eta: float = 0.35 # Controls voltage dependance of Na/Ca2+ excng
self.km_Na: float = ( self.km_Na: float = (
87500 # uM, Na+ half-saturation constant for Na+/Ca2+ exchange 87500 # uM, Na+ half-saturation constant for Na+/Ca2+ exchange
) )
self.k_sat: float = ( self.k_sat: float = (
0.1 # Na+/Ca2+ exchange saturation factor at very negative potentials 0.1 # Na+/Ca2+ exchange saturation factor at very neg potentials
) )
self.km_Ca: float = ( self.km_Ca: float = (
1380 # uM, Ca2+ half-saturation constant for Na+/Ca2+ exchange 1380 # uM, Ca2+ half-saturation constant for Na+/Ca2+ exchange
@ -132,7 +132,7 @@ class Model:
) )
self.V_JSR: float = 0.12e-6 # ul, Junctional SR volume self.V_JSR: float = 0.12e-6 # ul, Junctional SR volume
def ode_system(self, t, states): def ode_system(self, t, states: list[float]) -> list[float]:
( (
Cass, Cass,
@ -331,7 +331,7 @@ class Model:
dFCadt, dFCadt,
] ]
def mem_potential(self, t): def mem_potential(self, t: np.ndarray) -> np.ndarray:
t = np.asarray(t) t = np.asarray(t)
v1 = 0 v1 = 0
t0 = 100 t0 = 100
@ -339,7 +339,7 @@ class Model:
n = (t // self.period) * self.period n = (t // self.period) * self.period
return np.where((t0 + n <= t) & (t < t1 + n), v1, self.V_mem_rest) return np.where((t0 + n <= t) & (t < t1 + n), v1, self.V_mem_rest)
def get_initial_values(self): def get_initial_values(self) -> list[float]:
Cai_0: float = 0.11712 # Cai Cai_0: float = 0.11712 # Cai
FCa_0: float = (self.k_on * self.F_tot * Cai_0) / ( FCa_0: float = (self.k_on * self.F_tot * Cai_0) / (
self.k_on * Cai_0 + self.k_off self.k_on * Cai_0 + self.k_off
@ -365,11 +365,13 @@ class Model:
FCa_0, # FCa FCa_0, # FCa
] ]
def calculated_current(self, states, V): def calculated_current(self, states: list[float], V: np.ndarray) -> np.ndarray:
ICaL = self.gCaL * states[1, :] * (V - self.ECaL) Os = states[1]
return ICaL
def solve(self, initial_values, tspan, dt, times): I_CaL = self.gCaL * Os * (V - self.ECaL)
return I_CaL
def solve(self, initial_values: list[float], tspan, dt, times):
times = np.arange(*tspan, dt) times = np.arange(*tspan, dt)
r = ode(self.ode_system) r = ode(self.ode_system)

Binary file not shown.