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

Symbolic indexing doesn't work when plotting ensemble summary #3491

Open
TorkelE opened this issue Mar 23, 2025 · 4 comments
Open

Symbolic indexing doesn't work when plotting ensemble summary #3491

TorkelE opened this issue Mar 23, 2025 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@TorkelE
Copy link
Member

TorkelE commented Mar 23, 2025

Giving integer indexes does work, but generally shouldn't work in MTK?

using Catalyst
repressilator = @reaction_network begin
    hillr(Z,v,K,n), ∅ --> X
    hillr(X,v,K,n), ∅ --> Y
    hillr(Y,v,K,n), ∅ --> Z
    d, (X, Y, Z) -->end

u0 = [:X => 45.0, :Y => 20.0, :Z => 20.0]
tend = 200.0
ps = [:v => 10.0, :K => 20.0, :n => 3, :d => 0.1]
sprob = SDEProblem(repressilator, u0, tend, ps)

using StochasticDiffEq, Plots
eprob = EnsembleProblem(sprob)
sol = solve(eprob, ImplicitEM(); trajectories = 200)
esummary = EnsembleAnalysis.EnsembleSummary(sol_intrinsic, 0.0:1.0:200.0)

plot(esummary; idxs = 1) # OK
plot(esummary; idxs = repressilator.X) # Error: `ERROR: ArgumentError: invalid index: X(t) of type SymbolicUtils.BasicSymbolic{Real}`.
plot(esummary; idxs = [repressilator.X]) # Error: `ERROR: ArgumentError: invalid index: X(t) of type SymbolicUtils.BasicSymbolic{Real}`.
@TorkelE TorkelE added the bug Something isn't working label Mar 23, 2025
@AayushSabharwal
Copy link
Member

Integer indexing will always work. Symbolic indexing can be made to work as well.

@AayushSabharwal
Copy link
Member

The plot recipe doesn't handle symbolic indexes.

@TorkelE
Copy link
Member Author

TorkelE commented Mar 24, 2025

Wasnät there a big thing that you shouldn't use integer indexing for MTK+style models, as you cannot know which index the different parameter have (in case MTK scrambles them up)? (or is integer indexing something that we actually want users to use?)

@ChrisRackauckas
Copy link
Member

Yes, so we need to fix EnsembleSummary to pass along the symbolic information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants