SciML / CellMLToolkit.jl

CellMLToolkit.jl is a Julia library that connects CellML models to the Scientific Julia ecosystem.
https://docs.sciml.ai/CellMLToolkit/stable/
Other
62 stars 15 forks source link

How to get observables? #79

Closed AndreyPikunov closed 2 years ago

AndreyPikunov commented 2 years ago

Hello!

Using Beeler-Reuter model from the README I can list observables:

julia> ml = CellModel("models/beeler_reuter_1977.cellml.xml")
julia> observed(ml.sys)
39-element Vector{Equation}:
 slow_inward_current_f_gate₊V(time) ~ membrane₊V(time)
 slow_inward_current₊f(time) ~ slow_inward_current_f_gate₊f(time)
 ⋮
 time_dependent_outward_current₊i_x1(time) ~ membrane₊i_x1(time)
 slow_inward_current₊i_s(time) ~ membrane₊i_s(time)
julia> ml.sys.membrane₊i_Na
var"##ODESystem#257₊membrane₊i_Na"(time)

But I do not understand how to get them calculated over time after I solve the model. Could you help me?

ChrisRackauckas commented 2 years ago

sol[ml.sys.membrane₊i_Na]

AndreyPikunov commented 2 years ago

I should mention this discourse answer to my question: https://discourse.julialang.org/t/cellmltoolkit-jl-how-to-get-observables/69151/2?u=andreypikunov

prob = ODEProblem(ml, (0, 42.0))
sol = solve(prob)
sys = ml.sys
sol[@nonamespace sys.membrane₊i_Na]