Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oscardssmith committed Jan 19, 2024
1 parent d10c568 commit 9188660
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/problems/problem_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Base.@propagate_inbounds function Base.getindex(prob::AbstractSciMLProblem, sym)
elseif is_independent_variable(prob.f, sym)
return getindepsym(prob)
elseif is_observed(prob.f, sym)
obs = SymbolicIndexingInterface.observed(prob.f, sym)
obs = SymbolicIndexingInterface.observed(prob, sym)

Check warning on line 24 in src/problems/problem_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/problems/problem_interface.jl#L24

Added line #L24 was not covered by tests
if is_time_dependent(prob.f)
return obs(prob.u0, prob.p, 0.0)
else
Expand Down
7 changes: 0 additions & 7 deletions src/solutions/solution_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ SymbolicIndexingInterface.is_independent_variable(::AbstractNoTimeSolution, sym)

SymbolicIndexingInterface.independent_variable_symbols(::AbstractNoTimeSolution) = []

for soltype in [AbstractTimeseriesSolution, AbstractNoTimeSolution]
@eval function SymbolicIndexingInterface.observed(A::$(soltype), sym::Symbol)
has_sys(A.prob.f) || error("Cannot use observed without system")
return SymbolicIndexingInterface.observed(A, getproperty(A.prob.f.sys, sym))
end
end

SymbolicIndexingInterface.is_time_dependent(::AbstractTimeseriesSolution) = true

SymbolicIndexingInterface.is_time_dependent(::AbstractNoTimeSolution) = false
Expand Down
1 change: 1 addition & 0 deletions test/downstream/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1"
Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4"
Expand Down
2 changes: 1 addition & 1 deletion test/downstream/symbol_indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ end
@testset "observed shouldn't error" begin
for obj in [prob, integ, sol]
obj[:a]
observed(obh, :a)
SymbolicIndexingInterface.observed(obj, :a)
end
end

Expand Down

0 comments on commit 9188660

Please sign in to comment.