Open moble opened 1 month ago
@moble Thanks for reporting! This is indeed a big in the interface, this particular way of defining models does not quite work in the current versions. I am refactoring right now ModelingToolkit interface, I will fix this as well.
For the time being, you can just pass the observed quantities to the function directly like this
using StructuralIdentifiability, ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D
@mtkmodel Biohydrogenation begin
@variables begin
x4(t)
x5(t)
x6(t)
x7(t)
y1(t), [output = true]
y2(t), [output = true]
end
@parameters begin
k5
k6
k7
k8
k9
k10
end
# define equations
@equations begin
D(x4) ~ -k5 * x4 / (k6 + x4)
D(x5) ~ k5 * x4 / (k6 + x4) - k7 * x5 / (k8 + x5 + x6)
D(x6) ~ k7 * x5 / (k8 + x5 + x6) - k9 * x6 * (k10 - x6) / k10
D(x7) ~ k9 * x6 * (k10 - x6) / k10
end
end
# define the system
@mtkbuild de = Biohydrogenation()
x4, x5, x6, x7 = unknowns(de)
# query local identifiability
# we pass the ode-system
local_id_all = assess_local_identifiability(de, measured_quantities = [x4, x5], prob_threshold = 0.99)
Thanks for looking into this, Gleb! Since posting this, I took a look too and found ModelingToolkit.observed
. Is this what you need? In particular, could you change the signatures in your extension to use that as a default value, like this:
function StructuralIdentifiability.find_identifiable_functions(
ode::ModelingToolkit.ODESystem;
measured_quantities = ModelingToolkit.observed(ode),
Thanks for your help!
Thanks for looking into this, Gleb! Since posting this, I took a look too and found
ModelingToolkit.observed
. Is this what you need? In particular, could you change the signatures in your extension to use that as a default value, like this:function StructuralIdentifiability.find_identifiable_functions( ode::ModelingToolkit.ODESystem; measured_quantities = ModelingToolkit.observed(ode),
Thanks for your help!
Thanks! We indeed used observed
before (but in a less nice way as you proposed) but this code was lost in some transformations and, apparently, was not covered in the tests. I will fix this for the next release.
@moble Thanks again for reporting this!
The example should work with the new release of StructuralIdentifiability
(0.5.9
) as you wrote it originally.
Describe the bug 🐞
Following the example on this page results in
I'm not sure that this package is really to blame. Maybe @pogudingleb could provide some insight?
Expected behavior
I would have thought that marking
y1(t)
andy2(t)
with[output = true]
would be enough to communicate that these are outputs.Minimal Reproducible Example 👇
I've just copied the example code, but run it in a temp environment:
Error & Stacktrace ⚠️
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()