Skip to content

Commit 0e5d5cd

Browse files
Merge pull request #734 from SciML/downstream
Fix downstream test guess
2 parents f76fb4a + 868eb9e commit 0e5d5cd

File tree

8 files changed

+31
-23
lines changed

8 files changed

+31
-23
lines changed

ext/SciMLBaseMakieExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ end
345345
function Makie.convert_arguments(::Type{<:Lines},
346346
sim::SciMLBase.EnsembleSummary;
347347
idxs = sim.u.u[1] isa AbstractArray ? eachindex(sim.u.u[1]) :
348-
1,
348+
1,
349349
error_style = :ribbon, ci_type = :quantile,
350350
kwargs...)
351351
if ci_type == :SEM

src/ensemble/ensemble_solutions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ end
159159

160160
@recipe function f(sim::EnsembleSummary;
161161
idxs = sim.u.u[1] isa AbstractArray ? eachindex(sim.u.u[1]) :
162-
1,
162+
1,
163163
error_style = :ribbon, ci_type = :quantile)
164164
if ci_type == :SEM
165165
if sim.u.u[1] isa AbstractArray

src/problems/basic_problems.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ For specifying Jacobians and mass matrices, see the
232232
* `kwargs`: The keyword arguments passed on to the solvers.
233233
"""
234234
mutable struct NonlinearProblem{uType, isinplace, P, F, K, PT} <:
235-
AbstractNonlinearProblem{uType, isinplace}
235+
AbstractNonlinearProblem{uType, isinplace}
236236
f::F
237237
u0::uType
238238
p::P
@@ -322,8 +322,6 @@ function Base.setproperty!(prob::NonlinearProblem, s::Symbol, v, order::Symbol)
322322
Base.setfield!(prob, s, v, order)
323323
end
324324

325-
326-
327325
@doc doc"""
328326
Defines a nonlinear least squares problem.
329327

src/problems/bvp_problems.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,15 +360,16 @@ struct SecondOrderBVProblem{uType, tType, isinplace, nlls, P, F, PT, K} <:
360360
_u0 = prepare_initial_state(u0)
361361
_tspan = promote_tspan(tspan)
362362
warn_paramtype(p)
363-
prob_type = TP ? TwoPointSecondOrderBVProblem{iip}() : StandardSecondOrderBVProblem()
363+
prob_type = TP ? TwoPointSecondOrderBVProblem{iip}() :
364+
StandardSecondOrderBVProblem()
364365

365366
# Needed to ensure that `problem_type` doesn't get passed in kwargs
366367
if problem_type === nothing
367368
problem_type = prob_type
368369
else
369370
@assert prob_type===problem_type "This indicates incorrect problem type specification! Users should never pass in `problem_type` kwarg, this exists exclusively for internal use."
370371
end
371-
372+
372373
return new{typeof(_u0), typeof(_tspan), iip, typeof(nlls), typeof(p), typeof(f),
373374
typeof(problem_type), typeof(kwargs)}(f, _u0, _tspan, p, problem_type, kwargs)
374375
end

src/remake.jl

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ function remake(prob::AbstractSciMLProblem; u0 = missing,
6363
_remake_internal(prob; kwargs..., u0, p)
6464
end
6565

66-
function remake(prob::AbstractIntervalNonlinearProblem; p = missing, interpret_symbolicmap = true, use_defaults = false, kwargs...)
66+
function remake(prob::AbstractIntervalNonlinearProblem; p = missing,
67+
interpret_symbolicmap = true, use_defaults = false, kwargs...)
6768
_, p = updated_u0_p(prob, [], p; interpret_symbolicmap, use_defaults)
6869
_remake_internal(prob; kwargs..., p)
6970
end
@@ -102,19 +103,25 @@ function remake(prob::ODEProblem; f = missing,
102103
iip = isinplace(prob)
103104

104105
if f === missing
105-
initializeprob, initializeprobmap = remake_initializeprob(prob.f.sys, prob.f, u0 === missing ? newu0 : u0, tspan[1], p === missing ? newp : p)
106+
initializeprob, initializeprobmap = remake_initializeprob(
107+
prob.f.sys, prob.f, u0 === missing ? newu0 : u0,
108+
tspan[1], p === missing ? newp : p)
106109
if specialization(prob.f) === FunctionWrapperSpecialize
107110
ptspan = promote_tspan(tspan)
108111
if iip
109-
_f = ODEFunction{iip, FunctionWrapperSpecialize}(wrapfun_iip(
110-
unwrapped_f(prob.f.f),
111-
(newu0, newu0, newp,
112-
ptspan[1])); initializeprob, initializeprobmap)
112+
_f = ODEFunction{iip, FunctionWrapperSpecialize}(
113+
wrapfun_iip(
114+
unwrapped_f(prob.f.f),
115+
(newu0, newu0, newp,
116+
ptspan[1]));
117+
initializeprob, initializeprobmap)
113118
else
114-
_f = ODEFunction{iip, FunctionWrapperSpecialize}(wrapfun_oop(
115-
unwrapped_f(prob.f.f),
116-
(newu0, newp,
117-
ptspan[1])); initializeprob, initializeprobmap)
119+
_f = ODEFunction{iip, FunctionWrapperSpecialize}(
120+
wrapfun_oop(
121+
unwrapped_f(prob.f.f),
122+
(newu0, newp,
123+
ptspan[1]));
124+
initializeprob, initializeprobmap)
118125
end
119126
else
120127
_f = prob.f
@@ -138,7 +145,8 @@ function remake(prob::ODEProblem; f = missing,
138145
end
139146

140147
if kwargs === missing
141-
ODEProblem{isinplace(prob)}(_f, newu0, tspan, newp, prob.problem_type; prob.kwargs...,
148+
ODEProblem{isinplace(prob)}(
149+
_f, newu0, tspan, newp, prob.problem_type; prob.kwargs...,
142150
_kwargs...)
143151
else
144152
ODEProblem{isinplace(prob)}(_f, newu0, tspan, newp, prob.problem_type; kwargs...)

test/downstream/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
2626
BoundaryValueDiffEq = "5"
2727
ForwardDiff = "0.10"
2828
JumpProcesses = "9.10"
29-
ModelingToolkit = "8.37, 9"
29+
ModelingToolkit = "9"
3030
ModelingToolkitStandardLibrary = "2.7"
3131
NonlinearSolve = "2, 3"
3232
Optimization = "3"

test/downstream/modelingtoolkit_remake.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ k = ShiftIndex(t)
6969
# Roundabout method to avoid having to specify values for previous timestep
7070
fn = DiscreteFunction(discsys)
7171
ps = ModelingToolkit.MTKParameters(discsys, p)
72-
discu0 = Dict([u0..., x(k-1) => 0.0, y(k-1) => 0.0, z(k-1) => 0.0])
72+
discu0 = Dict([u0..., x(k - 1) => 0.0, y(k - 1) => 0.0, z(k - 1) => 0.0])
7373
push!(syss, discsys)
7474
push!(probs, DiscreteProblem(fn, getindex.((discu0,), unknowns(discsys)), (0, 10), ps))
7575

@@ -145,7 +145,8 @@ for (sys, prob) in zip(syss, probs)
145145
prob2 = @inferred baseType remake(prob; u0 = [x => 0.5σ + 1], p ==> 0.5x + 1])
146146
@test ugetter(prob2) [15.0, 0.0, 0.0]
147147
@test pgetter(prob2) [28.0, 8.5, 10.0]
148-
prob2 = @inferred baseType remake(prob; u0 = [sys.x => 0.5σ + 1], p = [sys.β => 0.5x + 1])
148+
prob2 = @inferred baseType remake(
149+
prob; u0 = [sys.x => 0.5σ + 1], p = [sys.β => 0.5x + 1])
149150
@test ugetter(prob2) [15.0, 0.0, 0.0]
150151
@test pgetter(prob2) [28.0, 8.5, 10.0]
151152
# Not testing `Symbol => expr` since nested substitution doesn't work with that

test/downstream/observables_autodiff.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function create_model(; C₁ = 3e-5, C₂ = 1e-6)
6969
systems = [
7070
resistor1, resistor2, capacitor1, capacitor2,
7171
source, input_signal, ground, ampermeter
72-
])
72+
], defaults = [resistor1.n.v => 0.0])
7373
end
7474

7575
@testset "DAE Observable function AD" begin
@@ -96,7 +96,7 @@ end
9696
# # mean(abs.(sol[sys.ampermeter.i] .- gt))
9797
# sum(sol[sys.ampermeter.i])
9898
# end
99-
#
99+
#
100100
# @test isnothing(gs_mtkp)
101101
# @test length(gs_p_new) == length(p_new)
102102
# end

0 commit comments

Comments
 (0)