Skip to content

Commit

Permalink
Updated script in akwaboah model
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelClerx committed Mar 24, 2024
1 parent fcafa50 commit 4e32980
Showing 1 changed file with 8 additions and 30 deletions.
38 changes: 8 additions & 30 deletions c/akwaboah-2021-corrected.mmt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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()

0 comments on commit 4e32980

Please sign in to comment.