Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

At ODESystem/CellModel construction time, use list_states and list_params as defaults in constructor #56

Closed
anandijain opened this issue Jul 4, 2021 · 1 comment · Fixed by #100

Comments

@anandijain
Copy link
Contributor

https://mtk.sciml.ai/stable/tutorials/ode_modeling/#Defaults

We should automatically set the defaults. This is in line with how SBMLToolkit is doing it, and it makes usage much nicer.

@anandijain
Copy link
Contributor Author

anandijain commented Jul 4, 2021

I have to do this big workaround. Since more often than not, users will be working with Systems, not Problems.

I don't know exactly how to do it, but the defaults kwarg just needs to be passed in to the ODESystem constructor in process_component

sys1 = getsys(CellModel(fn))
u0 = Dict(convert(Vector{Pair}, list_states(ml)))
ps = Dict(convert(Vector{Pair}, list_params(ml)))
defaults = merge(u0, ps)
sys1 = ODESystem(equations(sys1), independent_variable(sys1), states(sys1), parameters(sys1); defaults=defaults)

bauglir added a commit to bauglir/CellMLToolkit.jl that referenced this issue Dec 16, 2022
CellML files contain `initial_value` fields specifying initial values
for parameters and states in the system. Retrieving these for the
`ODESystem` was already possible, but had to be done separately or as
part of the `ODEProblem` constructor defined for `CellModel`s.

Defaults are only set for simplified `ODESystem`s. Unsimplified
`ODESystem`s may contain parameters and states for which no defaults are
available resulting in errors trying to construct the `ODESystem`. These
errors will still occur when using the result of calling
`process_components` with `simplify = false`, but as noted in the code
that should only be done for debugging purposes and this functionality
is not exposed at the higher API levels.

Fixes SciML#56.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant