SciMLBase.jl
SciMLBase.jl copied to clipboard
EnsembleSummary plots can ignore idxs
using Catalyst, DifferentialEquations, Plots
rn = @reaction_network begin
1.0, A --> 0
2.0, B --> 0
4.0, C --> 0
end
dprob = DiscreteProblem(rn, [:A => 100, :B => 10, :C => 5], (0.0,20.0))
jprob = JumpProblem(rn, dprob, Direct())
eprob = EnsembleProblem(jprob)
sims = solve(eprob, SSAStepper(), trajectories=100)
@unpack A,C = rn
plot(sims, idxs=[A,C])
plots just the trajectories for species A
and C
, while
summ = EnsembleSummary(sims)
plot(summ; idxs=[A,C])
plots all three species.
i have a similar issue! i mine is similar but i don't have dictionary output, it fails with just a vector output
Similar issue here.
Looking at the plot recipe for EnsembleSummary, I don't see the idxs
keyword described in the documentation, but rather a trajectories
keyword to which one can provide the indices of the desired variables.
So, in @isaacsas' case, I'd try plot(summ; idxs=(1,3))
.
On top of that, in my case I have an ODESystem preprocessed by structural_simplify
(MTK), and I would like to plot a variable of summ
which is in sims.prob.f.paramsyms
but not in sims.prob.f.syms
(using the variable names of @isaacsas' example). I wonder if there's an easy way to do that.
Yeah this is just a bug in the plot recipe. Right now the answer is to plot each individually until someone gets around to handling it.
Just to suggest an alternative to each plotting individually, for large systems.
AFAIS, the order of the variable is preserved by solve
and EnsembleSummary
, so one way to retrieve the corresponding trajectory indices is with println.(enumerate(states(sys))
where sys
is the ODESystem
.
That works for variables other than the ones that are just the observed