You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
simplify_fractions changes ModelingToolkit parameters to variables in some very rare cases. This creates problems downstream when using structural_simplify (unbalanced reaction system). The stdout from this code block in the SBMLToolkit.get_massaction function coarsely describes the issue:
println("--- before division ---")
println(kl)
println(get_variables(kl))
for v inget_variables(kl)
println(SymbolicUtils.metadata(v))
endprintln(ModelingToolkit.isparameter.(get_variables(kl)))
rate_const = kl /*((.^(reactants, stoich))...)
println("--- before simplifying fractions ---")
println(rate_const)
println(get_variables(rate_const))
for v inget_variables(rate_const)
println(SymbolicUtils.metadata(v))
endprintln(ModelingToolkit.isparameter.(get_variables(rate_const)))
rate_const = SymbolicUtils.simplify_fractions(rate_const)
println("--- after simplifying fractions ---")
println(rate_const)
println(get_variables(rate_const))
for v inget_variables(rate_const)
println(SymbolicUtils.metadata(v))
endprintln(ModelingToolkit.isparameter.(get_variables(rate_const)))
(Strangely, most reactions work fine, as does the following MWE:
using SymbolicUtils, ModelingToolkit
@parameters a b t
@variablesc(t)
kl = a * c / b
f1 = kl / c
println(get_variables(f1)) # Any[a, b]println(ModelingToolkit.isparameter.(get_variables(f1))) # Bool[1, 1]
f2 = SymbolicUtils.simplify_fractions(f1)
println(get_variables(f2)) # Any[a, b]println(ModelingToolkit.isparameter.(get_variables(f2))) # Bool[1, 1]
@shashi this one is going to cause (or perhaps is causing) issues for SBMLToolkit, Catalyst and ModelingToolkit. Is there a workaround one can use to avoid it till it gets fixed? Thanks!
In my use case, the output of rate_cost = SymbolicUtils.simplify_fractions(rate_const) is expected to be a functions of parameters only. To something like convert_all_vars_to_pars(rate_const) should fix it for me. Is there a function that does sth like that?
simplify_fractions
changes ModelingToolkit parameters to variables in some very rare cases. This creates problems downstream when usingstructural_simplify
(unbalanced reaction system). The stdout from this code block in the SBMLToolkit.get_massaction function coarsely describes the issue:prints for example
(Strangely, most reactions work fine, as does the following MWE:
)
cc @isaacsas
The text was updated successfully, but these errors were encountered: