@@ -8,7 +8,6 @@ using CurveFit
88using CaMKIIModel
99using CaMKIIModel: second
1010Plots. default (lw= 1.5 )
11-
1211# ## Experiments
1312freqdf = CSV. read (joinpath (@__DIR__ , " data/CaMKAR-freq.csv" ), DataFrame)
1413ts = 0 : 5 : 205
@@ -23,7 +22,6 @@ plot!(title="Experiment", xlabel="Time (s)", ylabel="CaMKII activity (AU)")
2322
2423# ---
2524savefig (" pacing-frequency-exp.pdf" )
26-
2725# ## Simulations
2826@time " Build system" @mtkcompile sys = build_neonatal_ecc_sys ()
2927tend = 205.0 second
@@ -47,7 +45,6 @@ plot!(title="Simulation", xlabel="Time (s)", ylabel="CaMKII activity (%)")
4745
4846# ---
4947savefig (" pacing-frequency-sim.pdf" )
50-
5148# ## Phosphorylated fraction
5249idxs = (sys. t / 1000 , (sys. CaMKP + sys. CaMKA + sys. CaMKA2) * 100 )
5350plot (sol1, idxs= idxs, lab= " 1 Hz" , color= :blue )
@@ -56,3 +53,50 @@ plot!(title="Simulation", xlabel="Time (s)", ylabel="Phosphorylated CaMKII (%)")
5653
5754# ---
5855savefig (" pacing-frequency-phos.pdf" )
56+
57+ # ## Decay rates
58+ # Fit against an exponential decay model.
59+ decay_model (p, x) = @. p[1 ] * exp (- x / p[2 ]) + p[3 ]
60+
61+ # Data from experiments
62+ # Record 50 seconds after pacing ends
63+ ts = collect (range (0.0 , stop= 50.0 , step= 5.0 ))
64+ ydata_1hz = onehz[24 : 34 ]
65+ ydata_2hz = twohz[24 : 34 ]
66+
67+ # Simulation points
68+ ysim_1hz = sol1 (stimend: 5 second: stimend+ 50 second ; idxs= sys. CaMKAct * 100 ). u
69+ ysim_2hz = sol2 (stimend: 5 second: stimend+ 50 second ; idxs= sys. CaMKAct * 100 ). u
70+
71+ # Fit data to an exponential decay model
72+ fit_1hz = solve (CurveFitProblem (ts, ydata_1hz), ExpSumFitAlgorithm (n= 1 , withconst= true ))
73+ fit_2hz = solve (CurveFitProblem (ts, ydata_2hz), ExpSumFitAlgorithm (n= 1 , withconst= true ))
74+ fit_1hz_sim = solve (CurveFitProblem (ts, ysim_1hz), ExpSumFitAlgorithm (n= 1 , withconst= true ))
75+ fit_2hz_sim = solve (CurveFitProblem (ts, ysim_2hz), ExpSumFitAlgorithm (n= 1 , withconst= true ))
76+
77+ # Fitting results (experiments)
78+ p1 = plot (ts, ydata_1hz, label= " Exp 1 Hz" )
79+ plot! (p1, ts, predict (fit_1hz), label= " Fit" , linestyle= :dash )
80+ p2 = plot (ts, ydata_2hz, label= " Exp 2 Hz" )
81+ plot! (p2, ts, predict (fit_2hz), label= " Fit" , linestyle= :dash )
82+ p3 = plot (ts, ysim_1hz, label= " Sim 1 Hz" )
83+ plot! (p3, ts, predict (fit_1hz_sim), label= " Fit" , linestyle= :dash )
84+ p4 = plot (ts, ysim_2hz, label= " Sim 2 Hz" )
85+ plot! (p4, ts, predict (fit_2hz_sim), label= " Fit" , linestyle= :dash )
86+ plot (p1, p2, p3, p4, layout= (2 ,2 ), xlabel= " Time (s)" , ylabel= " CaMKII activity (AU)" )
87+
88+
89+ # Calculate time scales (tau) from fit parameters
90+ tau_exp_1hz = inv (- fit_1hz. u. λ[])
91+ tau_exp_2hz = inv (- fit_2hz. u. λ[])
92+ tau_sim_1hz = inv (- fit_1hz_sim. u. λ[])
93+ tau_sim_2hz = inv (- fit_2hz_sim. u. λ[])
94+
95+ println (" The time scales for experiments: " )
96+ for (tau, freq) in zip ((tau_exp_1hz, tau_exp_2hz), (1 , 2 ))
97+ println (" $freq Hz pacing is $(round (tau; digits= 2 )) seconds." )
98+ end
99+ println (" The time scales for simulations: " )
100+ for (tau, freq) in zip ((tau_sim_1hz, tau_sim_2hz), (1 , 2 ))
101+ println (" $freq Hz pacing is $(round (tau; digits= 2 )) seconds." )
102+ end
0 commit comments