Skip to content

Cannot change parameter and pass parameters to model #93

Open
@TS-CUBED

Description

@TS-CUBED

I am trying to change the parameter in a cellML model, but the method in the Readme/Tutorial does not work anymore.

Steps to reproduce:

  1. Download beeler_reuter_1977.cellml.xml.
  2. Setup as in tutorial and try to change the parameter:
ml = CellModel("models/beeler_reuter_1977.cellml.xml")

p = list_params(ml)
update_list!(p, :stimulus_protocol₊IstimPeriod, 250.0)
prob = ODEProblem(ml, (0, 10000); p=p)

Error occurs:

ERROR: MethodError: no method matching float(::Type{Any})
Closest candidates are:
  float(::Type{Union{Missing, T}}) where T at missing.jl:112
  float(::Any) at float.jl:269
  float(::Union{StatsBase.PValue, StatsBase.TestStat}) at ~/.julia/packages/StatsBase/XgjIN/src/statmodels.jl:86
  ...
Stacktrace:
 [1] float(#unused#::Type{Any})
   @ Base ./missing.jl:113
 [2] promote_to_concrete(vs::Vector{Any}; tofloat::Bool, use_union::Bool)
   @ ModelingToolkit ~/.julia/packages/ModelingToolkit/5qzZn/src/utils.jl:601
 [3] varmap_to_vars(varmap::Vector{Any}, varlist::Vector{Sym{Real, Base.ImmutableDict{DataType, Any}}}; defaults::Dict{Any, Any}, check::Bool, toterm::Function, promotetoconcrete::Nothing, tofloat::Bool, use_union::Bool)
   @ ModelingToolkit ~/.julia/packages/ModelingToolkit/5qzZn/src/variables.jl:69
 [4] process_DEProblem(constructor::Type, sys::ODESystem, u0map::Vector{Float64}, parammap::Vector{Any}; implicit_dae::Bool, du0map::Nothing, version::Nothing, tgrad::Bool, jac::Bool, checkbounds::Bool, sparse::Bool, simplify::Bool, linenumbers::Bool, parallel::Symbolics.SerialForm, eval_expression::Bool, use_union::Bool, kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol, Symbol}, NamedTuple{(:has_difference, :check_length), Tuple{Bool, Bool}}})
   @ ModelingToolkit ~/.julia/packages/ModelingToolkit/5qzZn/src/systems/diffeqs/abstractodesystem.jl:544
 [5] (ODEProblem{true})(sys::ODESystem, u0map::Vector{Float64}, tspan::Tuple{Int64, Float64}, parammap::Vector{Any}; callback::Nothing, check_length::Bool, kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:jac,), Tuple{Bool}}})
   @ ModelingToolkit ~/.julia/packages/ModelingToolkit/5qzZn/src/systems/diffeqs/abstractodesystem.jl:637
 [6] #ODEProblem#487
   @ ~/.julia/packages/ModelingToolkit/5qzZn/src/systems/diffeqs/abstractodesystem.jl:629 [inlined]
 [7] ODEProblem(ml::CellModel, tspan::Tuple{Int64, Float64}; jac::Bool, level::Int64, p::Vector{Any}, u0::Vector{Float64})
   @ CellMLToolkit ~/.julia/packages/CellMLToolkit/Pnsff/src/CellMLToolkit.jl:49
 [8] top-level scope
   @ ~/.julia/dev/CirculationModels/cases/ShiModel/Shi.jl:147

Note: That top-level scope is just the actual model I am working on. But the error occurs on the model from the tutorial as well.

Versions:
Julia 1.8.0
[03cb29e0] CellMLToolkit v2.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions