From a2bb97fe22c9266e519b057da81ee785a5050a21 Mon Sep 17 00:00:00 2001 From: ralf Date: Tue, 13 Aug 2024 10:41:00 +0300 Subject: [PATCH] Model and fitter no longer print every iteration. Now need to fix the fitting and current --- Model.py | 37 +++++++----------------------- __pycache__/Model.cpython-311.pyc | Bin 15855 -> 15857 bytes fitter.py | 2 +- 3 files changed, 9 insertions(+), 30 deletions(-) diff --git a/Model.py b/Model.py index 50486a4..96abee5 100644 --- a/Model.py +++ b/Model.py @@ -391,7 +391,9 @@ class Model: break 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) fig = plt.figure() ax1 = fig.add_subplot(141) @@ -431,7 +433,7 @@ class Model: ax4.set_xlabel("time [ms]") ax4.set_ylabel(r"$\mu mol/3l$") - return states, V + plt.show() if __name__ == "__main__": @@ -439,32 +441,9 @@ if __name__ == "__main__": # Cass, Os, C2, C3, C4, I1, I2, I3, LTRPNCa, HTRPNCa, Cai, FCa= states model = Model() - Cai_0 = 0.11712 # Cai - FCa_0 = (model.k_on * model.F_tot * Cai_0) / (model.k_on * Cai_0 + model.k_off) - # print(FCa_0) + initial_values = model.get_initial_values() + times = np.arange(0, 1000, 1.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 - initial_values = [ - Cai_0, # Cass - 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') - \ No newline at end of file + states, V = model.solve(initial_values=initial_values, tspan=[0, 1000], dt=1.0, times=times) + + model.plot_results(times, states, V) diff --git a/__pycache__/Model.cpython-311.pyc b/__pycache__/Model.cpython-311.pyc index 9071fefa81f59ce64992deca89ca62d6eefd4f5b..9ac3eb2c988c51354f73848d1d87c092bc168cab 100644 GIT binary patch delta 2045 zcmb7EZA@EL7(Vy*-rL)c+Yjh1v{{smWo_r^bOO#%7@KT37pk}!wIP;f_j2VMZ%Z7k z42&}ttq#2;5`R@CxI{EDjb?sKS&YVLG=L;5)x;&Z#Qg#?HD>3r$CS_XMQp{U1N_Z+*#ODbVod=y>K}jkLS($jd+dQd=##{YA@PKD8?# zC2Q|J=s#OpE&WwhP~JH2sFu9vlb^H?@2Qo(`qSHV@zHRtq>2rWt_)x%(ZC6E?LHaDpSov9l&nQ0x zr^w@qT(Osl;;U&^zNzq#cN6Kw3NPWgX5~koN%T###c~5U&#Wd4CMic={P=h7(<69gn1dbSPFYc6t=i&=B&Ho5d`E^3pDjngR|a5<01Nr8rIMlX;p zq)Q`20yC-Ke3yV^bCClE?Wnr^N5u{Okfu0lTTMm32_eCdhhRn1Q2^7L6cd7Djk&!2 zfQah=sXYROY1CEJrdI~-#k*7NQ434kMdo^g~AY z+zS<)c~r35sbIHO!Ddyk!ioxIXkSsKS^K6oK0K&W2p)P-@a8K3xcMqJ7qJ-uBa@1& z{0^!ShDv35gy0lg#gmQ<6@9w z+F#JnEr=cd^=nCZ=+Ok!pCNR^Vo&e5FGd#KU`4CszW-tVEzI{0 zHdnF9VDo`O9NIyWgmUMh9|s+@D^+)iA3wQ-V7S@r^U{S&DA%YQvH?!Zu;FlLq_ry? zmN|SlyjSF->tv!_pf3}zX7XC&6sp}b$k@B9JJtZc!Z0qn%>)N z0Jisbh&A%>utq?S9#Gl?=LcIE0^-bXm(}$@)_b4e5M@sE&+1&$I@c0|xPrv7;re9# z(6Q^hd!8?w<;!OH{d4^Oq2M($pE#O4F%lVbj74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/fitter.py +++ b/fitter.py @@ -226,4 +226,4 @@ if __name__ == "__main__": # fig.savefig(f"{plot_filename}.png") # fig.savefig(f"{plot_filename}.pdf") fig.savefig("naidis_fit.pdf") - # plt.show() + plt.show()