Pacing simulations

Responses of calcium transients and electrophysiology to pacing frequencies.

using ModelingToolkit
using OrdinaryDiffEq, SteadyStateDiffEq, DiffEqCallbacks
using Plots
using CSV
using DataFrames
using CaMKIIModel
using CaMKIIModel: second
Plots.default(lw=1.5)
[ Info: Precompiling GRIJuliaExt [84369c5d-ffb2-5a92-8288-3470980d96d0] 



SYSTEM: caught exception of type :MethodError while trying to print a failed Task notice; giving up

[ Info: Precompiling IJuliaExt [2f4121a4-3b3a-5ce6-9c5e-1f2673ce168a] 



SYSTEM: caught exception of type :MethodError while trying to print a failed Task notice; giving up

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 = 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.934313 seconds (20.93 M allocations: 948.736 MiB, 1.47% gc time, 99.77% 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
     21.597356188110254
     34.569649574420886
     51.60556465685166
      ⋮
 193777.0966262536
 208253.35756881535
 222729.6185113771
 242297.83124779342
 261866.04398420974
 283057.11971236905
 304248.19544052833
 334225.42835287773
 366081.64130863873
 404834.4449385363
 455953.41862122173
 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.1219637836440816, 0.12191937753328323, 0.1218757903829034, 0.12183318573340736, 0.12179171693004404, 0.12175152667167365, 0.12171274673876364  …  0.26104417804603025, 0.009873892913308327, 0.0015688568862426027, 0.09093422465365385, 0.22412560303273427, 0.9671554512230358, 0.005926150085676066, 829.923524981244, 829.7704141396295, 0.002228995040224513]
 [150952.86299380922, 13838.073886537528, -72.4735918016508, 0.12206907365211363, 0.12204000912238945, 0.1220110851640203, 0.12198240835565052, 0.12195408498965715, 0.12192622071360422, 0.12189892020522224  …  0.26219196277470147, 0.010096953727758097, 0.0014509791455665651, 0.08984663594439561, 0.22601226798739724, 0.967993228113323, 0.005481992553581978, 829.835522704537, 829.6517809213686, 0.002196550994865595]
 [150952.95992241168, 13837.930366929982, -73.3680187246281, 0.12214002318717763, 0.12212362030065525, 0.12210735547152661, 0.12209128572970773, 0.12207547016063591, 0.1220599697635786, 0.12204484731342843  …  0.26245103149935634, 0.010460774283167064, 0.0013687018299841105, 0.08832396891068775, 0.228694606159479, 0.9691706237716892, 0.0051520931233999395, 829.6998293673863, 829.5000486863437, 0.0022048519780075433]
 [150953.10134272132, 13837.760056594308, -73.87449731227231, 0.12223586969586354, 0.12222699265995365, 0.12221851425171158, 0.12221046390801742, 0.12220287294990832, 0.12219577456109872, 0.12218920376366489  …  0.26014121758021924, 0.010837804894547892, 0.0013321803801861305, 0.08636165834435419, 0.23222051356391082, 0.9706806820175085, 0.004974280036814663, 829.5173289776985, 829.3085691237902, 0.0022267170411342492]
 ⋮
 [151877.29450811187, 12917.71108217493, -69.07441509224779, 0.12876158310797348, 0.1287617705162812, 0.12876195895190312, 0.1287621484722056, 0.1287623391368726, 0.1287625310080237, 0.12876272415033974  …  0.0013765907228324033, 0.0017337377089234574, 0.002683649026219634, 0.0018357159788941974, 0.9996635163763544, 0.9996618895558017, 0.0068929162884671675, 773.0655705481045, 772.8233741070803, 0.001391869598810886]
 [151920.13677741215, 12875.000337345027, -68.98244859460408, 0.12830495976014272, 0.12830513604478813, 0.12830531334401102, 0.12830549171274883, 0.1283056712081582, 0.12830585188972737, 0.12830603381939598  …  0.0013963195846479755, 0.0017456172980768122, 0.002702031545140576, 0.0018600465906778913, 0.9996566931940932, 0.9996551168357056, 0.006936125365725572, 772.1518370477593, 771.915835758541, 0.001357699819510745]
 [151960.28890109566, 12834.971798221004, -68.89525251659072, 0.12788348034133457, 0.12788364576095118, 0.1278838121667122, 0.12788397961083225, 0.12788414814763557, 0.12788431783366286, 0.1278844887277859  …  0.0014152909563354954, 0.0017569542905986365, 0.0027195751035661397, 0.0018834062604608335, 0.9996500880999493, 0.9996485721509725, 0.0069773438658791865, 771.2850163677898, 771.0546669401969, 0.0013264617002732193]
 [152010.58954355257, 12784.82612605566, -68.78460214143337, 0.12736459294595642, 0.12736474475443885, 0.12736489750651142, 0.12736505125087924, 0.12736520603821555, 0.12736536192126202, 0.1273655189549354  …  0.0014397404691675853, 0.001771445163121383, 0.002741999263937952, 0.0019134621816531432, 0.9996415271688325, 0.9996400877439987, 0.007030020932074769, 770.1872604413005, 769.9637767309013, 0.0012884709916617019]
 [152056.67464311537, 12738.883016794587, -68.68179724266835, 0.12689833433373884, 0.12689847340734944, 0.12689861337697142, 0.12689875428785433, 0.12689889618707606, 0.12689903912363582, 0.12689918314855336  …  0.0014628559071814874, 0.0017850153937049545, 0.0027629967563003958, 0.0019418062285953136, 0.9996334067262259, 0.9996320210075279, 0.007079301639013598, 769.1714864062234, 768.9540853693323, 0.001254754204670871]
 [152102.2393973284, 12693.458500216195, -68.57877210976663, 0.12644609631124168, 0.1264462226912728, 0.1264463499118501, 0.12644647801459546, 0.1264466070428133, 0.12644673704157658, 0.1264468680578179  …  0.001486349786712296, 0.0017987159063029207, 0.002784198342477579, 0.0019706225451286, 0.999625050509718, 0.9996237553084326, 0.007129031099513247, 768.159228331486, 767.9476470696031, 0.0012224432354898023]
 [152143.68976457414, 12652.135464662124, -68.48382673437294, 0.12604235007276832, 0.12604246476024122, 0.1260425802341047, 0.12604269653260586, 0.126042813695538, 0.12604293176431922, 0.1260430507820764  …  0.001508387494466263, 0.001811435164269976, 0.002803878544070226, 0.001997547319612055, 0.9996172014554685, 0.9996159752808753, 0.007175167387157037, 767.2328052036479, 767.0263521269355, 0.00119393123831457]
 [152196.01945541796, 12599.966028996165, -68.36223769014006, 0.1255433501650942, 0.1255434500995232, 0.12554355074168594, 0.12554365212535956, 0.12554375428568681, 0.12554385725924558, 0.1255439610841227  …  0.0015370614275331668, 0.0018278531721834224, 0.002829282617191085, 0.00203255559549391, 0.9996068941469949, 0.9996057746117899, 0.0072346860851581285, 766.0572288191952, 765.8570245748581, 0.001159128405384825]
 [152244.48028365578, 12551.652905580435, -68.24787687482645, 0.12509207501004838, 0.12509216119907937, 0.12509224801871757, 0.12509233549849508, 0.12509242366913814, 0.12509251256262796, 0.12509260221226542  …  0.001564522953198096, 0.0018434282768384934, 0.002853382465142983, 0.0020660242144180316, 0.9995969441609202, 0.9995959343692192, 0.007291111380536352, 764.9647588612053, 764.7701194480643, 0.0011280815214950808]
 [152294.86530779523, 12501.420499987822, -68.12710634707305, 0.12463427129619778, 0.12463434329327915, 0.12463441583212136, 0.12463448893770171, 0.12463456263600699, 0.12463463695408508, 0.12463471192009966  …  0.0015940628798710788, 0.0018600191033298907, 0.00287905333941274, 0.002101957570089606, 0.9995861612227441, 0.9995852740349686, 0.007351175280067965, 763.8272362921982, 763.6381574399595, 0.001097001411442728]
 [152349.3311828622, 12447.11824095338, -67.99434579368709, 0.12415274863724424, 0.12415280542698019, 0.12415286265603304, 0.12415292034434665, 0.12415297851267093, 0.12415303718260301, 0.12415309637663074  …  0.0016271794753294298, 0.001878425879264436, 0.00290753365367894, 0.0021421595183795062, 0.9995739719228577, 0.9995732316893655, 0.00741776471026983, 762.598610522473, 762.4152867135105, 0.001064773253322777]
 [152387.28123266777, 12409.281196289696, -67.90044030999043, 0.1238255880217879, 0.1238256342649948, 0.12382568087450993, 0.12382572786674113, 0.12382577525875962, 0.12382582306833391, 0.1238258713139657  …  0.0016510210539250828, 0.0018915545463510752, 0.0029278470617991204, 0.0021710472422097316, 0.9995651319471192, 0.9995645032374807, 0.007465232286657914, 761.7448927830242, 761.5654239360108, 0.0010431509658027423]
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)
  1.632965 seconds (126.49 k allocations: 444.334 MiB, 4.40% gc time)
retcode: Success
Interpolation: 3rd order Hermite
t: 8776-element Vector{Float64}:
      0.0
      0.019333123284849377
      0.09098129546758026
      0.20735582943983927
      0.4561191027686269
      1.047256292840616
      2.0342667657223767
      3.4517766411484665
      6.733792423912831
     12.45011708102324
     21.597356188110254
     34.569649574420886
     51.60556465685166
      ⋮
 369981.23720714916
 377919.8522572898
 385879.6125235389
 395050.15519531973
 404235.4191555884
 414430.69863912894
 424625.9781226695
 438295.87845323246
 451965.7787837954
 467608.668191504
 486472.9689784286
 500000.0
u: 8776-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.1219637836440816, 0.12191937753328323, 0.1218757903829034, 0.12183318573340736, 0.12179171693004404, 0.12175152667167365, 0.12171274673876364  …  0.26104417804603025, 0.009873892913308327, 0.0015688568862426027, 0.09093422465365385, 0.22412560303273427, 0.9671554512230358, 0.005926150085676066, 829.923524981244, 829.7704141396295, 0.002228995040224513]
 [150952.86299380922, 13838.073886537528, -72.4735918016508, 0.12206907365211363, 0.12204000912238945, 0.1220110851640203, 0.12198240835565052, 0.12195408498965715, 0.12192622071360422, 0.12189892020522224  …  0.26219196277470147, 0.010096953727758097, 0.0014509791455665651, 0.08984663594439561, 0.22601226798739724, 0.967993228113323, 0.005481992553581978, 829.835522704537, 829.6517809213686, 0.002196550994865595]
 [150952.95992241168, 13837.930366929982, -73.3680187246281, 0.12214002318717763, 0.12212362030065525, 0.12210735547152661, 0.12209128572970773, 0.12207547016063591, 0.1220599697635786, 0.12204484731342843  …  0.26245103149935634, 0.010460774283167064, 0.0013687018299841105, 0.08832396891068775, 0.228694606159479, 0.9691706237716892, 0.0051520931233999395, 829.6998293673863, 829.5000486863437, 0.0022048519780075433]
 [150953.10134272132, 13837.760056594308, -73.87449731227231, 0.12223586969586354, 0.12222699265995365, 0.12221851425171158, 0.12221046390801742, 0.12220287294990832, 0.12219577456109872, 0.12218920376366489  …  0.26014121758021924, 0.010837804894547892, 0.0013321803801861305, 0.08636165834435419, 0.23222051356391082, 0.9706806820175085, 0.004974280036814663, 829.5173289776985, 829.3085691237902, 0.0022267170411342492]
 ⋮
 [151379.57968649568, 13413.932155040082, -70.06942988422969, 0.13456782393261246, 0.13456812824768727, 0.13456843324620033, 0.1345687390014994, 0.134569045589899, 0.13456935309082907, 0.13456966158699715  …  0.0011801625729506557, 0.0016102056369161814, 0.002492485539796073, 0.001591572598989331, 0.9997291593528512, 0.9997271638480715, 0.006442120428915676, 782.715900389323, 782.3887059682453, 0.0018576002207500867]
 [151420.87760085645, 13372.753943159763, -69.99153529424963, 0.13405309079962335, 0.13405338751411836, 0.13405368499300202, 0.13405398330976653, 0.13405428254087476, 0.1340545827659116, 0.1340548840677451  …  0.0011944664618810698, 0.0016195579250382894, 0.0025069533771177924, 0.001609479938206074, 0.9997245295135073, 0.9997225441315495, 0.006476328942522451, 781.9974783264521, 781.678251660785, 0.0018141731655052095]
 [151460.82670241655, 13332.921596200948, -69.91545119570239, 0.13356044216497573, 0.13356073062623225, 0.13356101991680236, 0.13356131010985758, 0.13356160128152722, 0.13356189351104908, 0.13356218688092955  …  0.0012085555129615216, 0.0016287387788381045, 0.0025211643264181753, 0.0016271622086633448, 0.9997199240478265, 0.999717955873449, 0.006509916519929584, 781.2857001136438, 780.9740269766912, 0.0017729520376435432]
 [151505.10944917618, 13288.76920008918, -69.83023695240111, 0.13302067995325143, 0.1330209588474138, 0.1330212386304355, 0.13302151937478926, 0.133021801155878, 0.13302208405218421, 0.13302236814542892  …  0.001224614104133164, 0.0016390860321523163, 0.0025371750339731017, 0.0016471909300802717, 0.9997146716491221, 0.9997127269019432, 0.00654774015832298, 780.4791987098524, 780.1757163152911, 0.0017282096360503973]
 [151547.66603724108, 13246.338711914364, -69.74745686109587, 0.1325083478263034, 0.1325086172055104, 0.1325088875216288, 0.13250915884622558, 0.13250943125376155, 0.13250970482173866, 0.1325099796308569  …  0.001240402787203493, 0.0016491983486877479, 0.0025528242740668343, 0.0016668785992700317, 0.9997094744558075, 0.9997075544589414, 0.006584691852400016, 779.6876543616498, 779.3918620861549, 0.0016861639972940339]
 [151592.89495662053, 13201.244642935068, -69.65850004307345, 0.13197080077405954, 0.13197105973593262, 0.13197131967702394, 0.1319715806677082, 0.13197184278120574, 0.1319721060937276, 0.13197237068462953  …  0.0012575956282859708, 0.0016601340324407827, 0.002569747768287231, 0.0016882906919370034, 0.9997037836857946, 0.9997018920696717, 0.006624632651748838, 778.8293022913116, 778.5414885108344, 0.0016425018036380873]
 [151636.09432054625, 13158.17482075887, -69.57257260327731, 0.13146418406101928, 0.13146443287644277, 0.13146468270152625, 0.13146493360526246, 0.13146518565943363, 0.13146543893875465, 0.1314656935210232  …  0.0012744322626548079, 0.0016707650996272035, 0.0025861995815387455, 0.0017092302089849942, 0.999698179628768, 0.9996963184121607, 0.006663440351128375, 777.9935382623192, 777.7131579714893, 0.001601781947599768]
 [151690.980322869, 13103.45436483307, -69.46200205030101, 0.1308302271213917, 0.13083046265954273, 0.13083069923573598, 0.13083093691694084, 0.13083117577283415, 0.13083141587593852, 0.13083165730176882  …  0.0012964285067612001, 0.001684544394787926, 0.002607523318403275, 0.0017365476131860715, 0.9996908118181066, 0.999688992387111, 0.006713711483306018, 776.9100870505549, 776.6388886366723, 0.0015514292114827777]
 [151742.5947595183, 13051.996492939521, -69.35656076000528, 0.1302441283767114, 0.130244351118507, 0.13024457491224609, 0.13024479982267412, 0.13024502591715387, 0.1302452532657991, 0.13024548194161625  …  0.0013177598317914742, 0.0016977889303040185, 0.0026280192441963416, 0.001762995516755746, 0.9996836166539962, 0.9996818416111038, 0.006762000726911163, 775.870085698561, 775.6072553206691, 0.001505478790447754]
 [151797.90315259522, 12996.856702829195, -69.24195529328337, 0.12962709369650105, 0.12962730239402429, 0.12962751214532742, 0.1296277230124401, 0.12962793505989995, 0.12962814835487996, 0.12962836296732463  …  0.0013413437236693732, 0.0017123008986269508, 0.002650476280516342, 0.0017921876196765147, 0.999675604447312, 0.9996738831103906, 0.006814876867933035, 774.7341369629886, 774.4799882678261, 0.0014577390744665557]
 [151859.6308864374, 12935.317961532439, -69.11200069197285, 0.12895218322609123, 0.12895237584304736, 0.1289525695012271, 0.12895276425925908, 0.12895296017814184, 0.12895315732136486, 0.1289533557550371  …  0.001368597909597026, 0.0017289041508132628, 0.0026761693186721945, 0.0018258603583514283, 0.9996662719367984, 0.9996646176611226, 0.006875327671487125, 773.4418949273171, 773.1970885768425, 0.0014062842692317897]
 [151900.78719090123, 12894.288051287445, -69.02411421041758, 0.12851042449880462, 0.12851060629057343, 0.1285107891024804, 0.12851097299060923, 0.1285111580133106, 0.12851134423131794, 0.1285115317078704  …  0.0013873449723481926, 0.001740223049942467, 0.002693684853776717, 0.001848984391012904, 0.9996598082668137, 0.9996582020569843, 0.006916511640062337, 772.5669472532215, 772.3281677506554, 0.0013730363731862707]
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=["CaSSR" "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 ./ 1000, zz, colorbar=:none, yguide="(sec.)", zguide="Conc. (μM)", xticks=false, size=(600, 600))
annotate!(3, 299, 0.65, "SL")
annotate!(41, 299.25, 0.58, "SR")

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

2Hz pacing

callback = build_stim_callbacks(Istim, stimend; period=1 / 2 * second, starttime=stimstart)
@time sol2 = solve(prob, alg; callback)
  2.873711 seconds (205.32 k allocations: 725.857 MiB, 11.37% 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
     21.597356188110254
     34.569649574420886
     51.60556465685166
      ⋮
 370501.11922448984
 378786.22720701346
 387786.4548599244
 396946.4730869832
 407725.1056683845
 418503.73824978585
 430099.3020603879
 442809.40312057175
 457689.58642638556
 472569.7697321994
 489876.86951561563
 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.1219637836440816, 0.12191937753328323, 0.1218757903829034, 0.12183318573340736, 0.12179171693004404, 0.12175152667167365, 0.12171274673876364  …  0.26104417804603025, 0.009873892913308327, 0.0015688568862426027, 0.09093422465365385, 0.22412560303273427, 0.9671554512230358, 0.005926150085676066, 829.923524981244, 829.7704141396295, 0.002228995040224513]
 [150952.86299380922, 13838.073886537528, -72.4735918016508, 0.12206907365211363, 0.12204000912238945, 0.1220110851640203, 0.12198240835565052, 0.12195408498965715, 0.12192622071360422, 0.12189892020522224  …  0.26219196277470147, 0.010096953727758097, 0.0014509791455665651, 0.08984663594439561, 0.22601226798739724, 0.967993228113323, 0.005481992553581978, 829.835522704537, 829.6517809213686, 0.002196550994865595]
 [150952.95992241168, 13837.930366929982, -73.3680187246281, 0.12214002318717763, 0.12212362030065525, 0.12210735547152661, 0.12209128572970773, 0.12207547016063591, 0.1220599697635786, 0.12204484731342843  …  0.26245103149935634, 0.010460774283167064, 0.0013687018299841105, 0.08832396891068775, 0.228694606159479, 0.9691706237716892, 0.0051520931233999395, 829.6998293673863, 829.5000486863437, 0.0022048519780075433]
 [150953.10134272132, 13837.760056594308, -73.87449731227231, 0.12223586969586354, 0.12222699265995365, 0.12221851425171158, 0.12221046390801742, 0.12220287294990832, 0.12219577456109872, 0.12218920376366489  …  0.26014121758021924, 0.010837804894547892, 0.0013321803801861305, 0.08636165834435419, 0.23222051356391082, 0.9706806820175085, 0.004974280036814663, 829.5173289776985, 829.3085691237902, 0.0022267170411342492]
 ⋮
 [151134.84494179304, 13657.982385038635, -70.51558492777123, 0.13773683062889994, 0.1377371821173757, 0.1377375337438695, 0.13773788557999758, 0.1377382377002723, 0.13773859018224965, 0.13773894310668616  …  0.0011014010227084507, 0.0015576851128212333, 0.002411198967359832, 0.001492696745728276, 0.9997542476557048, 0.9997521830002981, 0.006249612312465166, 786.6646270952002, 786.2866559014959, 0.0021341125214430485]
 [151186.91013258326, 13606.061918074794, -70.42277555911222, 0.13704654175602535, 0.13704688440435872, 0.13704722733486746, 0.13704757062032177, 0.1370479143364352, 0.1370482585620149, 0.13704860337912125  …  0.001117328155472058, 0.001568470295675491, 0.0024278905857453175, 0.0015127562714361133, 0.9997492359059148, 0.9997471749159279, 0.006289184142550562, 785.8746141940514, 785.5079412073273, 0.0020726753918368186]
 [151241.2994678654, 13551.825414078663, -70.3246358390318, 0.13633467473063912, 0.13633500749686972, 0.13633534068095898, 0.13633567435646737, 0.1363360085999306, 0.13633634349101126, 0.13633667911265993  …  0.0011344231826200704, 0.001579954715738892, 0.002445664014909717, 0.0015342559664236707, 0.999743817814744, 0.9997417690765038, 0.006331296073788769, 785.0204635226818, 784.6653056476739, 0.0020100148005775336]
 [151294.43021860343, 13498.845498483599, -70.2275613247799, 0.13564857177307502, 0.13564889445219655, 0.13564921766850796, 0.135649541495989, 0.13564986601161144, 0.13565019129549155, 0.13565051743105236  …  0.0011515907570954463, 0.001591396129592614, 0.002463370836931373, 0.0015558161345702933, 0.9997383416010343, 0.999736308365569, 0.006373225838558329, 784.1583562967703, 783.8141620767826, 0.0019503151855675854]
 [151354.19149278372, 13439.25562755895, -70.11690916753875, 0.13488798329977297, 0.13488829417291792, 0.13488860570289202, 0.13488891796377045, 0.13488923103262374, 0.13488954498967046, 0.1348898599184396  …  0.0011714770115626826, 0.0016045371372020293, 0.0024837078481160946, 0.0015807528743670867, 0.9997319554363857, 0.9997299431668611, 0.006421352698509224, 783.1565563103948, 782.8243575040981, 0.0018849492150999007]
 [151411.11386742373, 13382.498174190969, -70.01003249654669, 0.13417462969501615, 0.1341749288861642, 0.13417522883343622, 0.1341755296106165, 0.13417583129447255, 0.13417613396490743, 0.13417643770512125  …  0.0011910109195967867, 0.001617331334760732, 0.0025035080402190206, 0.0016052092301202564, 0.9997256381002063, 0.9997236494313866, 0.006468178030041224, 782.1712489943944, 781.8501455304903, 0.0018244359922209936]
 [151469.33992304458, 13324.442423358623, -69.8991595147409, 0.13345630536194705, 0.13345659215289396, 0.1334568797869435, 0.13345716833718663, 0.13345745787967, 0.13345774849354683, 0.13345804026123673  …  0.0012116212070947391, 0.001630712756952171, 0.0025242170362734196, 0.0016309718594921749, 0.9997189258373844, 0.9997169644991382, 0.006517128168430954, 781.1326137037468, 780.8225273983293, 0.0017642925703717962]
 [151529.77193503847, 13264.188793038138, -69.78239471167848, 0.13272310331595305, 0.1327233767502532, 0.1327236511018757, 0.1327239264427747, 0.13272420284781447, 0.13272448039491805, 0.13272475916522475  …  0.00123371553152325, 0.0016449222869077608, 0.0025462069036655886, 0.0016585418016954229, 0.9997116772736953, 0.999709749420582, 0.006569067717399831, 780.0225487641892, 779.7235431040808, 0.0017037372888516484]
 [151596.24452130272, 13197.914186532907, -69.65189264356279, 0.13193138905057517, 0.1319316472537851, 0.1319319064383143, 0.1319321666744309, 0.13193242803524435, 0.13193269059685003, 0.13193295443848352  …  0.0012588823958489253, 0.001660948471687392, 0.0025710081131446933, 0.0016898922132124493, 0.9997033562087432, 0.9997014673565963, 0.006627602984513427, 778.7652173751846, 778.4779849625305, 0.0016393187247410932]
 [151658.4100949503, 13135.935313996933, -69.5278268708731, 0.13120521019288545, 0.13120545365452696, 0.1312056981390888, 0.13120594371479338, 0.13120619045262133, 0.13120643842645174, 0.1312066877132121  …  0.0012832888567885833, 0.0016763274396548755, 0.002594807370341849, 0.0017202350757160644, 0.9996952192246373, 0.9996933745577236, 0.006683732897389632, 777.5560678777688, 777.2794545672721, 0.0015811324506381258]
 [151725.67218316172, 13068.87673728104, -69.3913158327411, 0.13043530609428772, 0.1304355331034228, 0.13043576115989114, 0.1304359903291846, 0.1304362206794422, 0.1304364522815853, 0.1304366852094616  …  0.001310689013105424, 0.0016934106721512236, 0.002621243788628786, 0.0017542342781500572, 0.999686006233491, 0.9996842169741886, 0.006746033097710031, 776.2133947142989, 775.9478477397513, 0.0015204017770856473]
 [151762.65564123017, 13032.005759074525, -69.31520923023034, 0.13001909000264908, 0.13001930769203238, 0.13001952643568224, 0.13001974629739937, 0.13001996734356383, 0.13002018964326661, 0.13002041326844932  …  0.001326219983204311, 0.0017030108800327054, 0.0026361003955689176, 0.0017734738596539242, 0.9996807491582019, 0.9996789929053579, 0.006781030666245811, 775.4607393266745, 775.2010905470277, 0.0014879919074327719]
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"
Back to top