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)
 10.250276 seconds (23.61 M allocations: 1.090 GiB, 2.58% gc time, 99.75% compilation time)
retcode: Success
Interpolation: 3rd order Hermite
t: 133-element Vector{Float64}:
      0.0
      0.019333125036189135
      0.09098129266634847
      0.2073558192440938
      0.45611905918185225
      1.0472561699066012
      2.034266647380669
      3.451776427609829
      6.733791989961038
     12.450116263175316
      ⋮
 225968.185470419
 245860.35062649893
 273090.82323644345
 300321.295846388
 339559.0539057869
 378796.8119651858
 424814.2733577976
 479743.0271942651
 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.375711519522, -68.79732946230298, 0.12113191852582894, 0.12113014215363435, 0.12113000811850629, 0.12113000037367251, 0.12113000001389385, 0.12113000000038378, 0.12113000000000405  …  0.2608055799108062, 0.009769882842059355, 0.001879826176063952, 0.09242766669597557, 0.22156399388113623, 0.9660018276404354, 0.007020208561337872, 829.9999654017552, 829.9994975880237, 0.002598565958899963]
 [150952.75062244057, 13838.374513299239, -68.81607005191516, 0.12115248970118196, 0.1211362425322048, 0.12113143375859055, 0.12113027926808573, 0.12113004704056185, 0.12113000693480994, 0.12113000089551389  …  0.26078941009444856, 0.009769459049748559, 0.0018789042446954408, 0.09241901973935228, 0.22157879451042628, 0.9660085993316152, 0.007020089860306167, 829.9998348635114, 829.9976422525888, 0.0025933105248854755]
 [150952.75097402377, 13838.372555328504, -68.84681913016406, 0.12118951551659114, 0.12115723909937218, 0.12114109135468039, 0.12113403405625273, 0.12113131833041359, 0.12113038966338784, 0.12113010483009534  …  0.26076387070239837, 0.009768805322611648, 0.0018766436939500898, 0.0924049756352414, 0.2216028323583001, 0.9660195931783199, 0.007017234889934603, 829.9996133960518, 829.994650615981, 0.0025849478342343003]
 [150952.75173733698, 13838.368384399799, -68.91207315641022, 0.12125418994387863, 0.12120713812645283, 0.12117519662003212, 0.12115494410637355, 0.12114295934129514, 0.12113633873221374, 0.12113292110192488  …  0.26071223836757207, 0.009767542947102269, 0.0018699196276109342, 0.09237495783324366, 0.22165420751509649, 0.9660430730972362, 0.007003014308459902, 829.9990964775621, 829.988344553044, 0.0025677078039993283]
 [150952.7536153353, 13838.35855929409, -69.06429957869561, 0.12136450206928298, 0.12130632550551596, 0.12125925927771784, 0.12122229799402218, 0.12119414514255993, 0.12117335984945683, 0.12115849268947793  …  0.2606050783338445, 0.009765228548992247, 0.0018505337735948652, 0.09230364341434424, 0.22177624782601593, 0.9660987611295794, 0.006946470410797191, 829.9976227532394, 829.9738229183572, 0.0025298083788575705]
 [150952.75694915676, 13838.342403295292, -69.31024282857501, 0.12149196511970106, 0.12142927819778737, 0.12137426378703478, 0.12132672247869893, 0.1212862809045654, 0.12125242556881116, 0.12122454121012068  …  0.2604711491247151, 0.00976340307695454, 0.0018178174457210692, 0.09218462778413179, 0.2219798988931877, 0.9661914345838197, 0.0068337541864747905, 829.9944193672545, 829.9509077882478, 0.0024748079842550523]
 [150952.7621562011, 13838.31972312405, -69.6463744385697, 0.12162015425254309, 0.12155743298067635, 0.1214998898139605, 0.12144759469396454, 0.12140052117081253, 0.12135855486728582, 0.12132150440206332  …  0.260364872984163, 0.009765046552185823, 0.0017738156970858972, 0.09201383582103524, 0.22227216393618593, 0.9663239342804539, 0.006675512085568874, 829.988353326151, 829.9205247588947, 0.002410689405003596]
 [150952.775988694, 13838.26949390594, -70.35063780004249, 0.1218044794708126, 0.12174768441638649, 0.12169340182120132, 0.12164180993517575, 0.12159304918027178, 0.1215472228133069, 0.12150439831755229  …  0.2604150766477604, 0.009786689195736801, 0.0016855899200154505, 0.09161908334733312, 0.22294828820039625, 0.9666286957411055, 0.006355039752058078, 829.9689941847354, 829.8589858081657, 0.0023106557375668943]
 [150952.805292636, 13838.188823477813, -71.35304497334123, 0.1219637836290695, 0.12191937751661326, 0.12187579036470503, 0.12183318571381517, 0.121791716909196, 0.12175152664970906, 0.12171274671582151  …  0.2610441779341529, 0.009873892897153878, 0.0015688569001333977, 0.0909342247513693, 0.22412560286423527, 0.9671554511479012, 0.005926150137179693, 829.9235249884752, 829.7704141511887, 0.0022289950468852237]
 ⋮
 [151968.93791866137, 12826.3493307134, -68.87634267157956, 0.12779351614142634, 0.12779367941166456, 0.12779384366133986, 0.12779400894209025, 0.12779417530764095, 0.12779434281391122, 0.12779451151912719  …  0.0014194648485285645, 0.0017594222489997306, 0.0027233940873830943, 0.001888509818836884, 0.9996486534845933, 0.9996471367118032, 0.006986331213351137, 771.0971049890783, 770.8679527168616, 0.0013198457012457022]
 [152019.29808235914, 12776.144324749974, -68.76528434187523, 0.1272758079293238, 0.12727595736979813, 0.12727610774595344, 0.12727625910584392, 0.12727641149946606, 0.12727656497885792, 0.12727671959820394  …  0.0014440870677240533, 0.0017739862560765072, 0.002745931716199183, 0.001918757022215836, 0.9996400281682031, 0.9996385859075916, 0.007039253172767109, 769.9959635638816, 769.7736444359258, 0.0012820195623651318]
 [152081.36038860283, 12714.273166732419, -68.62615581314591, 0.12665221459242734, 0.12665234676906717, 0.12665247981374972, 0.1266526137697895, 0.12665274868225176, 0.12665288459804186, 0.12665302156600008  …  0.0014755271792005974, 0.0017924022944998442, 0.0027744270914758563, 0.0019573175047187708, 0.9996289203097624, 0.9996275805753339, 0.007106115966203564, 768.6239755763374, 768.4097516287044, 0.0012371223020027672]
 [152136.31373568706, 12659.488752194511, -68.50080897182936, 0.12611363908430157, 0.12611375582228596, 0.12611387335744165, 0.12611399172863672, 0.12611411097631015, 0.12611423114255216, 0.12611435227118942  …  0.0015044336718198531, 0.001809154104739471, 0.002800348487183211, 0.0019927054705572112, 0.9996186193417534, 0.999617378714572, 0.00716689401306199, 767.3980037410549, 767.1906499111235, 0.001198942915061434]
 [152204.62903971208, 12591.382639528178, -68.34204596969609, 0.12546239142596538, 0.12546248888470604, 0.12546258703880928, 0.12546268592132398, 0.12546278556663487, 0.12546288601053054, 0.12546298729027594  …  0.0015418808288337397, 0.001830594356939855, 0.0028335232086145233, 0.0020384253917063266, 0.9996051542039589, 0.9996040548583062, 0.0072446171112055145, 765.8633361584318, 765.6641362417689, 0.0011535297056664787]
 [152261.9812604452, 12534.204962956697, -68.20614122356393, 0.12493174967312616, 0.12493183091978136, 0.12493191276637727, 0.12493199524087238, 0.12493207837235487, 0.12493216219110079, 0.12493224672863477  …  0.0015746554253863194, 0.0018491463859889965, 0.002862228996193076, 0.0020783749801856514, 0.9995932517451369, 0.9995922811604967, 0.00731181436610176, 764.5697143992079, 764.3770322227066, 0.0011171477019481673]
 [152317.63870284663, 12478.715631223433, -68.07187662777716, 0.12443123344074972, 0.12443129905387883, 0.12443136516660629, 0.1244314318018155, 0.12443149898331383, 0.12443156673588122, 0.1244316350853195  …  0.0016077462098278857, 0.0018676559606920237, 0.0028908687427421933, 0.002118592433502934, 0.9995811352845655, 0.999580305759473, 0.00737880744402946, 763.3131553753694, 763.1265149018922, 0.0010833535637424978]
 [152370.7532592129, 12425.75999351687, -67.94147967983385, 0.12396722913472318, 0.12396727998545705, 0.12396733123365258, 0.12396738289724998, 0.12396743499491454, 0.12396748754607355, 0.1239675405709557  …  0.001640567448670273, 0.0018858070162628717, 0.002918952979521359, 0.0021583769601260477, 0.9995690167221079, 0.9995683392133281, 0.007444452681683283, 762.1163037940552, 761.9351713315386, 0.0010524846070922892]
 [152387.29094230235, 12409.271428734324, -67.90040663950961, 0.12382559518794825, 0.12382564156422099, 0.12382568830335723, 0.12382573542172153, 0.12382578293634011, 0.12382583086493484, 0.1238258792259588  …  0.001650929999904272, 0.0018915573828061796, 0.002927855266407584, 0.0021710631364190557, 0.9995651356308054, 0.9995644988617285, 0.007465250324224651, 761.7446965774758, 761.5652273681827, 0.001043150697863048]
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/github/actions-runner-1/_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);
  1.455669 seconds (77.70 k allocations: 18.125 MiB)
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/github/actions-runner-1/_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/github/actions-runner-1/_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)
  2.398355 seconds (125.60 k allocations: 29.454 MiB)
retcode: Success
Interpolation: 3rd order Hermite
t: 14157-element Vector{Float64}:
      0.0
      0.019333125036189135
      0.09098129266634847
      0.2073558192440938
      0.45611905918185225
      1.0472561699066012
      2.034266647380669
      3.451776427609829
      6.733791989961038
     12.450116263175316
      ⋮
 396946.35997235385
 407724.9857742748
 418503.61157619575
 430099.16586578905
 442809.2558932126
 457689.4227457195
 472569.58959822636
 489876.6679229509
 500000.0
u: 14157-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.375711519522, -68.79732946230298, 0.12113191852582894, 0.12113014215363435, 0.12113000811850629, 0.12113000037367251, 0.12113000001389385, 0.12113000000038378, 0.12113000000000405  …  0.2608055799108062, 0.009769882842059355, 0.001879826176063952, 0.09242766669597557, 0.22156399388113623, 0.9660018276404354, 0.007020208561337872, 829.9999654017552, 829.9994975880237, 0.002598565958899963]
 [150952.75062244057, 13838.374513299239, -68.81607005191516, 0.12115248970118196, 0.1211362425322048, 0.12113143375859055, 0.12113027926808573, 0.12113004704056185, 0.12113000693480994, 0.12113000089551389  …  0.26078941009444856, 0.009769459049748559, 0.0018789042446954408, 0.09241901973935228, 0.22157879451042628, 0.9660085993316152, 0.007020089860306167, 829.9998348635114, 829.9976422525888, 0.0025933105248854755]
 [150952.75097402377, 13838.372555328504, -68.84681913016406, 0.12118951551659114, 0.12115723909937218, 0.12114109135468039, 0.12113403405625273, 0.12113131833041359, 0.12113038966338784, 0.12113010483009534  …  0.26076387070239837, 0.009768805322611648, 0.0018766436939500898, 0.0924049756352414, 0.2216028323583001, 0.9660195931783199, 0.007017234889934603, 829.9996133960518, 829.994650615981, 0.0025849478342343003]
 [150952.75173733698, 13838.368384399799, -68.91207315641022, 0.12125418994387863, 0.12120713812645283, 0.12117519662003212, 0.12115494410637355, 0.12114295934129514, 0.12113633873221374, 0.12113292110192488  …  0.26071223836757207, 0.009767542947102269, 0.0018699196276109342, 0.09237495783324366, 0.22165420751509649, 0.9660430730972362, 0.007003014308459902, 829.9990964775621, 829.988344553044, 0.0025677078039993283]
 [150952.7536153353, 13838.35855929409, -69.06429957869561, 0.12136450206928298, 0.12130632550551596, 0.12125925927771784, 0.12122229799402218, 0.12119414514255993, 0.12117335984945683, 0.12115849268947793  …  0.2606050783338445, 0.009765228548992247, 0.0018505337735948652, 0.09230364341434424, 0.22177624782601593, 0.9660987611295794, 0.006946470410797191, 829.9976227532394, 829.9738229183572, 0.0025298083788575705]
 [150952.75694915676, 13838.342403295292, -69.31024282857501, 0.12149196511970106, 0.12142927819778737, 0.12137426378703478, 0.12132672247869893, 0.1212862809045654, 0.12125242556881116, 0.12122454121012068  …  0.2604711491247151, 0.00976340307695454, 0.0018178174457210692, 0.09218462778413179, 0.2219798988931877, 0.9661914345838197, 0.0068337541864747905, 829.9944193672545, 829.9509077882478, 0.0024748079842550523]
 [150952.7621562011, 13838.31972312405, -69.6463744385697, 0.12162015425254309, 0.12155743298067635, 0.1214998898139605, 0.12144759469396454, 0.12140052117081253, 0.12135855486728582, 0.12132150440206332  …  0.260364872984163, 0.009765046552185823, 0.0017738156970858972, 0.09201383582103524, 0.22227216393618593, 0.9663239342804539, 0.006675512085568874, 829.988353326151, 829.9205247588947, 0.002410689405003596]
 [150952.775988694, 13838.26949390594, -70.35063780004249, 0.1218044794708126, 0.12174768441638649, 0.12169340182120132, 0.12164180993517575, 0.12159304918027178, 0.1215472228133069, 0.12150439831755229  …  0.2604150766477604, 0.009786689195736801, 0.0016855899200154505, 0.09161908334733312, 0.22294828820039625, 0.9666286957411055, 0.006355039752058078, 829.9689941847354, 829.8589858081657, 0.0023106557375668943]
 [150952.805292636, 13838.188823477813, -71.35304497334123, 0.1219637836290695, 0.12191937751661326, 0.12187579036470503, 0.12183318571381517, 0.121791716909196, 0.12175152664970906, 0.12171274671582151  …  0.2610441779341529, 0.009873892897153878, 0.0015688569001333977, 0.0909342247513693, 0.22412560286423527, 0.9671554511479012, 0.005926150137179693, 829.9235249884752, 829.7704141511887, 0.0022289950468852237]
 ⋮
 [151294.433099115, 13498.842703870641, -70.22755618184227, 0.13564853577702168, 0.1356488584555999, 0.13564918167137394, 0.13564950549832364, 0.13564983001342068, 0.13565015529678134, 0.13565048143182876  …  0.0011515916734828986, 0.0015913967379185669, 0.0024633717783801557, 0.0015558172846263853, 0.9997383413078001, 0.9997363080732244, 0.006373228067277308, 784.1583100433876, 783.814116395077, 0.0019503120715763087]
 [151354.19420334432, 13439.253002492358, -70.11690426780343, 0.13488795000641443, 0.1348882608790284, 0.13488857240847651, 0.13488888466883386, 0.134889197737171, 0.13488951169370647, 0.13488982662196933  …  0.0011714778997270765, 0.0016045377215039335, 0.0024837087523778213, 0.001580753987214195, 0.9997319551501551, 0.9997299428816093, 0.0064213548378238006, 783.1565113710683, 782.8243130861404, 0.001884946372827718]
 [151411.11641793043, 13382.495708785875, -70.01002783151426, 0.13417459889685127, 0.13417489808748193, 0.13417519803424058, 0.13417549881091148, 0.13417580049426212, 0.13417610316419556, 0.13417640690391186  …  0.001191011779363847, 0.001617331895474334, 0.002503508907967861, 0.0016052103056997126, 0.9997256378212201, 0.9997236491534587, 0.0064681800817270345, 782.171205476479, 781.8501024883045, 0.00182443339648492]
 [151469.34230083844, 13324.440130226201, -69.89915511388243, 0.13345627716926942, 0.13345656395971753, 0.13345685159327145, 0.13345714014302204, 0.133457429685016, 0.1334577202984064, 0.133458012065613  …  0.0012116220322422333, 0.0016307132902277917, 0.0025242178615493796, 0.0016309728900818178, 0.9997189255677189, 0.9997169642306044, 0.006517130118393648, 781.1325720052721, 780.8224861291436, 0.0017642902257018387]
 [151529.77413356834, 13264.186678699503, -69.78239059303546, 0.1327230777615251, 0.13272335119534862, 0.13272362554649686, 0.13272390088692387, 0.13272417729149394, 0.13272445483813003, 0.13272473360797143  …  0.0012337163178489808, 0.0016449227902860534, 0.0025462076826685805, 0.0016585427821168399, 0.9997116770147796, 0.9997097491628607, 0.006569069556773318, 780.0225091795579, 779.7235039026924, 0.0017037351933072578]
 [151596.2465111836, 13197.912280276701, -69.65188886803128, 0.13193136645407436, 0.13193162465683825, 0.1319318838409229, 0.13193214407659645, 0.13193240543696824, 0.13193266799813366, 0.13193293183932814  …  0.0012588831314433657, 0.0016609489375790229, 0.0025710088341273163, 0.0016898931285749352, 0.9997033559644787, 0.9997014671136001, 0.006627604685634913, 778.7651805942892, 778.4779485147646, 0.0016393169006806724]
 [151658.41189441687, 13135.933597624971, -69.52782341735232, 0.13120519022655952, 0.13120543368778598, 0.13120567817193363, 0.13120592374722498, 0.1312061704846404, 0.13120641845805908, 0.13120666774440828  …  0.0012832895427149263, 0.001676327869710939, 0.0025948080358615157, 0.0017202359276864909, 0.9996952189950367, 0.9996933743294271, 0.006683734466549797, 777.556033880584, 777.2794208596608, 0.0015811308628416237]
 [151725.67377341233, 13068.875229527343, -69.39131274589532, 0.13043528892142994, 0.13043551593018796, 0.1304357439862796, 0.13043597315519675, 0.13043620350507815, 0.13043643510684552, 0.13043666803434595  …  0.001310689639367462, 0.0016934110604342656, 0.0026212443894967313, 0.0017542350543941923, 0.9996860060220164, 0.9996842167640255, 0.0067460345133910846, 776.2133640551177, 775.9478173251572, 0.00152040043375649]
 [151762.65788403733, 13032.003600768106, -69.31520476340353, 0.13001906573958336, 0.13001928342841831, 0.13001950217152, 0.13001972203268902, 0.13001994307830533, 0.13002016537745975, 0.13002038900209387  …  0.001326220900161864, 0.0017030114450090675, 0.002636101269855324, 0.0017734749949406443, 0.9996807488470206, 0.9996789925962177, 0.006781032725035116, 775.4606948906832, 775.2010464531234, 0.001487990026769612]
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/github/actions-runner-1/_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/github/actions-runner-1/_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/github/actions-runner-1/_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: 12 × Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, skylake)
  GC: Built with stock GC
Threads: 2 default, 1 interactive, 2 GC (on 12 virtual cores)
Environment:
  JULIA_CI = true
  JULIA_CONDAPKG_OFFLINE = true
  LD_LIBRARY_PATH = /home/github/actions-runner-1/_work/_tool/Python/3.14.2/x64/lib
  JULIA_NUM_THREADS = 2
  JULIA_PROJECT = /home/github/actions-runner-1/_work/camkii-cardiomyocyte-model/camkii-cardiomyocyte-model/Project.toml
  JULIA_DEPOT_PATH = /home/github/.julia:/home/github/actions-runner-1/_work/_tool/julia/1.12.4/x64/local/share/julia:/home/github/actions-runner-1/_work/_tool/julia/1.12.4/x64/share/julia
  JULIA_CONDAPKG_BACKEND = Null
  JULIA_LOAD_PATH = @:@v#.#:@stdlib
using Pkg
Pkg.status()
Project CaMKIIModel v0.7.0
Status `~/actions-runner-1/_work/camkii-cardiomyocyte-model/camkii-cardiomyocyte-model/Project.toml`
  [336ed68f] CSV v0.10.15
  [5a033b19] CurveFit v1.4.0
  [a93c6f00] DataFrames v1.8.1
  [459566f4] DiffEqCallbacks v4.12.0
  [f6369f11] ForwardDiff v1.3.2
  [23fbe1c1] Latexify v0.16.10
  [2fda8390] LsqFit v0.15.1
⌅ [961ee093] ModelingToolkit v10.32.1
  [77ba4419] NaNMath v1.1.3
  [1dea7af3] OrdinaryDiffEq v6.108.0
  [91a5bcdd] Plots v1.41.5
  [2913bbd2] StatsBase v0.34.10
  [9672c7b4] SteadyStateDiffEq v2.9.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