From 4e32980578c5df0bb38df07193327d4305113bfc Mon Sep 17 00:00:00 2001 From: Michael Clerx Date: Sun, 24 Mar 2024 21:32:45 +0000 Subject: [PATCH] Updated script in akwaboah model --- c/akwaboah-2021-corrected.mmt | 38 ++++++++--------------------------- 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/c/akwaboah-2021-corrected.mmt b/c/akwaboah-2021-corrected.mmt index 98f8f03..9f55c68 100644 --- a/c/akwaboah-2021-corrected.mmt +++ b/c/akwaboah-2021-corrected.mmt @@ -1,6 +1,6 @@ [[model]] name: akwaboah-2021-corrected -version: 20240323 +version: 20240324 mmt_authors: Michael Clerx desc: """ Model of the hiPSC AP by Akwaboah et al [1], with corrections. @@ -722,38 +722,16 @@ ECa = (R * T / (2 * F)) * log(ext.Ca_o / calcium.Ca_i) import myokit import matplotlib.pyplot as plt -# Load model, create simulation +# Load model m = get_model() + +# Run simulation s = myokit.Simulation(m) +d = s.run(1000) # Create figure -fig = plt.figure(figsize=(10, 6)) -fig.subplots_adjust(0.07, 0.08, 0.99, 0.98, hspace=0.3, wspace=0.1) - -ax00 = fig.add_subplot(2, 2, 1) # Top-left: Vm before pacing -ax01 = fig.add_subplot(2, 2, 2) # Top-right: Vm after 1000s pacing -ax2 = fig.add_subplot(4, 1, 3) # Middle: [K]i during 999s pacing -ax3 = fig.add_subplot(4, 1, 4) # Bottom: [Na]i during 999s pacing - -ax00.set_ylabel('Vm (mV)') -ax2.set_ylabel('[K]i (mM)') -ax3.set_ylabel('[Na]i (mM)') -ax3.set_xlabel('Time (ms)') - -# Run for all three versions -for k, version in enumerate(('Python', 'C', 'Corrected')): - s.reset() - s.set_constant('mode.version', k) - d0 = s.run(1e3) - d1 = s.run(999e3, log=['engine.time', 'potassium.K_i', 'sodium.Na_i'], - log_interval=1e3) - d2 = s.run(1e3) - - ax00.plot(d0.time(), d0['membrane.V'], label=version) - ax01.plot(d2.time(), d2['membrane.V'], label=version) - ax2.plot(d1.time(), d1['potassium.K_i'], label=version) - ax3.plot(d1.time(), d1['sodium.Na_i'], label=version) - -ax00.legend(loc='lower left') +fig = plt.figure() +ax = fig.add_subplot() +ax.plot(d.time(), d['membrane.V']) plt.show()