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

type of parameters not always preserved with symbolic indexing #939

Closed
isaacsas opened this issue Jun 10, 2024 · 6 comments
Closed

type of parameters not always preserved with symbolic indexing #939

isaacsas opened this issue Jun 10, 2024 · 6 comments

Comments

@isaacsas
Copy link
Member

using Catalyst, ModelingToolkit
revsys = @reaction_network revsys begin
    @parameters m::Int n::Int
    k₊, m*A --> (m*n)*B
    k₋, B --> A
end
typeof(ModelingToolkit.unwrap(revsys.k₊))  # SymbolicUtils.BasicSymbolic{Real}

Same issue with symbolic interface

using Catalyst, ModelingToolkit
t = default_t()
@parameters m::Int n::Int k₊ k₋
@species A(t) B(t)
rx1 = Reaction(k₊, [A], [B], [m], [m*n])   
rx2 = Reaction(k₋, [B], [A])
@named revsys = ReactionSystem([rx1, rx2], t)
typeof(ModelingToolkit.unwrap(revsys.k₊))  # SymbolicUtils.BasicSymbolic{Real}
@isaacsas
Copy link
Member Author

Seems like this is related to symbolic indexing:

julia> parameters(revsys)
4-element Vector{Any}:
 m
 n
 k₊
 k₋

julia> typeof.(parameters(revsys))
4-element Vector{DataType}:
 SymbolicUtils.BasicSymbolic{Int64}
 SymbolicUtils.BasicSymbolic{Int64}
 SymbolicUtils.BasicSymbolic{Real}
 SymbolicUtils.BasicSymbolic{Real}

@isaacsas isaacsas changed the title type of parameters not always preserved correctly in generated ReactionSystem type of parameters not always preserved with symbolic indexing Jun 10, 2024
@isaacsas
Copy link
Member Author

Not sure if this is actually a Catalyst-level issue or MTK-level.

@isaacsas
Copy link
Member Author

Also, using @unpack seems to preserve the type ok.

@isaacsas
Copy link
Member Author

@TorkelE is this one there is already an issue for?

@isaacsas
Copy link
Member Author

This does not appear to happen for ODESystems, so is a Catalyst-related issue.

@isaacsas
Copy link
Member Author

I'm dumb, there is no issue here...

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

No branches or pull requests

1 participant