-
-
Couldn't load subscription status.
- Fork 233
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug π
Indexing with symbols (i.e. sol[:p] or sol.ps[:p]) throws an error.
Expected behavior
Should return / have the same behavior as sol[p].
Minimal Reproducible Example π
t = ModelingToolkit.t_nounits; D = ModelingToolkit.D_nounits
@variables x(t) = 1.
@parameters p(t) = 1.
ev = ModelingToolkit.SymbolicDiscreteCallback((t == 1) => [p ~ Pre(p)*2], discrete_parameters = p)
@mtkcompile sys = System([D(x) ~ p], t; discrete_events = ev)
prob = ODEProblem(sys, [], (0., 2.))
sol = solve(prob, Tsit5())
sol[p] # fine
sol.ps[p] # fine
sol[:p] # errors
sol.ps[:p] # errorsError & Stacktrace
ERROR: BoundsError: attempt to access Tuple{Int64, Int64} at index [3]
Stacktrace:
[1] getindex(t::Tuple, i::Int64)
@ Base ./tuple.jl:33
[2] parameter_index(sys::System, sym::Symbol)
@ ModelingToolkit ~/.julia/dev/ModelingToolkit/src/systems/abstractsystem.jl:237
[3] parameter_index (repeats 3 times)
@ ~/.julia/packages/SymbolicIndexingInterface/hhVqD/src/index_provider_interface.jl:59 [inlined]
[4] _getp(sys::ODESolution{β¦}, ::ScalarSymbolic, ::NotSymbolic, p::Symbol)
@ SymbolicIndexingInterface ~/.julia/packages/SymbolicIndexingInterface/hhVqD/src/parameter_indexing.jl:348
[5] getp
@ ~/.julia/packages/SymbolicIndexingInterface/hhVqD/src/parameter_indexing.jl:41 [inlined]
[6] getindex(::ParameterIndexingProxy{ODESolution{β¦}}, ::Symbol)
@ SymbolicIndexingInterface ~/.julia/packages/SymbolicIndexingInterface/hhVqD/src/parameter_indexing_proxy.jl:14
[7] top-level scope
@ REPL[212]:1Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working