Skip to content

Commit

Permalink
fix prob and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
oscardssmith committed Jan 11, 2024
1 parent d30ca0b commit b20bba8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/problems/problem_interface.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
SymbolicIndexingInterface.symbolic_container(prob::AbstractSciMLProblem) = prob.f
function SymbolicIndexingInterface.is_observed(A::AbstractSciMLProblem, sym)
return !is_variable(A, sym) && !is_parameter(A, sym) && !is_independent_variable(A, sym) && symbolic_type(sym) == ScalarSymbolic()
end
function SymbolicIndexingInterface.observed(A::AbstractSciMLProblem, sym)
return getobserved(A)(sym)
end

SymbolicIndexingInterface.parameter_values(prob::AbstractSciMLProblem) = prob.p
SymbolicIndexingInterface.state_values(prob::AbstractSciMLProblem) = prob.u0
SymbolicIndexingInterface.current_time(prob::AbstractSciMLProblem) = prob.tspan[1]
Expand Down
8 changes: 8 additions & 0 deletions test/downstream/symbol_indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ sol = solve(prob, Rodas4())
end
end

@testset "observed shouldn't error" begin
for obj in [prob, integ, sol]
obj[:a]
observed(obh, :a)
end
end


@test sol[a] isa AbstractVector
@test sol[:a] == sol[a]
@test sol[a, 1] isa Real
Expand Down

0 comments on commit b20bba8

Please sign in to comment.