CellmlToolkit.jl: How to get observables?


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

But I do not understand how to get them calculated over time (and then plot, for example) after I solve the model.

For example, I would like to do this like:

prob = ODEProblem(ml, (0, 42.0))
sol = solve(prob)

but this does not work.
Could you help me?

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

This is missing docs so I just pinged @YingboMa to make sure the namespacing gets documented.

1 Like

Thank you!
@nonamespace did everything I needed.

And we can make that a bit more automatic in the near future.