Skip to content

Commit 7415195

Browse files
Merge pull request #1315 from abhro/semicolons
Remove var=var keyword argument repetition in function calls
2 parents ec0a572 + 64f75de commit 7415195

File tree

90 files changed

+1365
-1981
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1365
-1981
lines changed

docs/make.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ using Plots
99

1010
include("pages.jl")
1111

12-
makedocs(
12+
makedocs(;
1313
sitename = "SciMLSensitivity.jl",
1414
authors = "Chris Rackauckas et al.",
1515
modules = [SciMLSensitivity],
@@ -19,7 +19,7 @@ makedocs(
1919
assets = ["assets/favicon.ico"],
2020
canonical = "https://docs.sciml.ai/SciMLSensitivity/stable/"
2121
),
22-
pages = pages
22+
pages
2323
)
2424

2525
deploydocs(

docs/src/Benchmark.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ for sensealg in (SMS.InterpolatingAdjoint(autojacvec = SMS.ZygoteVJP()),
7070
SMS.QuadratureAdjoint(autojacvec = SMS.ReverseDiffVJP(true)),
7171
SMS.TrackerAdjoint())
7272
prob_neuralode = SMS.NeuralODE(dudt2, tspan, ODE.Tsit5(); saveat = tsteps,
73-
sensealg = sensealg)
73+
sensealg)
7474
ps, st = Lux.setup(Random.default_rng(), prob_neuralode)
7575
ps = CA.ComponentArray(ps)
7676

docs/src/examples/dde/delay_diffeq.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ prob_dde = DDE.DDEProblem(delay_lotka_volterra!, u0, h, (0.0, 10.0),
3434
constant_lags = [0.1])
3535
3636
function predict_dde(p)
37-
return Array(ODE.solve(prob_dde, DDE.MethodOfSteps(ODE.Tsit5()),
38-
u0 = u0, p = p, saveat = 0.1, sensealg = SMS.ReverseDiffAdjoint()))
37+
return Array(ODE.solve(prob_dde, DDE.MethodOfSteps(ODE.Tsit5());
38+
u0, p, saveat = 0.1, sensealg = SMS.ReverseDiffAdjoint()))
3939
end
4040
4141
loss_dde(p) = sum(abs2, x - 1 for x in predict_dde(p))
@@ -53,7 +53,7 @@ end
5353
adtype = OPT.AutoZygote()
5454
optf = OPT.OptimizationFunction((x, p) -> loss_dde(x), adtype)
5555
optprob = OPT.OptimizationProblem(optf, p)
56-
result_dde = OPT.solve(optprob, OPA.PolyOpt(), maxiters = 300, callback = callback)
56+
result_dde = OPT.solve(optprob, OPA.PolyOpt(); maxiters = 300, callback)
5757
```
5858

5959
Notice that we chose `sensealg = ReverseDiffAdjoint()` to utilize the ReverseDiff.jl
@@ -79,5 +79,5 @@ We use `Optimization.solve` to optimize the parameters for our loss function:
7979
adtype = OPT.AutoZygote()
8080
optf = OPT.OptimizationFunction((x, p) -> loss_dde(x), adtype)
8181
optprob = OPT.OptimizationProblem(optf, p)
82-
result_dde = OPT.solve(optprob, OPA.PolyOpt(), callback = callback)
82+
result_dde = OPT.solve(optprob, OPA.PolyOpt(); callback)
8383
```

docs/src/examples/hybrid_jump/bouncing_ball.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ u0 = [50.0, 0.0]
3232
tspan = (0.0, 15.0)
3333
p = [9.8, 0.8]
3434
prob = ODE.ODEProblem(f, u0, tspan, p)
35-
sol = ODE.solve(prob, ODE.Tsit5(), callback = callback)
35+
sol = ODE.solve(prob, ODE.Tsit5(); callback)
3636
```
3737

3838
Here we have a friction coefficient of `0.8`. We want to refine this
@@ -42,7 +42,7 @@ the value 20:
4242

4343
```@example bouncing_ball
4444
function loss(θ)
45-
sol = ODE.solve(prob, ODE.Tsit5(), p = [9.8, θ[1]], callback = callback)
45+
sol = ODE.solve(prob, ODE.Tsit5(), p = [9.8, θ[1]]; callback)
4646
target = 20.0
4747
abs2(sol[end][1] - target)
4848
end

docs/src/examples/hybrid_jump/hybrid_diffeq.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ affect!(integrator) = integrator.u[1:2] .= integrator.u[3:end]
4949
cb = DEC.PresetTimeCallback(dosetimes, affect!, save_positions = (false, false))
5050
5151
function predict_n_ode(p)
52-
_prob = ODE.remake(prob, p = p)
53-
Array(ODE.solve(_prob, ODE.Tsit5(), u0 = z0, p = p, callback = cb, saveat = t,
52+
_prob = ODE.remake(prob; p)
53+
Array(ODE.solve(_prob, ODE.Tsit5(); u0 = z0, p, callback = cb, saveat = t,
5454
sensealg = SMS.ReverseDiffAdjoint()))[1:2, :]
55-
#Array(solve(prob,Tsit5(),u0=z0,p=p,saveat=t))[1:2,:]
55+
#Array(solve(prob,Tsit5();u0=z0,p,saveat=t))[1:2,:]
5656
end
5757
5858
function loss_n_ode(p, _)

docs/src/examples/neural_ode/simplechains.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Now instead of the function `trueODE(u,p,t)` in the first code block, we pass th
4848
prob_nn = ODE.ODEProblem(f, u0, tspan)
4949
5050
function predict_neuralode(p)
51-
Array(ODE.solve(prob_nn, ODE.Tsit5(); p = p, saveat = tsteps,
51+
Array(ODE.solve(prob_nn, ODE.Tsit5(); p, saveat = tsteps,
5252
sensealg = SMS.QuadratureAdjoint(autojacvec = SMS.ZygoteVJP())))
5353
end
5454
@@ -77,9 +77,8 @@ callback = function (state, l; doplot = true)
7777
return false
7878
end
7979
80-
optf = OPT.OptimizationFunction((x, p) -> loss_neuralode(x),
81-
OPT.AutoZygote())
80+
optf = OPT.OptimizationFunction((x, p) -> loss_neuralode(x), OPT.AutoZygote())
8281
optprob = OPT.OptimizationProblem(optf, p_nn)
8382
84-
res = OPT.solve(optprob, OPO.Adam(0.05), callback = callback, maxiters = 300)
83+
res = OPT.solve(optprob, OPO.Adam(0.05); callback, maxiters = 300)
8584
```

docs/src/examples/ode/exogenous_input.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ end
8383
prob = ODE.ODEProblem(dudt, u0, tspan, nothing)
8484
8585
function predict_neuralode(p)
86-
_prob = ODE.remake(prob, p = p)
86+
_prob = ODE.remake(prob; p)
8787
Array(ODE.solve(_prob, ODE.Tsit5(), saveat = tsteps, abstol = 1e-8, reltol = 1e-6))
8888
end
8989

docs/src/examples/ode/prediction_error_method.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ We also define functions that simulate the system and calculate the loss, given
5656

5757
```@example PEM
5858
function simulate(p)
59-
_prob = ODE.remake(prob, p = p)
59+
_prob = ODE.remake(prob; p)
6060
ODE.solve(_prob, ODE.Tsit5(), saveat = tsteps, abstol = 1e-8, reltol = 1e-8)
6161
end
6262

docs/src/examples/ode/second_order_adjoints.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,10 @@ adtype = OPT.AutoZygote()
8787
optf = OPT.OptimizationFunction((x, p) -> loss_neuralode(x), adtype)
8888
8989
optprob1 = OPT.OptimizationProblem(optf, ps)
90-
pstart = OPT.solve(
91-
optprob1, OPO.Adam(0.01), callback = callback, maxiters = 100).u
90+
pstart = OPT.solve(optprob1, OPO.Adam(0.01); callback, maxiters = 100).u
9291
9392
optprob2 = OPT.OptimizationProblem(optf, pstart)
94-
pmin = OPT.solve(optprob2, OOJ.NewtonTrustRegion(), callback = callback,
95-
maxiters = 200)
93+
pmin = OPT.solve(optprob2, OOJ.NewtonTrustRegion(); callback, maxiters = 200)
9694
```
9795

9896
Note that we do not demonstrate `Newton()` because we have not found a single

docs/src/examples/ode/second_order_neural.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ff(du, u, p, t) = model(u, p)
4444
prob = ODE.SecondOrderODEProblem{false}(ff, du0, u0, tspan, ps)
4545
4646
function predict(p)
47-
Array(ODE.solve(prob, ODE.Tsit5(), p = p, saveat = t))
47+
Array(ODE.solve(prob, ODE.Tsit5(); p, saveat = t))
4848
end
4949
5050
correct_pos = Float32.(transpose(hcat(collect(0:0.05:1)[2:end], collect(2:-0.05:1)[2:end])))
@@ -65,5 +65,5 @@ adtype = OPT.AutoZygote()
6565
optf = OPT.OptimizationFunction((x, p) -> loss_n_ode(x), adtype)
6666
optprob = OPT.OptimizationProblem(optf, ps)
6767
68-
res = OPT.solve(optprob, OPO.Adam(0.01); callback = callback, maxiters = 1000)
68+
res = OPT.solve(optprob, OPO.Adam(0.01); callback, maxiters = 1000)
6969
```

0 commit comments

Comments
 (0)