Model and fitter no longer print every iteration. Now need to fix the fitting and current

This commit is contained in:
ralf 2024-08-13 10:41:00 +03:00
parent 3c22072933
commit a2bb97fe22
3 changed files with 9 additions and 30 deletions

View File

@ -391,7 +391,9 @@ class Model:
break break
V = np.array([self.mem_potential(t) for t in times]) V = np.array([self.mem_potential(t) for t in times])
return states, V
def plot_results(self, times, states, V):
# plt.plot(times, V) # plt.plot(times, V)
fig = plt.figure() fig = plt.figure()
ax1 = fig.add_subplot(141) ax1 = fig.add_subplot(141)
@ -431,7 +433,7 @@ class Model:
ax4.set_xlabel("time [ms]") ax4.set_xlabel("time [ms]")
ax4.set_ylabel(r"$\mu mol/3l$") ax4.set_ylabel(r"$\mu mol/3l$")
return states, V plt.show()
if __name__ == "__main__": if __name__ == "__main__":
@ -439,32 +441,9 @@ if __name__ == "__main__":
# Cass, Os, C2, C3, C4, I1, I2, I3, LTRPNCa, HTRPNCa, Cai, FCa= states # Cass, Os, C2, C3, C4, I1, I2, I3, LTRPNCa, HTRPNCa, Cai, FCa= states
model = Model() model = Model()
Cai_0 = 0.11712 # Cai initial_values = model.get_initial_values()
FCa_0 = (model.k_on * model.F_tot * Cai_0) / (model.k_on * Cai_0 + model.k_off) times = np.arange(0, 1000, 1.0)
# print(FCa_0)
# Cass, Os, C2, C3, C4, I1, I2, I3, LTRPNCa, HTRPNCa, Ca_NSR, Ca_JSR, P_RyR, P_O1, P_O2, P_C2, Cai, FCa = states states, V = model.solve(initial_values=initial_values, tspan=[0, 1000], dt=1.0, times=times)
initial_values = [
Cai_0, # Cass model.plot_results(times, states, V)
0.930308e-18, # Os,
0.124216e-3, # C2,
0.578679e-8, # C3,
0.119816e-12, # C4,
0.497923e-18, # I1,
0.345847e-13, # I2,
0.185106e-13, # I3,
11.2684, # LTRPNCa,
125.290, # HTRPNCa
1299.50, # Ca_NSR
1299.50, # Ca_JSR
0.0, # P_RyR
0.149102e-4, # P_O1
0.951726e-10, # P_02
0.167740e-3, # P_C2
Cai_0, # Cai
FCa_0, # FCa
]
model.solve(initial_values=initial_values, tspan=[0, 1000], dt=1.0, times=None)
plt.show()
plt.close('all')

Binary file not shown.

View File

@ -226,4 +226,4 @@ if __name__ == "__main__":
# fig.savefig(f"{plot_filename}.png") # fig.savefig(f"{plot_filename}.png")
# fig.savefig(f"{plot_filename}.pdf") # fig.savefig(f"{plot_filename}.pdf")
fig.savefig("naidis_fit.pdf") fig.savefig("naidis_fit.pdf")
# plt.show() plt.show()