Pacing response#

using ModelingToolkit
using OrdinaryDiffEq
using Plots
using CSV
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 = TRBDF2()
TRBDF2(; linsolve = nothing, nlsolve = OrdinaryDiffEqNonlinearSolve.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}}(1//100, 10, 1//5, 1//5, false, true, 0//1), precs = DEFAULT_PRECS, smooth_est = true, extrapolant = linear, controller = PI, step_limiter! = trivial_limiter!, autodiff = ADTypes.AutoForwardDiff(),)

Single pulse#

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

@time sol = solve(prob, alg; callback)
  7.294243 seconds (20.76 M allocations: 963.625 MiB, 5.68% gc time, 99.58% compilation time)
retcode: Success
Interpolation: 3rd order Hermite
t: 479-element Vector{Float64}:
      0.0
      0.00037376965588217846
      0.004111466214703963
      0.03981907054375368
      0.06090491262855715
      0.1655435225566852
      0.2409336011179059
      0.5227875405036884
      1.0858597487365014
      2.388889121726196
      ⋮
 468816.26414208143
 472730.21521044377
 477296.12191472796
 480307.76403545734
 483892.9854622985
 488178.5140442844
 491612.0423020121
 495938.10450132645
 500000.0
u: 479-element Vector{Vector{Float64}}:
 [0.0026, 830.0, 830.0, 0.00702, 0.966, 0.22156, 0.09243, 0.00188, 0.00977, 0.26081  …  0.12113, 0.12113, 0.12113, 0.12113, 0.12113, 0.12113, 0.12113, -68.79268, 13838.37602, 150952.75035000002]
 [0.0025999722040421203, 829.9999902796054, 829.9999993331091, 0.007020004989170199, 0.9660000353355825, 0.22156007721482085, 0.09242995488968388, 0.0018799969383422777, 0.009769997724445615, 0.2608099143344817  …  0.12113, 0.12113, 0.12113, 0.12113, 0.12113000000000289, 0.12113000000167641, 0.12113000088893845, -68.79276368828553, 13838.376014261732, 150952.7503511151]
 [0.002599694403132185, 829.9998930912919, 829.9999926601315, 0.007020052852203506, 0.9660003886880141, 0.2215608493616932, 0.09242950378712296, 0.001879965695351556, 0.00976997499090465, 0.2608090581211949  …  0.12113, 0.12113000000000013, 0.12113000000000858, 0.12113000000055028, 0.12113000003391475, 0.12113000196534932, 0.12113010213116475, -68.79361851040093, 13838.375956226279, 150952.75036226763]
 [0.0025970540837836013, 829.9989660442994, 829.9999284703065, 0.007020317408788777, 0.9660037640747009, 0.2215682258389346, 0.09242519428713569, 0.0018796068140212517, 0.009769759976889867, 0.2608009220796936  …  0.12113000002884419, 0.12113000024542142, 0.12113000204735136, 0.12113001662717256, 0.1211301299299577, 0.12113095641447905, 0.12113634992793865, -68.8025264544508, 13838.375374805612, 150952.75046898014]
 [0.0025955058666166115, 829.9984198218226, 829.9998901444599, 0.00702030935044612, 0.966005757011449, 0.22157258164004917, 0.0924226495075652, 0.0018793435797837084, 0.009769634913190547, 0.2607961562482531  …  0.12113000016866177, 0.12113000131087216, 0.12113000976147185, 0.12113006862041213, 0.12113044540549034, 0.12113257965026794, 0.12114263371357109, -68.80807075533095, 13838.375021123176, 150952.75053214436]
 [0.0025879285397901147, 829.9957223730446, 829.9996943632078, 0.007018630287275856, 0.9660156439130673, 0.22159419607659525, 0.09241002145284741, 0.001877559117288867, 0.00976903523890109, 0.2607729421504298  …  0.12113004935055226, 0.12113018010628349, 0.12113063273968475, 0.12113211161381009, 0.12113657158715925, 0.12114860583327054, 0.12117652595466133, -68.83575072020419, 13838.373259639946, 150952.7508472945]
 [0.002582571145852477, 829.9937923939375, 829.9995471212803, 0.00701592369079187, 0.9660227641003213, 0.2216097675784518, 0.09240092362867286, 0.0018758714847454457, 0.009768624210181659, 0.2607566648960162  …  0.12113024326075361, 0.1211307502406234, 0.12113218550388928, 0.12113594251344088, 0.12114488158032216, 0.12116387111038732, 0.12119939012901638, -68.85564804966069, 13838.37199181475, 150952.75107611093]
 [0.002563220542096413, 829.9866743979147, 829.9989475390704, 0.006998097330745275, 0.9660493610162236, 0.22166797415611358, 0.09236691378604592, 0.0018679384237350956, 0.009767233651450798, 0.26069906023032124  …  0.1211345511685702, 0.12113905570282098, 0.1211473005088212, 0.121161551591973, 0.1211846631341102, 0.12121970697706758, 0.12126943143386476, -68.92937968582093, 13838.367272493979, 150952.75194459775]
 [0.0025274511385383024, 829.9728942569965, 829.9975152384703, 0.006942930386866817, 0.9661023923982736, 0.2217842153930329, 0.09229898719097207, 0.0018493158699612237, 0.009765106917158232, 0.2605987293089182  …  0.12116011855975432, 0.12117558659040728, 0.1211971892146648, 0.12122634301778801, 0.12126437969981868, 0.12131243130810888, 0.12137132990552897, -69.07404146936263, 13838.357924241376, 150952.75374091472]
 [0.0024571024140966876, 829.9430246600219, 829.9930651563966, 0.006793945627676893, 0.966224644350509, 0.2220530369627137, 0.09214188544158235, 0.0018064864243286108, 0.009763330551452168, 0.26043481866136947  …  0.12124849189953911, 0.1212797972795032, 0.12131692953907361, 0.1213603007104879, 0.12141021796295101, 0.12146686381610994, 0.1215302791809503, -69.3955791347726, 13838.336695544232, 150952.75820448835]
 ⋮
 [0.0011185642660409979, 764.3684298236437, 764.5616253402491, 0.007518413763037135, 0.9995546074279216, 0.9995553982023792, 0.002203440788203746, 0.002950620430845893, 0.0019062613538746774, 0.001677656997915216  …  0.12497684775192844, 0.12497680092718462, 0.12497675450225705, 0.12497670845965304, 0.1249766627825729, 0.124976617454876, 0.12497657246104876, -67.79592779873603, 12441.220983422527, 152354.9701199792]
 [0.0011167842283000627, 764.3038658868659, 764.4967433664559, 0.0075231335315425595, 0.9995537189758014, 0.9995545005016033, 0.002206346000522002, 0.0029526421800178566, 0.0019075679022723252, 0.0016800379732080217  …  0.12495073508907782, 0.12495068916018015, 0.12495064362355113, 0.12495059846202274, 0.12495055365910683, 0.12495050919896196, 0.12495046506636179, -67.78668812553104, 12437.799809043818, 152358.40008269556]
 [0.001114750541471255, 764.2300020817364, 764.4225164317212, 0.0075285547534775675, 0.9995526973313574, 0.9995534679511646, 0.00220968377614449, 0.0029549645727452063, 0.0019090692493661577, 0.001682788845036541  …  0.1249208993927813, 0.12492085456345683, 0.12492081011869668, 0.12492076604171978, 0.12492072231641006, 0.12492067892728345, 0.12492063585945763, -67.77608279493613, 12433.879464430194, 152362.33047915212]
 [0.001113438199434518, 764.1821947457535, 764.3744745034522, 0.0075320624340186205, 0.9995520354316747, 0.9995527942040988, 0.002211847146154321, 0.0029564664421157555, 0.0019100384599328975, 0.0016846150853580938  …  0.12490158349511328, 0.12490153921898543, 0.12490149532161175, 0.12490145178643941, 0.1249014085975714, 0.12490136573973458, 0.12490132319824912, -67.76921859679985, 12431.339416408395, 152364.87703446008]
 [0.0011119029773205933, 764.1261642648622, 764.3181698394944, 0.007536200686277831, 0.9995512540508318, 0.9995520025223168, 0.002214395346622757, 0.002958239465224204, 0.0019111862075229364, 0.0016867356404491021  …  0.1248790130594408, 0.1248789696087502, 0.1248789265314182, 0.12487888381115848, 0.1248788414323298, 0.12487879937990415, 0.12487875763943725, -67.76113685007607, 12428.36024676677, 152367.8638247994]
 [0.0011101087540034138, 764.0605073916522, 764.2521925465326, 0.0075410642840945275, 0.9995503333747814, 0.9995510734199554, 0.0022173986281872958, 0.002960323516077162, 0.0019125320844698543, 0.0016891670437044672  …  0.12485261611411026, 0.1248525735427417, 0.12485253133642309, 0.12485248947921218, 0.12485244795579813, 0.12485240675147037, 0.1248523658520898, -67.7516366602238, 12424.862023618794, 152371.3709722786]
 [0.001108698444883179, 764.0088702403177, 764.2003034535312, 0.007544897259782013, 0.9995496078306886, 0.9995503372458326, 0.0022197635667529224, 0.002961965305600172, 0.0019135933530515304, 0.0016911549113335542  …  0.1248318451751703, 0.12483180333182675, 0.12483176184829489, 0.12483172070889054, 0.12483167989855076, 0.1248316394028035, 0.1248315992077388, -67.74415389875419, 12422.10761225778, 152374.13240533293]
 [0.0011069602650699225, 763.9450294764238, 764.1361522875408, 0.007549657526831382, 0.9995487048521832, 0.9995494242080577, 0.0022227042737288268, 0.0029640051683911795, 0.0019149119700768646, 0.001693572493850314  …  0.1248062313516026, 0.12480619038945794, 0.12480614978003211, 0.1248061095079582, 0.12480606955847792, 0.12480602991741178, 0.12480599057113105, -67.73486788464149, 12418.697032003709, 152377.55166006502]
 [0.0011053643462566349, 763.8863038788396, 764.0771415931993, 0.007554047817100258, 0.9995478713489194, 0.999548579604365, 0.0022254177157388978, 0.002965886030770942, 0.0019161272338434905, 0.0016958239405773683  …  0.12478268506866272, 0.12478264488477978, 0.12478260504679925, 0.12478256553964759, 0.12478252634884823, 0.12478248746049231, 0.12478244886121118, -67.72630808149304, 12415.555406232808, 152380.70126566652]
plot(sol, idxs=(sys.t/1000, sys.vm), title="Action potential (single pulse)", ylabel="mV", xlabel="Time (s)", label=false, tspan=(100second, 103second))
_images/f79afd93b9fac9e6afba68dda7caa1c86373af78f1af5e22ad09f4f585911ff2.png
plot(sol, idxs=(sys.t/1000, sys.Cai_mean), tspan=(100second, 103second), title="Calcium transient", ylabel="Conc. (μM)", xlabel="Time (s)", label="Avg Ca (Model)")

# savefig("single-cat.pdf")
_images/8cc9af65bc9f2804a8ceca57aad7a26aae64a473d66092921b93cbc4d52f4394.png

1Hz#

callback = build_stim_callbacks(Istim, stimend; period=1second, starttime=stimstart)
@time sol = solve(prob, alg; callback)
  2.600046 seconds (181.24 k allocations: 45.042 MiB, 1.74% gc time)
retcode: Success
Interpolation: 3rd order Hermite
t: 22357-element Vector{Float64}:
      0.0
      0.00037376965588217846
      0.004111466214703963
      0.03981907054375368
      0.06090491262855715
      0.1655435225566852
      0.2409336011179059
      0.5227875405036884
      1.0858597487365014
      2.388889121726196
      ⋮
 480346.9749024962
 482699.7883395445
 485052.6017765928
 487499.69929415866
 490270.4874344493
 493041.27557473996
 495812.0637150306
 498582.85185532126
 500000.0
u: 22357-element Vector{Vector{Float64}}:
 [0.0026, 830.0, 830.0, 0.00702, 0.966, 0.22156, 0.09243, 0.00188, 0.00977, 0.26081  …  0.12113, 0.12113, 0.12113, 0.12113, 0.12113, 0.12113, 0.12113, -68.79268, 13838.37602, 150952.75035000002]
 [0.0025999722040421203, 829.9999902796054, 829.9999993331091, 0.007020004989170199, 0.9660000353355825, 0.22156007721482085, 0.09242995488968388, 0.0018799969383422777, 0.009769997724445615, 0.2608099143344817  …  0.12113, 0.12113, 0.12113, 0.12113, 0.12113000000000289, 0.12113000000167641, 0.12113000088893845, -68.79276368828553, 13838.376014261732, 150952.7503511151]
 [0.002599694403132185, 829.9998930912919, 829.9999926601315, 0.007020052852203506, 0.9660003886880141, 0.2215608493616932, 0.09242950378712296, 0.001879965695351556, 0.00976997499090465, 0.2608090581211949  …  0.12113, 0.12113000000000013, 0.12113000000000858, 0.12113000000055028, 0.12113000003391475, 0.12113000196534932, 0.12113010213116475, -68.79361851040093, 13838.375956226279, 150952.75036226763]
 [0.0025970540837836013, 829.9989660442994, 829.9999284703065, 0.007020317408788777, 0.9660037640747009, 0.2215682258389346, 0.09242519428713569, 0.0018796068140212517, 0.009769759976889867, 0.2608009220796936  …  0.12113000002884419, 0.12113000024542142, 0.12113000204735136, 0.12113001662717256, 0.1211301299299577, 0.12113095641447905, 0.12113634992793865, -68.8025264544508, 13838.375374805612, 150952.75046898014]
 [0.0025955058666166115, 829.9984198218226, 829.9998901444599, 0.00702030935044612, 0.966005757011449, 0.22157258164004917, 0.0924226495075652, 0.0018793435797837084, 0.009769634913190547, 0.2607961562482531  …  0.12113000016866177, 0.12113000131087216, 0.12113000976147185, 0.12113006862041213, 0.12113044540549034, 0.12113257965026794, 0.12114263371357109, -68.80807075533095, 13838.375021123176, 150952.75053214436]
 [0.0025879285397901147, 829.9957223730446, 829.9996943632078, 0.007018630287275856, 0.9660156439130673, 0.22159419607659525, 0.09241002145284741, 0.001877559117288867, 0.00976903523890109, 0.2607729421504298  …  0.12113004935055226, 0.12113018010628349, 0.12113063273968475, 0.12113211161381009, 0.12113657158715925, 0.12114860583327054, 0.12117652595466133, -68.83575072020419, 13838.373259639946, 150952.7508472945]
 [0.002582571145852477, 829.9937923939375, 829.9995471212803, 0.00701592369079187, 0.9660227641003213, 0.2216097675784518, 0.09240092362867286, 0.0018758714847454457, 0.009768624210181659, 0.2607566648960162  …  0.12113024326075361, 0.1211307502406234, 0.12113218550388928, 0.12113594251344088, 0.12114488158032216, 0.12116387111038732, 0.12119939012901638, -68.85564804966069, 13838.37199181475, 150952.75107611093]
 [0.002563220542096413, 829.9866743979147, 829.9989475390704, 0.006998097330745275, 0.9660493610162236, 0.22166797415611358, 0.09236691378604592, 0.0018679384237350956, 0.009767233651450798, 0.26069906023032124  …  0.1211345511685702, 0.12113905570282098, 0.1211473005088212, 0.121161551591973, 0.1211846631341102, 0.12121970697706758, 0.12126943143386476, -68.92937968582093, 13838.367272493979, 150952.75194459775]
 [0.0025274511385383024, 829.9728942569965, 829.9975152384703, 0.006942930386866817, 0.9661023923982736, 0.2217842153930329, 0.09229898719097207, 0.0018493158699612237, 0.009765106917158232, 0.2605987293089182  …  0.12116011855975432, 0.12117558659040728, 0.1211971892146648, 0.12122634301778801, 0.12126437969981868, 0.12131243130810888, 0.12137132990552897, -69.07404146936263, 13838.357924241376, 150952.75374091472]
 [0.0024571024140966876, 829.9430246600219, 829.9930651563966, 0.006793945627676893, 0.966224644350509, 0.2220530369627137, 0.09214188544158235, 0.0018064864243286108, 0.009763330551452168, 0.26043481866136947  …  0.12124849189953911, 0.1212797972795032, 0.12131692953907361, 0.1213603007104879, 0.12141021796295101, 0.12146686381610994, 0.1215302791809503, -69.3955791347726, 13838.336695544232, 150952.75820448835]
 ⋮
 [0.0014709804198590186, 774.7650675867864, 775.0217740672203, 0.0068867565348266, 0.9996628652933981, 0.999664691129107, 0.0018321262118003107, 0.0026810287599548246, 0.0017320362490638327, 0.001373502691340799  …  0.1298142989850554, 0.12981410566902007, 0.12981391353028116, 0.1298137225060062, 0.1298135325358517, 0.12981334356184115, 0.12981315552824987, -69.08758434854313, 12970.385308271756, 151823.38329663526]
 [0.0014648189097247889, 774.6170559243054, 774.8726437882356, 0.0068947105683523835, 0.999661628688092, 0.9996634491673804, 0.001836586549528715, 0.0026844112444428018, 0.0017342228539008093, 0.0013771250181795016  …  0.12973444984589175, 0.12973425863933177, 0.12973406860754158, 0.12973387968820324, 0.12973369182146835, 0.1297335049498369, 0.12973331901804327, -69.0705993378472, 12962.745391068665, 151831.0452907024]
 [0.0014587511227684797, 774.4703423855777, 774.7248288641308, 0.006902610989027944, 0.9996603974726762, 0.9996622134084227, 0.0018410230405745422, 0.0026877712752229393, 0.0017363933963003393, 0.0013806950995212419  …  0.1296556941433948, 0.12965550490492134, 0.12965531683607898, 0.1296551298750175, 0.1296549439623366, 0.12965475904096588, 0.12965457505605177, -69.05374856554144, 12955.184755575949, 151838.62776714246]
 [0.0014525423773591528, 774.3192459281329, 774.572605723504, 0.006910753906528506, 0.9996591227075694, 0.999660923539198, 0.0018456027806582425, 0.0026912333746366454, 0.0017386281717721905, 0.001384491426566734  …  0.12957497769961027, 0.12957479042905515, 0.12957460432237328, 0.12957441931826466, 0.12957423535785842, 0.1295740523845938, 0.12957387034410778, -69.03639725793703, 12947.412996594318, 151846.421983316]
 [0.0014456377255248189, 774.1499026547785, 774.4020098574933, 0.006919915786545255, 0.9996576891417706, 0.9996594759758902, 0.00185075754296341, 0.002695131750395027, 0.0017411531077457076, 0.0013886830381263477  …  0.12948502806823053, 0.1294848432321049, 0.12948465955567637, 0.1294844769782004, 0.12948429544133916, 0.12948411488904318, 0.12948393526744076, -69.01690651398874, 12938.71764457568, 151855.14245239654]
 [0.001438859040966184, 773.9823494076686, 774.2332273637102, 0.00692900094911331, 0.9996562620710581, 0.999658051125026, 0.0018558817379663794, 0.0026989972898749056, 0.0017436471723614147, 0.0013926934966191306  …  0.12939653322893527, 0.12939635079991557, 0.129396169524763, 0.12939598934334406, 0.1293958101979074, 0.12939563203296714, 0.1293954547951924, -68.99759903897377, 12930.126078524248, 151863.7588113575]
 [0.001432200027651031, 773.8166079299616, 774.0662783583399, 0.006938009231740235, 0.9996548421286506, 0.9996566254682218, 0.0018609663644587366, 0.0027028299162121868, 0.0017461249481828536, 0.001396860007799993  …  0.12930942123424286, 0.1293092410514431, 0.12930906201606965, 0.12930888406857588, 0.12930870715177434, 0.1293085312107211, 0.12930835619260697, -68.97848134434899, 12921.640174334389, 151872.26919744286]
 [0.00142566114324551, 773.6526647996978, 773.9011497497481, 0.0069469415998226775, 0.9996534305435041, 0.9996552073851689, 0.0018660168543641468, 0.002706630708170315, 0.0017485801794974768, 0.0014009349981301525  …  0.1292237159602217, 0.1292235380827127, 0.129223361346907, 0.12922318569384073, 0.12922301106688566, 0.12922283741163484, 0.12922266467579485, -68.95954769566795, 12913.259706468512, 151880.6738318993]
 [0.0014223617324013904, 773.5695406700812, 773.817427547519, 0.0069514730602374, 0.9996527110949105, 0.9996544787825764, 0.001868582411515314, 0.002708557992550861, 0.0017498228347863512, 0.0014030695345423495  …  0.12918042386558215, 0.12918024697216687, 0.1291800712149358, 0.12917989653523246, 0.1291797228767244, 0.12917955018528898, 0.12917937840890625, -68.94995030605708, 12909.016149021774, 151884.92962826125]
plot(sol, idxs=(sys.t/1000, sys.vm), title="Action potential", ylabel="mV", xlabel="Time (s)", label=false)
_images/f22e1f837011fda6d977ec806b21749805a8b889f99e8324a67aacdffe2765c8.png
plot(sol, idxs=(sys.t/1000, sys.vm), title="Action potential", tspan=(299second, 300second), ylabel="mV", xlabel="Time (s)", label=false)
_images/976df5444ceb6355a253b32b954e31530b9b8c159ff221faf933f60b8c8b0fc6.png
plot(sol, idxs=(sys.t/1000, [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"])
_images/b1f97857631d04ec05f231dc20a65e8668b9a939ea1f85afa79a31919cb6f6b5.png
plot(sol, idxs=(sys.t/1000, [sys.ICaL, sys.INaCa, sys.ICaT, sys.ICab]), tspan=(299second, 300second), ylabel="μA/μF", xlabel="Time (s)", label=["ICaL" "INaCa" "ICaT" "ICab"])
_images/5cecb7ef1cfe7663638718a0d19d658b69b3d57b76effcc68310c6c0de59e6d3.png
plot(sol, idxs=(sys.t/1000, [sys.Cai_sub_SR * 1000, sys.Cai_sub_SL * 1000, sys.Cai_mean * 1000]), tspan=(298second, 300second), title="Calcium transient", ylabel="nM", xlabel="Time (s)", label=["CaSR" "CaSL" "CaAvg"])
_images/23103ad1c76a22c456ac50e2cbc7a668411017d5d5948c6e34d534eaee32dc45.png
plot(sol, idxs=(sys.t/1000, sys.CaMKAct * 100), title="Active CaMKII", ylabel="Active CaMKII (%)", xlabel="Time (s)", label=false)
_images/9e844371ce29b74306f504681fa8a30d0cdf3f2be031f66a8e69dc58f5f0852e.png

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")
_images/453cb025b2674949232b87a9e02badfcb54d073fde5b131cb7a01fe2b8d34143.png

2Hz#

callback = build_stim_callbacks(Istim, stimend; period=1 / 2 * second, starttime=stimstart)
@time sol2 = solve(prob, alg; callback)
  4.671058 seconds (303.78 k allocations: 76.078 MiB, 1.67% gc time)
retcode: Success
Interpolation: 3rd order Hermite
t: 37424-element Vector{Float64}:
      0.0
      0.00037376965588217846
      0.004111466214703963
      0.03981907054375368
      0.06090491262855715
      0.1655435225566852
      0.2409336011179059
      0.5227875405036884
      1.0858597487365014
      2.388889121726196
      ⋮
 483929.7859758596
 486242.4065716669
 489008.70645342313
 492413.4139810658
 494864.77851831337
 496435.0673654913
 498148.7670705069
 499714.3848786381
 500000.0
u: 37424-element Vector{Vector{Float64}}:
 [0.0026, 830.0, 830.0, 0.00702, 0.966, 0.22156, 0.09243, 0.00188, 0.00977, 0.26081  …  0.12113, 0.12113, 0.12113, 0.12113, 0.12113, 0.12113, 0.12113, -68.79268, 13838.37602, 150952.75035000002]
 [0.0025999722040421203, 829.9999902796054, 829.9999993331091, 0.007020004989170199, 0.9660000353355825, 0.22156007721482085, 0.09242995488968388, 0.0018799969383422777, 0.009769997724445615, 0.2608099143344817  …  0.12113, 0.12113, 0.12113, 0.12113, 0.12113000000000289, 0.12113000000167641, 0.12113000088893845, -68.79276368828553, 13838.376014261732, 150952.7503511151]
 [0.002599694403132185, 829.9998930912919, 829.9999926601315, 0.007020052852203506, 0.9660003886880141, 0.2215608493616932, 0.09242950378712296, 0.001879965695351556, 0.00976997499090465, 0.2608090581211949  …  0.12113, 0.12113000000000013, 0.12113000000000858, 0.12113000000055028, 0.12113000003391475, 0.12113000196534932, 0.12113010213116475, -68.79361851040093, 13838.375956226279, 150952.75036226763]
 [0.0025970540837836013, 829.9989660442994, 829.9999284703065, 0.007020317408788777, 0.9660037640747009, 0.2215682258389346, 0.09242519428713569, 0.0018796068140212517, 0.009769759976889867, 0.2608009220796936  …  0.12113000002884419, 0.12113000024542142, 0.12113000204735136, 0.12113001662717256, 0.1211301299299577, 0.12113095641447905, 0.12113634992793865, -68.8025264544508, 13838.375374805612, 150952.75046898014]
 [0.0025955058666166115, 829.9984198218226, 829.9998901444599, 0.00702030935044612, 0.966005757011449, 0.22157258164004917, 0.0924226495075652, 0.0018793435797837084, 0.009769634913190547, 0.2607961562482531  …  0.12113000016866177, 0.12113000131087216, 0.12113000976147185, 0.12113006862041213, 0.12113044540549034, 0.12113257965026794, 0.12114263371357109, -68.80807075533095, 13838.375021123176, 150952.75053214436]
 [0.0025879285397901147, 829.9957223730446, 829.9996943632078, 0.007018630287275856, 0.9660156439130673, 0.22159419607659525, 0.09241002145284741, 0.001877559117288867, 0.00976903523890109, 0.2607729421504298  …  0.12113004935055226, 0.12113018010628349, 0.12113063273968475, 0.12113211161381009, 0.12113657158715925, 0.12114860583327054, 0.12117652595466133, -68.83575072020419, 13838.373259639946, 150952.7508472945]
 [0.002582571145852477, 829.9937923939375, 829.9995471212803, 0.00701592369079187, 0.9660227641003213, 0.2216097675784518, 0.09240092362867286, 0.0018758714847454457, 0.009768624210181659, 0.2607566648960162  …  0.12113024326075361, 0.1211307502406234, 0.12113218550388928, 0.12113594251344088, 0.12114488158032216, 0.12116387111038732, 0.12119939012901638, -68.85564804966069, 13838.37199181475, 150952.75107611093]
 [0.002563220542096413, 829.9866743979147, 829.9989475390704, 0.006998097330745275, 0.9660493610162236, 0.22166797415611358, 0.09236691378604592, 0.0018679384237350956, 0.009767233651450798, 0.26069906023032124  …  0.1211345511685702, 0.12113905570282098, 0.1211473005088212, 0.121161551591973, 0.1211846631341102, 0.12121970697706758, 0.12126943143386476, -68.92937968582093, 13838.367272493979, 150952.75194459775]
 [0.0025274511385383024, 829.9728942569965, 829.9975152384703, 0.006942930386866817, 0.9661023923982736, 0.2217842153930329, 0.09229898719097207, 0.0018493158699612237, 0.009765106917158232, 0.2605987293089182  …  0.12116011855975432, 0.12117558659040728, 0.1211971892146648, 0.12122634301778801, 0.12126437969981868, 0.12131243130810888, 0.12137132990552897, -69.07404146936263, 13838.357924241376, 150952.75374091472]
 [0.0024571024140966876, 829.9430246600219, 829.9930651563966, 0.006793945627676893, 0.966224644350509, 0.2220530369627137, 0.09214188544158235, 0.0018064864243286108, 0.009763330551452168, 0.26043481866136947  …  0.12124849189953911, 0.1212797972795032, 0.12131692953907361, 0.1213603007104879, 0.12141021796295101, 0.12146686381610994, 0.1215302791809503, -69.3955791347726, 13838.336695544232, 150952.75820448835]
 ⋮
 [0.001593037959266766, 777.5036863107193, 777.7826006651351, 0.0067419672742441315, 0.9996848354655617, 0.999686767911579, 0.001751882648151463, 0.002619515064122861, 0.0016922861580219674, 0.0013087201904529537  …  0.1313679232520426, 0.13136769321417416, 0.13136746445929373, 0.13136723690764188, 0.1313670104829054, 0.13136678511210223, 0.1313665607254525, -69.40021603616489, 13114.431517925317, 151679.01833570655]
 [0.0015851157022669436, 777.3358020504361, 777.6132658956841, 0.006750733511053197, 0.9996835348470343, 0.9996854606765921, 0.0017566892148133094, 0.002623236057402027, 0.0016946907798695322, 0.0013126093288947467  …  0.13126827791429557, 0.13126804939414585, 0.1312678220403187, 0.1312675957867186, 0.13126737056971585, 0.13126714632799968, 0.1312669230024507, -69.38109896702645, 13105.433737175794, 151688.0421043757]
 [0.0015757644883029852, 777.1367610848669, 777.412522719057, 0.00676115060142325, 0.999681976500265, 0.9996838974982192, 0.0017624086396685788, 0.0026276592695447486, 0.0016975512132278267, 0.0013171920247082177  …  0.1311508825094132, 0.13115065725837954, 0.13115043328321196, 0.13115021050642106, 0.1311499888538362, 0.131149768254486, 0.13114954864046754, -69.35841331471043, 13094.79300985755, 151698.71357860605]
 [0.0015644824337731381, 776.8943049862083, 777.1680141557472, 0.006773852420630671, 0.9996800879201165, 0.9996819886906614, 0.0017693985613359616, 0.002633051200718966, 0.0017010302924229013, 0.001322847142759015  …  0.1310090000584431, 0.13100877708695424, 0.1310085552067637, 0.13100833436123738, 0.13100811449555644, 0.13100789555655667, 0.13100767749260803, -69.33080025212796, 13081.878147268848, 151711.66578516838]
 [0.001556535156603251, 776.7214469428063, 776.9937092526317, 0.006782930247800162, 0.9996787150632858, 0.999680620302629, 0.0017743989432243191, 0.0026369075941922015, 0.0017035302206435989, 0.001326906278308726  …  0.13090855389167044, 0.1309083345111113, 0.13090811647365858, 0.13090789969495137, 0.1309076840945241, 0.13090746959570126, 0.13090725612546114, -69.31109570004419, 13072.701832338944, 151720.86863677748]
 [0.0015515092642622089, 776.6114534837521, 776.8827999260825, 0.006788704802538054, 0.9996778545536413, 0.9996797455120456, 0.001777587351470957, 0.00263935873673494, 0.0017051054440368307, 0.0013294272875113069  …  0.13084504447392037, 0.13084482576529802, 0.13084460820573243, 0.13084439173329068, 0.1308441762882346, 0.13084396181287897, 0.130843748251474, -69.29857628520374, 13066.876828330138, 151726.71048137234]
 [0.001546099917744937, 776.4921378529239, 776.7624993941154, 0.006794987653764583, 0.9996769040237058, 0.9996787961269112, 0.0017810546035225171, 0.0026420282303189374, 0.0017068384414407796, 0.001332295915759144  …  0.13077639187224516, 0.1307761751639068, 0.1307759597243997, 0.13077574547804005, 0.13077553235243192, 0.13077532027834401, 0.1307751091895762, -69.28496532335755, 13060.566601820696, 151733.0389581566]
 [0.0015411960528028653, 776.3837273778056, 776.6531968706557, 0.006800693804380911, 0.9996760443406981, 0.9996779285939952, 0.0017842106693477368, 0.0026444513130142707, 0.001708398848852424, 0.0013347986953421193  …  0.13071427167425334, 0.13071405620905216, 0.13071384194725397, 0.13071362882102497, 0.130713416765221, 0.13071320571725553, 0.13071299561697547, -69.27261557715701, 13054.844288528688, 151738.77782154072]
 [0.0015403084058026003, 776.3640181941181, 776.6333261623741, 0.006801732548185651, 0.9996758889016695, 0.9996777711991756, 0.0017847850302652082, 0.0026448925138628262, 0.0017086843148178287, 0.0013352730843384996  …  0.13070300298920315, 0.1307027877888634, 0.13070257379195904, 0.1307023609306982, 0.13070214913997516, 0.13070193835723878, 0.1307017285223683, -69.27036846678669, 13053.804729522863, 151739.8203872803]
plot(sol2, idxs=(sys.t/1000, sys.vm), title="Action potential", ylabel="mV", xlabel="Time (s)", label=false)
_images/91976af65535517edf85575de1f2f813356807f9c2fb4b747e8e7b0961c89666.png
plot(sol2, idxs=(sys.t/1000, sys.vm), title="Action potential", tspan=(299second, 300second), ylabel="mV", xlabel="Time (s)", label=false)
_images/649912a0fd6f5bcff195e5e7ea9730f1235bdb3108a4e4c03a6a87715ef8e94c.png
plot(sol2, idxs=(sys.t/1000, [sys.Cai_sub_SR * 1000, sys.Cai_sub_SL * 1000, sys.Cai_mean * 1000]), tspan=(299second, 300second), title="Calcium transient", ylabel="nM", xlabel="Time (s)", label=["CaSR" "CaSL" "CaAvg"])
_images/8d36b97a879d1959bc459d27ab867c561bc6ad7416953cba12c747bd95e00d80.png
plot(sol2, idxs=(sys.t/1000, sys.CaMKAct * 100), title="Active CaMKII", ylabel="Active CaMKII (%)", xlabel="Time (s)", label=false)
_images/559cf9be8699c238313106244b85a8b73a378fa817d2b5974952589f2ae52d04.png

Comparing 1 and 2 Hz pacing#

plot(sol, idxs=(sys.t/1000, sys.vm), title="Action potential", lab="1Hz",  tspan=(299second, 300second))
plot!(sol2, idxs=(sys.t/1000, sys.vm), lab="2Hz", tspan=(299second, 300second), xlabel="Time (s)", ylabel="Voltage (mV)")
_images/b5f7121db9346c7e3471d28b62f33ab447875850019df3119d7dbb8d9542805a.png
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 (%)")
_images/01ba2267ce96eed154147d6667c7891b8c1c7a99c58a476066cb1f75fe166f89.png

This notebook was generated using Literate.jl.