Pacing simulations

Responses of calcium transients and electrophysiology to pacing frequencies.

using ModelingToolkit
using OrdinaryDiffEq, SteadyStateDiffEq, DiffEqCallbacks
using Plots
using CSV
using StatsBase: mean
using DataFrames
using CaMKIIModel
using CaMKIIModel: second
Plots.default(lw=1.5)

Setup the ODE system

Electrical stimulation starts at t=100 seconds and ends at t=300 seconds.

sys = build_neonatal_ecc_sys(simplify=true, reduce_iso=true, reduce_camk=true)
tend = 500.0second
prob = ODEProblem(sys, [], tend)
stimstart = 100.0second
stimend = 300.0second
@unpack Istim = sys
alg = KenCarp47()
KenCarp47(; linsolve = nothing, nlsolve = OrdinaryDiffEqNonlinearSolve.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Nothing}(1//100, 10, 1//5, 1//5, false, true, nothing), precs = DEFAULT_PRECS, smooth_est = true, extrapolant = linear, controller = PI, autodiff = ADTypes.AutoForwardDiff(),)

Single pulse

callback = build_stim_callbacks(Istim, stimstart + 1second; period=10second, starttime=stimstart)

@time sol = solve(prob, alg; callback)
  7.779888 seconds (20.95 M allocations: 948.687 MiB, 1.95% gc time, 99.70% compilation time)
retcode: Success
Interpolation: 3rd order Hermite
t: 133-element Vector{Float64}:
      0.0
      0.019333123284849377
      0.09098129546758026
      0.20735582943983927
      0.4561191027686269
      1.047256292840616
      2.0342667657223767
      3.4517766411484665
      6.733792423912831
     12.45011708102324
      ⋮
 242297.81044022518
 261866.02136598338
 283057.0918894953
 304248.16241300723
 334225.3903638194
 366081.5985343853
 404834.40053772146
 455953.36779008055
 500000.0
u: 133-element Vector{Vector{Float64}}:
 [150952.75035000002, 13838.37602, -68.79268, 0.12113, 0.12113, 0.12113, 0.12113, 0.12113, 0.12113, 0.12113  …  0.26081, 0.00977, 0.00188, 0.09243, 0.22156, 0.966, 0.00702, 830.0, 830.0, 0.0026]
 [150952.7504077194, 13838.375711519551, -68.79732946186226, 0.1211319185255175, 0.1211301421535992, 0.12113000811850358, 0.12113000037367234, 0.12113000001389383, 0.12113000000038378, 0.12113000000000405  …  0.2608055799112056, 0.009769882842069916, 0.001879826176081169, 0.09242766669618695, 0.2215639938807744, 0.9660018276402699, 0.007020208561323646, 829.9999654017583, 829.9994975880693, 0.0025985659590295374]
 [150952.75062244057, 13838.374513299192, -68.81607005265552, 0.12115248970210647, 0.12113624253259858, 0.12113143375871602, 0.12113027926811751, 0.12113004704056851, 0.12113000693481112, 0.12113000089551408  …  0.26078941009382306, 0.009769459049732313, 0.0018789042446514422, 0.09241901973901424, 0.2215787945110049, 0.9660085993318799, 0.00702008986027517, 829.9998348635061, 829.9976422525165, 0.002593310524681686]
 [150952.7509740238, 13838.372555328333, -68.84681913285226, 0.12118951551963696, 0.12115723910142134, 0.12114109135582982, 0.12113403405679991, 0.12113131833063846, 0.12113038966346883, 0.12113010483012127  …  0.2607638707001999, 0.009768805322556195, 0.0018766436937193197, 0.09240497563401104, 0.22160283236040595, 0.9660195931792828, 0.007017234889558555, 829.9996133960318, 829.9946506157202, 0.0025849478335103772]
 [150952.7517373371, 13838.368384399068, -68.91207316777846, 0.12125418995384042, 0.12120713813483534, 0.12117519662647318, 0.12115494411090462, 0.12114295934422188, 0.12113633873395535, 0.12113292110288301  …  0.2607122383588733, 0.00976754294689657, 0.001869919626294057, 0.0923749578279845, 0.2216542075240971, 0.9660430731013478, 0.007003014305234393, 829.9990964774663, 829.9883445519497, 0.0025677078010499796]
 [150952.75361533565, 13838.358559292059, -69.06429960994139, 0.12136450208851986, 0.12130632552358439, 0.12125925929399749, 0.12122229800810431, 0.12119414515426226, 0.12117335985880448, 0.1211584926966588  …  0.26060507831375035, 0.009765228548607825, 0.0018505337694469416, 0.09230364339951613, 0.22177624785138977, 0.9660987611411453, 0.006946470397388756, 829.9976227528975, 829.9738229154025, 0.0025298083713907]
 [150952.75694915713, 13838.34240329337, -69.31024285744344, 0.1214919651325425, 0.12142927821043346, 0.1213742637991964, 0.12132672249013038, 0.12128628091507475, 0.12125242557826563, 0.12122454121844704  …  0.26047114911179464, 0.009763403076884485, 0.0018178174419014655, 0.09218462776986637, 0.2219798989175973, 0.9661914345949096, 0.006833754172875444, 829.9944193668179, 829.9509077855928, 0.002474807978215895]
 [150952.76215620188, 13838.319723120678, -69.64637448767434, 0.12162015426876964, 0.12155743299711909, 0.12149988983034504, 0.12144759471003595, 0.12140052118634267, 0.12135855488207911, 0.12132150441596078  …  0.2603648729749554, 0.009765046552800477, 0.0017738156907532213, 0.09201383579531924, 0.22227216398019892, 0.9663239343003682, 0.0066755120626567415, 829.9883533251192, 829.9205247545176, 0.0024106893964811306]
 [150952.77598869594, 13838.2694938995, -70.35063788657429, 0.12180447948880603, 0.12174768443532381, 0.12169340184085989, 0.12164180995533579, 0.12159304920072045, 0.12154722283384199, 0.12150439833798565  …  0.26041507667541997, 0.009786689200123853, 0.00168558990949223, 0.09161908329520764, 0.22294828828976576, 0.9666286957812559, 0.006355039713677853, 829.9689941817725, 829.8589858006806, 0.002310655727734336]
 [150952.80529264064, 13838.18882346682, -71.35304509818073, 0.12196378364408182, 0.12191937753328343, 0.12187579038290358, 0.12183318573340753, 0.12179171693004423, 0.12175152667167381, 0.12171274673876382  …  0.26104417804603025, 0.009873892913308327, 0.0015688568862426027, 0.09093422465365385, 0.22412560303273427, 0.9671554512230358, 0.005926150085676066, 829.923524981244, 829.7704141396295, 0.0022289950402245157]
 ⋮
 [152010.58949237346, 12784.826177077044, -68.78460225483785, 0.1273645934686355, 0.12736474527713204, 0.12736489802921874, 0.1273650517736008, 0.1273652065609514, 0.12736536244401217, 0.12736551947769992  …  0.0014397404439769799, 0.0017714451482110758, 0.0027419992408620865, 0.0019134621506111172, 0.9996415271777961, 0.9996400877528016, 0.007030020877902041, 770.1872615642068, 769.9637778469413, 0.0012884710296940296]
 [152056.67459214322, 12738.883067609677, -68.6817973571413, 0.1268983348445864, 0.1268984739182113, 0.12689861388784757, 0.1268987547987449, 0.1268988966979811, 0.1268990396345554, 0.1268991836594876  …  0.001462855881261437, 0.001785015378538858, 0.0027629967328317165, 0.0019418061968068498, 0.9996334067353986, 0.9996320210166092, 0.007079301583949697, 769.1714875343318, 768.9540864908221, 0.0012547542413885594]
 [152102.2393402909, 12693.458557078215, -68.57877223960877, 0.1264460968718351, 0.12644622325188218, 0.12644635047247552, 0.12644647857523691, 0.12644660760347093, 0.12644673760225048, 0.12644686861850812  …  0.0014863497568594565, 0.001798715888970573, 0.0027841983156565507, 0.0019706225085497596, 0.9996250505203711, 0.9996237553189663, 0.007129031036620307, 768.1592296030556, 767.9476483340079, 0.0012224432753015866]
 [152143.68970297856, 12652.135526068578, -68.48382687634836, 0.12604235066720285, 0.1260424653546931, 0.126042580828574, 0.1260426971270927, 0.12604281429004244, 0.1260429323588414, 0.1260430513766164  …  0.0015083874613077035, 0.001811435145185111, 0.0028038785145390295, 0.0019975472790820913, 0.9996172014673438, 0.9996159752926306, 0.007175167317945887, 767.2328065837934, 767.026353499578, 0.0011939312800610532]
 [152196.01939343667, 12599.966090787919, -68.36223783531295, 0.12554335074896109, 0.12554345068340758, 0.1255435513255879, 0.1255436527092792, 0.12554375486962427, 0.12554385784320093, 0.1255439616680961  …  0.0015370613929775751, 0.001827853152494108, 0.002829282586725196, 0.0020325555533419167, 0.9996068941594669, 0.9996057746241293, 0.007234686013804997, 766.0572302145656, 765.8570259629754, 0.0011591284458185391]
 [152244.48022311382, 12551.652965938265, -68.24787701878653, 0.12509207556714486, 0.1250921617561929, 0.12509224857584825, 0.12509233605564304, 0.12509242422630346, 0.12509251311981073, 0.12509260276946582  …  0.0015645229183168402, 0.0018434282571495703, 0.0028533824346781444, 0.002066024171946039, 0.9995969441736026, 0.9995959343817608, 0.007291111309231223, 764.9647602275613, 764.7701208076015, 0.0011280815595747058]
 [152294.86525491078, 12501.420552712627, -68.12710647484873, 0.12463427177055854, 0.12463434376765481, 0.12463441630651204, 0.12463448941210749, 0.12463456311042798, 0.12463463742852138, 0.12463471239455134  …  0.0015940628483252276, 0.001860019085699677, 0.0028790533121337354, 0.0021019575317538257, 0.9995861612343045, 0.9995852740463936, 0.007351175216262395, 763.8272374862506, 763.6381586282951, 0.0010970014434255448]
 [152349.33113463258, 12447.118289038823, -67.99434591228592, 0.12415274905743695, 0.12415280584718641, 0.12415286307625284, 0.12415292076458015, 0.12415297893291827, 0.12415303760286424, 0.12415309679690598  …  0.0016271794454388465, 0.0018784258627409312, 0.0029075336281127596, 0.0021421594821333556, 0.9995739719339068, 0.999573231700278, 0.007417764650514616, 762.5986116091711, 762.4152877952291, 0.0010647732812346447]
 [152387.2812332033, 12409.281195755759, -67.90044030857347, 0.12382558801894229, 0.12382563426215205, 0.12382568087167, 0.12382572786390392, 0.12382577525592503, 0.12382582306550186, 0.12382587131113605  …  0.0016510210543221107, 0.00189155454655065, 0.0029278470621043906, 0.002171047242693882, 0.9995651319470018, 0.9995645032373359, 0.007465232287374384, 761.7448927694643, 761.5654239224716, 0.0010431509656260256]
plot(sol, idxs=(sys.t / 1000 - 100, sys.vm), title="Action potential (single pulse)", ylabel="mV", xlabel="Time (s)", label=false, tspan=(100second, 103second))

plot(sol, idxs=(sys.t / 1000 - 100, sys.Cai_mean), tspan=(100second, 103second), title="Calcium transient", ylabel="Conc. (μM)", xlabel="Time (s)", label="Avg Ca")

savefig("single-cat.pdf")
"/home/runner/work/camkii-cardiomyocyte-model/camkii-cardiomyocyte-model/docs/single-cat.pdf"

1Hz pacing

callback = build_stim_callbacks(Istim, stimend; period=1second, starttime=stimstart)
@time sol = solve(prob, alg; callback);
  2.379082 seconds (126.49 k allocations: 444.334 MiB, 18.00% gc time)
plot(sol, idxs=(sys.t / 1000, sys.vm), title="Action potential", ylabel="mV", xlabel="Time (s)", label=false)

plot(sol, idxs=(sys.t / 1000 - 299, sys.vm), title="Action potential", tspan=(299second, 300second), ylabel="mV", xlabel="Time (s)", label=false)

plot(sol, idxs=(sys.t / 1000 - 299, [sys.IK1, sys.Ito, sys.IKs, sys.IKr, sys.If]), tspan=(299second, 300second), ylabel="μA/μF", xlabel="Time (s)", label=["IK1" "Ito" "IKs" "IKr" "If"])

plot(sol, idxs=(sys.t / 1000 - 299, [sys.ICaL, sys.INaCa, sys.ICaT, sys.ICab]), tspan=(299second, 300second), ylabel="μA/μF", xlabel="Time (s)", label=["ICaL" "INaCa" "ICaT" "ICab"])

plot(sol, idxs=(sys.t / 1000 - 299, [sys.Cai_sub_SR, sys.Cai_sub_SL, sys.Cai_mean]), tspan=(299second, 300second), title="Calcium transient", ylabel="μM", xlabel="Time (s)", label=["CaSR" "CaSL" "CaAvg"])

plot(sol, idxs=(sys.t / 1000, sys.CaMKAct * 100), title="Active CaMKII", ylabel="Active CaMKII (%)", xlabel="Time (s)", label=false)

3D surface plot

xx = 1:44
yy = range(299second, 300second, length=100)
zz = [sol(t, idxs=sys.Cai[u]) for t in yy, u in xx]

surface(xx, (yy .- 299second) ./ 1000, zz, colorbar=:none, yguide="(sec.)", zguide="Ca Conc. (μM)", xticks=false, size=(600, 600))
annotate!(3, 0, 0.65, "Ca (SL)")
annotate!(41, 0.25, 0.58, "Ca (SR)")

savefig("3d-surface.pdf")
savefig("3d-surface.png")
"/home/runner/work/camkii-cardiomyocyte-model/camkii-cardiomyocyte-model/docs/3d-surface.png"

Mean calcium

xx = 1:44
yy = [sol(299.22second, idxs=sys.Cai[u]) for u in xx]
avg = mean(yy)

plot(xx, yy, label="Cai", ylabel="Ca Conc. (μM)", xlabel="Compartment (SL to SR)", legend=:topright)
hline!([avg], linestyle=:dash, label="Avg Cai")

savefig("cai-spatial.pdf")
savefig("cai-spatial.png")
"/home/runner/work/camkii-cardiomyocyte-model/camkii-cardiomyocyte-model/docs/cai-spatial.png"

2Hz pacing

callback = build_stim_callbacks(Istim, stimend; period=1 / 2 * second, starttime=stimstart)
@time sol2 = solve(prob, alg; callback)
  3.525754 seconds (205.32 k allocations: 725.857 MiB, 13.20% gc time)
retcode: Success
Interpolation: 3rd order Hermite
t: 14155-element Vector{Float64}:
      0.0
      0.019333123284849377
      0.09098129546758026
      0.20735582943983927
      0.4561191027686269
      1.047256292840616
      2.0342667657223767
      3.4517766411484665
      6.733792423912831
     12.45011708102324
      ⋮
 396946.47340258106
 407725.1060271269
 418503.7386516727
 430099.30250868935
 442809.40361974895
 457689.5869851249
 472569.7703505009
 489876.87020319374
 500000.0
u: 14155-element Vector{Vector{Float64}}:
 [150952.75035000002, 13838.37602, -68.79268, 0.12113, 0.12113, 0.12113, 0.12113, 0.12113, 0.12113, 0.12113  …  0.26081, 0.00977, 0.00188, 0.09243, 0.22156, 0.966, 0.00702, 830.0, 830.0, 0.0026]
 [150952.7504077194, 13838.375711519551, -68.79732946186226, 0.1211319185255175, 0.1211301421535992, 0.12113000811850358, 0.12113000037367234, 0.12113000001389383, 0.12113000000038378, 0.12113000000000405  …  0.2608055799112056, 0.009769882842069916, 0.001879826176081169, 0.09242766669618695, 0.2215639938807744, 0.9660018276402699, 0.007020208561323646, 829.9999654017583, 829.9994975880693, 0.0025985659590295374]
 [150952.75062244057, 13838.374513299192, -68.81607005265552, 0.12115248970210647, 0.12113624253259858, 0.12113143375871602, 0.12113027926811751, 0.12113004704056851, 0.12113000693481112, 0.12113000089551408  …  0.26078941009382306, 0.009769459049732313, 0.0018789042446514422, 0.09241901973901424, 0.2215787945110049, 0.9660085993318799, 0.00702008986027517, 829.9998348635061, 829.9976422525165, 0.002593310524681686]
 [150952.7509740238, 13838.372555328333, -68.84681913285226, 0.12118951551963696, 0.12115723910142134, 0.12114109135582982, 0.12113403405679991, 0.12113131833063846, 0.12113038966346883, 0.12113010483012127  …  0.2607638707001999, 0.009768805322556195, 0.0018766436937193197, 0.09240497563401104, 0.22160283236040595, 0.9660195931792828, 0.007017234889558555, 829.9996133960318, 829.9946506157202, 0.0025849478335103772]
 [150952.7517373371, 13838.368384399068, -68.91207316777846, 0.12125418995384042, 0.12120713813483534, 0.12117519662647318, 0.12115494411090462, 0.12114295934422188, 0.12113633873395535, 0.12113292110288301  …  0.2607122383588733, 0.00976754294689657, 0.001869919626294057, 0.0923749578279845, 0.2216542075240971, 0.9660430731013478, 0.007003014305234393, 829.9990964774663, 829.9883445519497, 0.0025677078010499796]
 [150952.75361533565, 13838.358559292059, -69.06429960994139, 0.12136450208851986, 0.12130632552358439, 0.12125925929399749, 0.12122229800810431, 0.12119414515426226, 0.12117335985880448, 0.1211584926966588  …  0.26060507831375035, 0.009765228548607825, 0.0018505337694469416, 0.09230364339951613, 0.22177624785138977, 0.9660987611411453, 0.006946470397388756, 829.9976227528975, 829.9738229154025, 0.0025298083713907]
 [150952.75694915713, 13838.34240329337, -69.31024285744344, 0.1214919651325425, 0.12142927821043346, 0.1213742637991964, 0.12132672249013038, 0.12128628091507475, 0.12125242557826563, 0.12122454121844704  …  0.26047114911179464, 0.009763403076884485, 0.0018178174419014655, 0.09218462776986637, 0.2219798989175973, 0.9661914345949096, 0.006833754172875444, 829.9944193668179, 829.9509077855928, 0.002474807978215895]
 [150952.76215620188, 13838.319723120678, -69.64637448767434, 0.12162015426876964, 0.12155743299711909, 0.12149988983034504, 0.12144759471003595, 0.12140052118634267, 0.12135855488207911, 0.12132150441596078  …  0.2603648729749554, 0.009765046552800477, 0.0017738156907532213, 0.09201383579531924, 0.22227216398019892, 0.9663239343003682, 0.0066755120626567415, 829.9883533251192, 829.9205247545176, 0.0024106893964811306]
 [150952.77598869594, 13838.2694938995, -70.35063788657429, 0.12180447948880603, 0.12174768443532381, 0.12169340184085989, 0.12164180995533579, 0.12159304920072045, 0.12154722283384199, 0.12150439833798565  …  0.26041507667541997, 0.009786689200123853, 0.00168558990949223, 0.09161908329520764, 0.22294828828976576, 0.9666286957812559, 0.006355039713677853, 829.9689941817725, 829.8589858006806, 0.002310655727734336]
 [150952.80529264064, 13838.18882346682, -71.35304509818073, 0.12196378364408182, 0.12191937753328343, 0.12187579038290358, 0.12183318573340753, 0.12179171693004423, 0.12175152667167381, 0.12171274673876382  …  0.26104417804603025, 0.009873892913308327, 0.0015688568862426027, 0.09093422465365385, 0.22412560303273427, 0.9671554512230358, 0.005926150085676066, 829.923524981244, 829.7704141396295, 0.0022289950402245157]
 ⋮
 [151294.43022037976, 13498.845496712365, -70.2275613215151, 0.13564857175026923, 0.13564889442939032, 0.13564921764570131, 0.13564954147318198, 0.13564986598880402, 0.13565019127268374, 0.1356505174082442  …  0.001151590757677053, 0.0015913961299787757, 0.002463370837529016, 0.0015558161353002127, 0.9997383416008482, 0.9997363083653836, 0.006373225839973145, 784.1583562674745, 783.8141620478489, 0.0019503151835948249]
 [151354.19149470908, 13439.255625639173, -70.11690916394949, 0.13488798327544016, 0.13488829414858458, 0.1348886056785583, 0.13488891793943628, 0.13488923100828912, 0.1348895449653354, 0.13488985989410418  …  0.001171477012213465, 0.0016045371376300485, 0.0024837078487784823, 0.0015807528751824397, 0.999731955436176, 0.9997299431666522, 0.006421352700076259, 783.156556277576, 782.8243574716604, 0.0018849492130231377]
 [151411.11386948, 13382.498172140731, -70.01003249266401, 0.13417462966939936, 0.13417492886054683, 0.13417522880781838, 0.13417552958499812, 0.13417583126885366, 0.134176133939288, 0.1341764376795013  …  0.0011910109203125984, 0.0016173313352272388, 0.0025035080409409427, 0.0016052092310154058, 0.999725638099974, 0.9997236494311558, 0.006468178031748051, 782.1712489582524, 781.8501454947431, 0.0018244359900702614]
 [151469.3399252231, 13324.442421186572, -69.89915951056128, 0.13345630533533157, 0.13345659212627808, 0.13345687976032722, 0.13345716831056997, 0.13345745785305296, 0.13345774846692937, 0.1334580402346189  …  0.0012116212078780938, 0.0016307127574585977, 0.0025242170370571746, 0.0016309718604706617, 0.9997189258371286, 0.9997169644988836, 0.006517128170282748, 781.1326136643222, 780.8225273593101, 0.001764292568157017]
 [151529.7719373307, 13264.188790752774, -69.78239470721563, 0.1327231032883945, 0.1327233767226942, 0.1327236510743162, 0.1327239264152147, 0.13272420282025396, 0.13272448036735707, 0.1327247591376633  …  0.0012337155323751902, 0.0016449222874531605, 0.0025462069045096396, 0.0016585418027576166, 0.9997116772734145, 0.9997097494203031, 0.006569067719392741, 780.0225487214705, 779.7235430617752, 0.001703737286591129]
 [151596.24452370364, 13197.914184139254, -69.65189263880765, 0.1319313890222816, 0.13193164722549108, 0.13193190641001978, 0.13193216664613583, 0.1319324280069487, 0.1319326905685539, 0.13193295441018682  …  0.0012588823967753695, 0.0016609484722741805, 0.0025710081140527794, 0.001689892214365404, 0.9997033562084353, 0.9997014673562904, 0.0066276029866558, 778.7652173291091, 778.4779849168723, 0.0016393187224541953]
 [151658.41009743634, 13135.935311518539, -69.52782686587057, 0.13120521016414158, 0.1312054536257826, 0.13120569811034385, 0.13120594368604796, 0.13120619042387535, 0.13120643839770527, 0.13120668768446506  …  0.0012832888577827908, 0.0016763274402779868, 0.0025948073713060998, 0.0017202350769508358, 0.9996952192243045, 0.9996933745573925, 0.0066837328996629695, 777.5560678288311, 777.2794545187509, 0.0015811324483540675]
 [151725.67218572056, 13068.87673473015, -69.39131582750089, 0.1304353060653264, 0.1304355330744608, 0.13043576113092833, 0.13043599030022102, 0.13043622065047797, 0.1304364522526206, 0.1304366851804961  …  0.0013106890141691332, 0.001693410672810579, 0.002621243789649118, 0.0017542342794683368, 0.999686006233132, 0.9996842169738318, 0.00674603310011374, 776.2133946626298, 775.9478476884939, 0.0015204017748230176]
 [151762.65564121996, 13032.005759084892, -69.31520923025212, 0.13001909000276407, 0.13001930769214734, 0.13001952643579723, 0.1300197462975143, 0.13001996734367877, 0.13002018964338152, 0.13002041326856426  …  0.0013262199832002348, 0.001703010880029982, 0.0026361003955646693, 0.001773473859648619, 0.9996807491582035, 0.9996789929053593, 0.00678103066623592, 775.4607393269297, 775.2010905472812, 0.0014879919074429209]
plot(sol2, idxs=(sys.t / 1000, sys.vm), title="Action potential", ylabel="mV", xlabel="Time (s)", label=false)

plot(sol2, idxs=(sys.t / 1000 - 299, sys.vm), title="Action potential", tspan=(299second, 300second), ylabel="mV", xlabel="Time (s)", label=false)

plot(sol2, idxs=(sys.t / 1000 - 299, [sys.Cai_sub_SR, sys.Cai_sub_SL, sys.Cai_mean]), tspan=(299second, 300second), title="Calcium transient", ylabel="Concentration (μM)", xlabel="Time (s)", label=["CaSSR" "CaSL" "CaAvg"])

plot(sol2, idxs=(sys.t / 1000, sys.CaMKAct * 100), title="Active CaMKII", ylabel="Active CaMKII (%)", xlabel="Time (s)", label=false)

Comparing 1 and 2 Hz pacing

idxs = (sys.t / 1000 - 299, sys.vm)
plot(sol, idxs=idxs, title="Action potential", lab="1Hz", tspan=(299second, 300second))
plot!(sol2, idxs=idxs, lab="2Hz", tspan=(299second, 300second), xlabel="Time (s)", ylabel="Voltage (mV)")

savefig("bcl-ap.pdf")
"/home/runner/work/camkii-cardiomyocyte-model/camkii-cardiomyocyte-model/docs/bcl-ap.pdf"
idxs = (sys.t / 1000 - 299, sys.Cai_mean)
plot(sol, idxs=idxs, title="Calcium transient", lab="1Hz", tspan=(299second, 300second))
plot!(sol2, idxs=idxs, lab="2Hz", tspan=(299second, 300second), xlabel="Time (s)", ylabel="Concentration (μM)")

savefig("bcl-cat.pdf")
"/home/runner/work/camkii-cardiomyocyte-model/camkii-cardiomyocyte-model/docs/bcl-cat.pdf"
idxs = (sys.t / 1000, sys.CaMKAct * 100)
plot(sol, idxs=idxs, title="CaMKII", lab="1Hz")
plot!(sol2, idxs=idxs, lab="2Hz", xlabel="Time (s)", ylabel="Active fraction (%)")

savefig("bcl-camkact.pdf")
"/home/runner/work/camkii-cardiomyocyte-model/camkii-cardiomyocyte-model/docs/bcl-camkact.pdf"

Runtime information

using InteractiveUtils
InteractiveUtils.versioninfo()
Julia Version 1.12.4
Commit 01a2eadb047 (2026-01-06 16:56 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 4 × Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, icelake-server)
  GC: Built with stock GC
Threads: 4 default, 1 interactive, 4 GC (on 4 virtual cores)
Environment:
  JULIA_CPU_TARGET = generic;icelake-server,clone_all;znver3,clone_all
  JULIA_CONDAPKG_OFFLINE = true
  JULIA_CONDAPKG_BACKEND = Null
  JULIA_CI = true
  LD_LIBRARY_PATH = /opt/hostedtoolcache/Python/3.14.2/x64/lib
  JULIA_NUM_THREADS = auto
using Pkg
Pkg.status()
Project CaMKIIModel v0.7.0
Status `~/work/camkii-cardiomyocyte-model/camkii-cardiomyocyte-model/Project.toml`
  [336ed68f] CSV v0.10.15
  [a93c6f00] DataFrames v1.8.1
  [459566f4] DiffEqCallbacks v4.11.0
  [f6369f11] ForwardDiff v1.3.1
  [682c06a0] JSON v1.3.0
  [23fbe1c1] Latexify v0.16.10
  [98b081ad] Literate v2.21.0
  [2fda8390] LsqFit v0.15.1
⌅ [961ee093] ModelingToolkit v10.31.2
  [77ba4419] NaNMath v1.1.3
  [1dea7af3] OrdinaryDiffEq v6.105.0
  [91a5bcdd] Plots v1.41.4
  [2913bbd2] StatsBase v0.34.9
  [9672c7b4] SteadyStateDiffEq v2.8.0
  [ea8e919c] SHA v0.7.0
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated`

This notebook was generated using Literate.jl.

Back to top