def solve_and_plot(self, SL, Ca_amplitude, tau1, tau2, kn_p, kp_n, f_app, g_app, h_f, h_b, gxb): t = np.linspace(0, 1000, 101) p = rice.init_parameter_values(SLmin=2.5, Ca_amplitude=Ca_amplitude, tau1=tau1, tau2=tau2, kn_p=kn_p, kp_n=kp_n, fapp=f_app, gapp=g_app, hf=h_f, hb=h_b, gxb=gxb) force_ind = rice.monitor_indices("active") ca_ind = rice.monitor_indices("Cai") init = rice.init_state_values(SL=SL) s = odeint(rice.rhs, init, t, (p, )) force = [] cai = [] for tn, sn in zip(t, s): m = rice.monitor(sn, tn, p) force.append(m[force_ind]) cai.append(m[ca_ind]) plt.figure(1) plt.plot(t, cai) plt.figure(2) plt.plot(t, force) plt.show()
def solve_and_plot(self, SL, Fmax, Ca50, n): """ Solve the model to steady state for Ca values in [0,10], for a given value of SL, and plot the resulting F-Ca curve. """ t = np.linspace(0, 100, 101) Cai = np.linspace(0, 10, 101) force_index = rice.monitor_indices("active") init = rice.init_state_values(SL=SL) Fss = np.empty_like(Cai) for i in range(len(Cai)): p = (rice.init_parameter_values(start_time=1000, Ca_diastolic=Cai[i], SLmin=2.5), ) s = odeint(rice.rhs, init, t, p) m = rice.monitor(s[-1], t[-1], p[0]) Fss[i] = m[force_index] plt.semilogx(Cai, Fss) plt.ylabel('Normalized force at steady state') plt.xlabel('Ca concentration') #plot one dynamic Hill curve Fh = Fmax * np.power(Cai, n) / (math.pow(Ca50, n) + np.power(Cai, n)) plt.plot(Cai, Fh, ':') #plot two Hill curves for the extreme SL values Fmax = 0.17 Ca50 = 3.0 n = 7.6 Fh = Fmax * np.power(Cai, n) / (math.pow(Ca50, n) + np.power(Cai, n)) plt.plot(Cai, Fh, '--') Fmax = 0.92 Ca50 = 0.87 Fh = Fmax * np.power(Cai, n) / (math.pow(Ca50, n) + np.power(Cai, n)) plt.plot(Cai, Fh, '--') plt.show()
def solve_and_plot(self, SL, Fmax, Ca50, n): """ Solve the model to steady state for Ca values in [0,10], for a given value of SL, and plot the resulting F-Ca curve. """ t = np.linspace(0,100,101) Cai = np.linspace(0,10,101) force_index = rice.monitor_indices("active") init = rice.init_state_values(SL=SL) Fss = np.empty_like(Cai) for i in range(len(Cai)): p = (rice.init_parameter_values(start_time=1000,Ca_diastolic=Cai[i],SLmin=2.5),) s = odeint(rice.rhs,init,t,p) m = rice.monitor(s[-1],t[-1],p[0]) Fss[i] = m[force_index] plt.semilogx(Cai,Fss) plt.ylabel('Normalized force at steady state') plt.xlabel('Ca concentration') #plot one dynamic Hill curve Fh = Fmax*np.power(Cai,n)/(math.pow(Ca50,n)+np.power(Cai,n)) plt.plot(Cai,Fh,':') #plot two Hill curves for the extreme SL values Fmax = 0.17 Ca50 = 3.0 n = 7.6 Fh = Fmax*np.power(Cai,n)/(math.pow(Ca50,n)+np.power(Cai,n)) plt.plot(Cai,Fh,'--') Fmax =0.92 Ca50= 0.87 Fh = Fmax*np.power(Cai,n)/(math.pow(Ca50,n)+np.power(Cai,n)) plt.plot(Cai,Fh,'--') plt.show()
def solve_and_plot(self,SL,Ca_amplitude,tau1,tau2,kn_p,kp_n,f_app,g_app,h_f,h_b,gxb): t = np.linspace(0,1000,101) p = rice.init_parameter_values(SLmin=2.5, Ca_amplitude=Ca_amplitude, tau1=tau1, tau2=tau2, kn_p=kn_p, kp_n=kp_n, fapp=f_app, gapp=g_app, hf=h_f,hb=h_b,gxb=gxb) force_ind = rice.monitor_indices("active") ca_ind = rice.monitor_indices("Cai") init = rice.init_state_values(SL=SL) s = odeint(rice.rhs,init,t,(p,)) force = [] cai = [] for tn,sn in zip(t,s): m = rice.monitor(sn,tn,p) force.append(m[force_ind]) cai.append(m[ca_ind]) plt.figure(1) plt.plot(t,cai) plt.figure(2) plt.plot(t,force) plt.show()
hbT_index = rice.monitor_indices("hbT") fappT_index = rice.monitor_indices("fappT") active_index = rice.monitor_indices("active") lambda_solution = [] l_list = [] Ta_list = [] t_list = [] for i, t in enumerate(global_time[:-1]): # Set initial values t_local = np.linspace(t, global_time[i + 1], step + 1) print t if i == 0: p = (rice.init_parameter_values(SLmin=2.5), ) init = rice.init_state_values() else: p = (rice.init_parameter_values(SLmin=2.5), ) #SL=lambda_prev*SL0, dExtensionRatiodt=dldt),) init = rice.init_state_values(SL=lambda_prev * SL0, intf=intf_prev, TRPNCaH=TRPNCaH_prev, TRPNCaL=TRPNCaL_prev, N=N_prev, N_NoXB=N_NoXB_prev, P_NoXB=P_NoXB_prev, XBpostr=XBpostr_prev, XBprer=XBprer_prev, xXBpostr=xXBpostr_prev, xXBprer=xXBprer_prev)
import rice_model_2008 as rice from scipy.integrate import odeint import numpy as np import pylab t = np.linspace(0,650,101) init = rice.init_state_values() SL_ind = rice.state_indices("SL") Cai = np.linspace(0,10,101) sl_ss = [] for ca in Cai: p = (rice.init_parameter_values(start_time=1000,Ca_diastolic=ca,SEon=0.0),) s = odeint(rice.rhs,init,t,p) sl_ss.append(s[-1,SL_ind]) pylab.ylim([1.4,2.0]) pylab.ylabel("SL (micrometers)") pylab.xlabel("[Ca] (microM)") pylab.semilogx(Cai,sl_ss) pylab.show() """pylab.ylim([1.4,2.0]) pylab.ylabel("SL (micrometers)") pylab.xlim([550,1000]) pylab.xlabel("time (ms)") pylab.legend() #compute fitted Hill velocity: f_hill = linspace(0,0.8,101) a_hill = 0.16 b_hill = 2.4
import rice_model_2008 as rice from scipy.integrate import odeint import numpy as np import pylab #isometric for t<650: t1 = np.linspace(0, 650, 101) init = rice.init_state_values(SL=2.2) SL_ind = rice.state_indices("SL") p = (rice.init_parameter_values(start_time=1000, Ca_diastolic=10, SLmin=2.5), ) s1 = odeint(rice.rhs, init, t1, p) pylab.plot(t1, s1[:, SL_ind]) #release against different afterload values: al = np.linspace(0, 0.8, 9) v = [] intf_ind = rice.state_indices('intf') init = s1[-1, :] init[intf_ind] = 0.0 t2 = np.linspace(650, 1000, 351) for load in al: p = (rice.init_parameter_values(start_time=1000, Ca_diastolic=10, SEon=0, fixed_afterload=load), ) s2 = odeint(rice.rhs, init, t2, p) v.append(-1000 * (s2[50, SL_ind] - init[SL_ind]) / 50) pylab.plot(t2, s2[:, SL_ind], label=str(load)) #set correct axes for figure 1: pylab.ylim([1.4, 2.3])