Skip to content

Commit 3c57614

Browse files
committed
cleanup
1 parent 5c163bc commit 3c57614

21 files changed

+98
-103
lines changed

docs/src/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Pkg.add("Catalyst")
9292

9393
Many Catalyst features require the installation of additional packages. E.g. for ODE-solving and simulation plotting
9494
```julia
95-
Pkg.add("OrdinaryDiffEqTsit5")
95+
Pkg.add("OrdinaryDiffEqDefault")
9696
Pkg.add("Plots")
9797
```
9898
is also needed.
@@ -124,7 +124,7 @@ an ordinary differential equation.
124124

125125
```@example home_simple_example
126126
# Fetch required packages.
127-
using Catalyst, OrdinaryDiffEqTsit5, Plots
127+
using Catalyst, OrdinaryDiffEqDefault, Plots
128128
129129
# Create model.
130130
model = @reaction_network begin
@@ -140,7 +140,7 @@ ps = [:kB => 0.01, :kD => 0.1, :kP => 0.1]
140140
ode = ODEProblem(model, u0, tspan, ps)
141141
142142
# Simulate ODE and plot results.
143-
sol = solve(ode, Tsit5())
143+
sol = solve(ode)
144144
plot(sol; lw = 5)
145145
```
146146

docs/src/introduction_to_catalyst/catalyst_for_new_julia_users.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ To import a Julia package into a session, you can use the `using PackageName` co
5555
using Pkg
5656
Pkg.add("Catalyst")
5757
```
58-
Here, the Julia package manager package (`Pkg`) is by default installed on your computer when Julia is installed, and can be activated directly. Next, we also wish to install the needed sub-libraries of `OrdinaryDiffEqTsit5` and `Plots` packages (for numeric simulation of models, and plotting, respectively). We will import the default recommende dsolver, `Tsit5()`, which is in the `OrdinaryDiffEqTsit5` sub-library. A full list of `OrdinaryDiffEq` solver sublibraries can be found on the sidebar of [this page](https://docs.sciml.ai/OrdinaryDiffEq/stable/).
58+
Here, the Julia package manager package (`Pkg`) is by default installed on your computer when Julia is installed, and can be activated directly. Next, we also wish to install the needed sub-libraries of `OrdinaryDiffEq` and `Plots` packages (for numeric simulation of models, and plotting, respectively). We will import the default recommended solver from the `OrdinaryDiffEqDefault` sub-library. A full list of `OrdinaryDiffEq` solver sublibraries can be found on the sidebar of [this page](https://docs.sciml.ai/OrdinaryDiffEq/stable/).
5959
```julia
60-
Pkg.add("OrdinaryDiffEqTsit5")
60+
Pkg.add("OrdinaryDiffEqDefault")
6161
Pkg.add("Plots")
6262
```
6363
Once a package has been installed through the `Pkg.add` command, this command does not have to be repeated if we restart our Julia session. We can now import all three packages into our current session with:
6464
```@example ex2
6565
using Catalyst
66-
using OrdinaryDiffEqTsit5
66+
using OrdinaryDiffEqDefault
6767
using Plots
6868
```
6969
Here, if we restart Julia, these `using` commands *must be rerun*.

docs/src/inverse_problems/global_sensitivity_analysis.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ end
2222
```
2323
We will study the peak number of infected cases's ($max(I(t))$) sensitivity to the system's three parameters. We create a function which simulates the system from a given initial condition and measures this property:
2424
```@example gsa_1
25-
using OrdinaryDiffEqTsit5
25+
using OrdinaryDiffEqDefault
2626
2727
u0 = [:S => 999.0, :I => 1.0, :E => 0.0, :R => 0.0]
2828
p_dummy = [:β => 0.0, :a => 0.0, :γ => 0.0]
@@ -31,7 +31,7 @@ oprob_base = ODEProblem(seir_model, u0, (0.0, 10000.0), p_dummy)
3131
function peak_cases(p)
3232
ps = [:β => p[1], :a => p[2], :γ => p[3]]
3333
oprob = remake(oprob_base; p = ps)
34-
sol = solve(oprob, Tsit5(); maxiters = 100000, verbose = false)
34+
sol = solve(oprob; maxiters = 100000, verbose = false)
3535
SciMLBase.successful_retcode(sol) || return Inf
3636
return maximum(sol[:I])
3737
end

docs/src/inverse_problems/optimization_ode_param_fitting.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ u0 = [:S => 1.0, :E => 1.0, :SE => 0.0, :P => 0.0]
2121
ps_true = [:kB => 1.0, :kD => 0.1, :kP => 0.5]
2222
2323
# Generate synthetic data.
24-
using OrdinaryDiffEqTsit5
24+
using OrdinaryDiffEqDefault
2525
oprob_true = ODEProblem(rn, u0, (0.0, 10.0), ps_true)
26-
true_sol = solve(oprob_true, Tsit5())
27-
data_sol = solve(oprob_true, Tsit5(); saveat=1.0)
26+
true_sol = solve(oprob_true)
27+
data_sol = solve(oprob_true; saveat=1.0)
2828
data_ts = data_sol.t[2:end]
2929
data_vals = (0.8 .+ 0.4*rand(10)) .* data_sol[:P][2:end]
3030

docs/src/model_creation/conservation_laws.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ end
1010
```
1111
If we simulate it, we note that while the concentrations of $X₁$ and $X₂$ change throughout the simulation, the total concentration of $X$ ($= X₁ + X₂$) is constant:
1212
```@example conservation_laws
13-
using OrdinaryDiffEqTsit5, Plots
13+
using OrdinaryDiffEqDefault, Plots
1414
u0 = [:X₁ => 80.0, :X₂ => 20.0]
1515
ps = [:k₁ => 10.0, :k₂ => 2.0]
1616
oprob = ODEProblem(rs, u0, (0.0, 1.0), ps)
17-
sol = solve(oprob, Tsit5())
17+
sol = solve(oprob)
1818
plot(sol; idxs = [rs.X₁, rs.X₂, rs.X₁ + rs.X₂], label = ["X₁" "X₂" "X₁ + X₂ (a conserved quantity)"])
1919
```
2020
This makes sense, as while $X$ is converted between two different forms ($X₁$ and $X₂$), it is neither produced nor degraded. That is, it is a *conserved quantity*. Next, if we consider the ODE that our model generates:
@@ -47,15 +47,15 @@ Here, Catalyst encodes all conserved quantities in a single, [vector-valued](@re
4747

4848
Practically, the `remove_conserved = true` argument can be provided when a `ReactionSystem` is converted to an `ODEProblem`:
4949
```@example conservation_laws
50-
using OrdinaryDiffEqTsit5, Plots
50+
using OrdinaryDiffEqDefault, Plots
5151
u0 = [:X₁ => 80.0, :X₂ => 20.0]
5252
ps = [:k₁ => 10.0, :k₂ => 2.0]
5353
oprob = ODEProblem(rs, u0, (0.0, 1.0), ps; remove_conserved = true)
5454
nothing # hide
5555
```
5656
Here, while `Γ[1]` becomes a parameter of the new system, it has a [default value](@ref dsl_advanced_options_default_vals) equal to the corresponding conservation law. Hence, its value is computed from the initial condition `[:X₁ => 80.0, :X₂ => 20.0]`, and does not need to be provided in the parameter vector. Next, we can simulate and plot our model using normal syntax:
5757
```@example conservation_laws
58-
sol = solve(oprob, Tsit5())
58+
sol = solve(oprob)
5959
plot(sol)
6060
```
6161
!!! note

docs/src/model_creation/dsl_advanced.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,20 @@ end
100100
```
101101
Next, if we simulate the model, we do not need to provide values for species or parameters that have default values. In this case all have default values, so both `u0` and `ps` can be empty vectors:
102102
```@example dsl_advanced_defaults
103-
using OrdinaryDiffEqTsit5, Plots
103+
using OrdinaryDiffEqDefault, Plots
104104
u0 = []
105105
tspan = (0.0, 10.0)
106106
p = []
107107
oprob = ODEProblem(rn, u0, tspan, p)
108-
sol = solve(oprob, Tsit5())
108+
sol = solve(oprob)
109109
plot(sol)
110110
```
111111
It is still possible to provide values for some (or all) initial conditions/parameters in `u0`/`ps` (in which case these overrides the default values):
112112
```@example dsl_advanced_defaults
113113
u0 = [:X => 4.0]
114114
p = [:d => 0.5]
115115
oprob = ODEProblem(rn, u0, tspan, p)
116-
sol = solve(oprob, Tsit5())
116+
sol = solve(oprob)
117117
plot(sol)
118118
```
119119
It is also possible to declare a model with default values for only some initial conditions/parameters:
@@ -127,7 +127,7 @@ end
127127
tspan = (0.0, 10.0)
128128
p = [:p => 1.0, :d => 0.2]
129129
oprob = ODEProblem(rn, u0, tspan, p)
130-
sol = solve(oprob, Tsit5())
130+
sol = solve(oprob)
131131
plot(sol)
132132
```
133133

@@ -142,6 +142,7 @@ end
142142
```
143143
Please note that as the parameter `X₀` does not occur as part of any reactions, Catalyst's DSL cannot infer whether it is a species or a parameter. This must hence be explicitly declared. We can now simulate our model while providing `X`'s value through the `X₀` parameter:
144144
```@example dsl_advanced_defaults
145+
using OrdinaryDiffEqTsit5
145146
u0 = []
146147
p = [:X₀ => 1.0, :p => 1.0, :d => 0.5]
147148
oprob = ODEProblem(rn, u0, tspan, p)
@@ -262,12 +263,12 @@ end
262263
```
263264
Now, we can also declare our initial conditions and parameter values as vectors as well:
264265
```@example dsl_advanced_vector_variables
265-
using OrdinaryDiffEqTsit5, Plots # hide
266+
using OrdinaryDiffEqDefault, Plots # hide
266267
u0 = [:X => [0.0, 2.0]]
267268
tspan = (0.0, 1.0)
268269
ps = [:k => [1.0, 2.0]]
269270
oprob = ODEProblem(two_state_model, u0, tspan, ps)
270-
sol = solve(oprob, Tsit5())
271+
sol = solve(oprob)
271272
plot(sol)
272273
```
273274

@@ -489,12 +490,12 @@ X
489490
```
490491
Next, we can now use these to e.g. designate initial conditions and parameter values for model simulations:
491492
```@example dsl_advanced_programmatic_unpack
492-
using OrdinaryDiffEqTsit5, Plots # hide
493+
using OrdinaryDiffEqDefault, Plots # hide
493494
u0 = [X => 0.1]
494495
tspan = (0.0, 10.0)
495496
ps = [p => 1.0, d => 0.2]
496497
oprob = ODEProblem(bd_model, u0, tspan, ps)
497-
sol = solve(oprob, Tsit5())
498+
sol = solve(oprob)
498499
plot(sol)
499500
```
500501

docs/src/model_creation/examples/basic_CRN_library.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ nothing # hide
1818
```
1919
We can now simulate our model using all three interpretations. First, we perform a reaction rate equation-based ODE simulation:
2020
```@example crn_library_birth_death
21-
using OrdinaryDiffEqTsit5
21+
using OrdinaryDiffEqDefault
2222
oprob = ODEProblem(bd_process, u0, tspan, ps)
23-
osol = solve(oprob, Tsit5())
23+
osol = solve(oprob)
2424
nothing # hide
2525
```
2626
Next, a chemical Langevin equation-based SDE simulation:
@@ -52,7 +52,7 @@ plot(oplt, splt, jplt; lw = 3, size=(800,700), layout = (3,1))
5252
## [Two-state model](@id basic_CRN_library_two_states)
5353
The two-state model describes a component (here called $X$) which can exist in two different forms (here called $X₁$ and $X₂$). It switches between these forms at linear rates. First, we simulate the model using both ODEs and SDEs:
5454
```@example crn_library_two_states
55-
using Catalyst, OrdinaryDiffEqTsit5, StochasticDiffEq, Plots
55+
using Catalyst, OrdinaryDiffEqDefault, StochasticDiffEq, Plots
5656
two_state_model = @reaction_network begin
5757
(k₁,k₂), X₁ <--> X₂
5858
end
@@ -62,7 +62,7 @@ tspan = (0.0, 1.0)
6262
ps = [:k₁ => 2.0, :k₂ => 3.0]
6363
6464
oprob = ODEProblem(two_state_model, u0, tspan, ps)
65-
osol = solve(oprob, Tsit5())
65+
osol = solve(oprob)
6666
oplt = plot(osol; title = "Reaction rate equation (ODE)")
6767
6868
sprob = SDEProblem(two_state_model, u0, tspan, ps)
@@ -96,9 +96,9 @@ u0 = [:S => 301, :E => 100, :SE => 0, :P => 0]
9696
tspan = (0., 100.)
9797
ps = [:kB => 0.00166, :kD => 0.0001, :kP => 0.1]
9898
99-
using OrdinaryDiffEqTsit5
99+
using OrdinaryDiffEqDefault
100100
oprob = ODEProblem(mm_system, u0, tspan, ps)
101-
osol = solve(oprob, Tsit5())
101+
osol = solve(oprob)
102102
103103
using StochasticDiffEq
104104
sprob = SDEProblem(mm_system, u0, tspan, ps)
@@ -132,14 +132,14 @@ end
132132
```
133133
First, we perform a deterministic ODE simulation:
134134
```@example crn_library_sir
135-
using OrdinaryDiffEqTsit5, Plots
135+
using OrdinaryDiffEqDefault, Plots
136136
u0 = [:S => 99, :I => 1, :R => 0]
137137
tspan = (0.0, 500.0)
138138
ps = [:α => 0.001, :β => 0.01]
139139
140140
# Solve ODEs.
141141
oprob = ODEProblem(sir_model, u0, tspan, ps)
142-
osol = solve(oprob, Tsit5())
142+
osol = solve(oprob)
143143
plot(osol; title = "Reaction rate equation (ODE)", size=(800,350))
144144
```
145145
Next, we perform 3 different Jump simulations. Note that for the stochastic model, the occurrence of an outbreak is not certain. Rather, there is a possibility that it fizzles out without a noteworthy peak.
@@ -179,14 +179,14 @@ Below, we perform a simple deterministic ODE simulation of the system. Next, we
179179

180180
In two separate plots.
181181
```@example crn_library_cc
182-
using OrdinaryDiffEqTsit5, Plots
182+
using OrdinaryDiffEqDefault, Plots
183183
u0 = [:S₁ => 1.0, :C => 0.05, :S₂ => 1.2, :S₁C => 0.0, :CP => 0.0, :P => 0.0]
184184
tspan = (0., 15.)
185185
ps = [:k₁ => 5.0, :k₂ => 5.0, :k₃ => 100.0]
186186
187187
# solve ODEs
188188
oprob = ODEProblem(cc_system, u0, tspan, ps)
189-
osol = solve(oprob, Tsit5())
189+
osol = solve(oprob)
190190
191191
plt1 = plot(osol; idxs = [:S₁, :S₂, :P], title = "Substrate and product dynamics")
192192
plt2 = plot(osol; idxs = [:C, :S₁C, :CP], title = "Catalyst and intermediaries dynamics")
@@ -206,16 +206,16 @@ end
206206
```
207207
We can simulate the model for two different initial conditions, demonstrating the existence of two different stable steady states.
208208
```@example crn_library_wilhelm
209-
using OrdinaryDiffEqTsit5, Plots
209+
using OrdinaryDiffEqDefault, Plots
210210
u0_1 = [:X => 1.5, :Y => 0.5]
211211
u0_2 = [:X => 2.5, :Y => 0.5]
212212
tspan = (0., 10.)
213213
ps = [:k1 => 8.0, :k2 => 2.0, :k3 => 1.0, :k4 => 1.5]
214214
215215
oprob1 = ODEProblem(wilhelm_model, u0_1, tspan, ps)
216216
oprob2 = ODEProblem(wilhelm_model, u0_2, tspan, ps)
217-
osol1 = solve(oprob1, Tsit5())
218-
osol2 = solve(oprob2, Tsit5())
217+
osol1 = solve(oprob1)
218+
osol2 = solve(oprob2)
219219
plot(osol1; lw = 4, idxs = :X, label = "X(0) = 1.5")
220220
plot!(osol2; lw = 4, idxs = :X, label = "X(0) = 2.5", yguide = "X", size = (800,350))
221221
plot!(bottom_margin = 3Plots.Measures.mm) # hide
@@ -234,13 +234,13 @@ A simple example of such a loop is a transcription factor which activates its ow
234234

235235
We simulate the self-activation loop from a single initial condition using both deterministic (ODE) and stochastic (jump) simulations. We note that while the deterministic simulation reaches a single steady state, the stochastic one switches between two different states.
236236
```@example crn_library_self_activation
237-
using JumpProcesses, OrdinaryDiffEqTsit5, Plots
237+
using JumpProcesses, OrdinaryDiffEqDefault, Plots
238238
u0 = [:X => 4]
239239
tspan = (0.0, 1000.0)
240240
ps = [:v₀ => 0.1, :v => 2.0, :K => 10.0, :n => 2, :d => 0.1]
241241
242242
oprob = ODEProblem(sa_loop, u0, tspan, ps)
243-
osol = solve(oprob, Tsit5())
243+
osol = solve(oprob)
244244
245245
jinput = JumpInputs(sa_loop, u0, tspan, ps)
246246
jprob = JumpProblem(jinput)
@@ -267,16 +267,16 @@ end
267267
```
268268
It is generally known to (for reaction rate equation-based ODE simulations) produce oscillations when $B > 1 + A^2$. However, this result is based on models generated when *combinatorial adjustment of rates is not performed*. Since Catalyst [automatically perform these adjustments](@ref introduction_to_catalyst_ratelaws), and one reaction contains a stoichiometric constant $>1$, the threshold will be different. Here, we trial two different values of $B$. In both cases, $B < 1 + A^2$, however, in the second case the system can generate oscillations.
269269
```@example crn_library_brusselator
270-
using OrdinaryDiffEqTsit5, Plots
270+
using OrdinaryDiffEqDefault, Plots
271271
u0 = [:X => 1.0, :Y => 1.0]
272272
tspan = (0., 50.)
273273
ps1 = [:A => 1.0, :B => 1.0]
274274
ps2 = [:A => 1.0, :B => 1.8]
275275
276276
oprob1 = ODEProblem(brusselator, u0, tspan, ps1)
277277
oprob2 = ODEProblem(brusselator, u0, tspan, ps2)
278-
osol1 = solve(oprob1, Tsit5())
279-
osol2 = solve(oprob2, Tsit5())
278+
osol1 = solve(oprob1)
279+
osol2 = solve(oprob2)
280280
oplt1 = plot(osol1; title = "No Oscillation")
281281
oplt2 = plot(osol2; title = "Oscillation")
282282
@@ -296,16 +296,16 @@ end
296296
```
297297
Whether the Repressilator oscillates or not depends on its parameter values. Here, we will perform deterministic (ODE) simulations for two different values of $K$, showing that it oscillates for one value and not the other one. Next, we will perform stochastic (SDE) simulations for both $K$ values, showing that the stochastic model can sustain oscillations in both cases. This is an example of the phenomena of *noise-induced oscillation*.
298298
```@example crn_library_brusselator
299-
using OrdinaryDiffEqTsit5, StochasticDiffEq, Plots
299+
using OrdinaryDiffEqDefault, StochasticDiffEq, Plots
300300
u0 = [:X => 50.0, :Y => 15.0, :Z => 15.0]
301301
tspan = (0., 200.)
302302
ps1 = [:v => 10.0, :K => 20.0, :n => 3, :d => 0.1]
303303
ps2 = [:v => 10.0, :K => 50.0, :n => 3, :d => 0.1]
304304
305305
oprob1 = ODEProblem(repressilator, u0, tspan, ps1)
306306
oprob2 = ODEProblem(repressilator, u0, tspan, ps2)
307-
osol1 = solve(oprob1, Tsit5())
308-
osol2 = solve(oprob2, Tsit5())
307+
osol1 = solve(oprob1)
308+
osol2 = solve(oprob2)
309309
oplt1 = plot(osol1; title = "Oscillation (ODE, K = 20)")
310310
oplt2 = plot(osol2; title = "No oscillation (ODE, K = 50)")
311311
@@ -337,12 +337,12 @@ end
337337
```
338338
Here we simulate the model for a single initial condition, showing both time-state space and phase space how it reaches a [*strange attractor*](https://www.dynamicmath.xyz/strange-attractors/).
339339
```@example crn_library_chaos
340-
using OrdinaryDiffEqTsit5, Plots
340+
using OrdinaryDiffEqDefault, Plots
341341
u0 = [:X => 1.5, :Y => 1.5, :Z => 1.5]
342342
tspan = (0.0, 50.0)
343343
p = [:k1 => 2.1, :k2 => 0.7, :k3 => 2.9, :k4 => 1.1, :k5 => 1.0, :k6 => 0.5, :k7 => 2.7]
344344
oprob = ODEProblem(wr_model, u0, tspan, p)
345-
sol = solve(oprob, Tsit5())
345+
sol = solve(oprob)
346346
347347
plt1 = plot(sol; title = "Time-state space")
348348
plt2 = plot(sol; idxs = (:X, :Y, :Z), title = "Phase space")

docs/src/model_creation/examples/hodgkin_huxley_equation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ complete model.
1818

1919
We begin by importing some necessary packages:
2020
```@example hh1
21-
using ModelingToolkit, Catalyst, NonlinearSolve, Plots, OrdinaryDiffEqRosenbrock
21+
using ModelingToolkit, Catalyst, NonlinearSolve, Plots, OrdinaryDiffEqDefault
2222
```
2323

2424
## Building the model via the Catalyst DSL
@@ -127,7 +127,7 @@ amplitude of the stimulus is non-zero and see if we get action potentials
127127
tspan = (0.0, 50.0)
128128
@unpack V,I₀ = hhmodel
129129
oprob = ODEProblem(hhmodel, u_ss, tspan, [I₀ => 10.0])
130-
sol = solve(oprob, Rosenbrock23())
130+
sol = solve(oprob)
131131
plot(sol, idxs = V, legend = :outerright)
132132
```
133133

@@ -188,7 +188,7 @@ eliminate the algebraic equations for the ionic currents when constructing the
188188
```@example hh1
189189
@unpack I₀,V = hhmodel2
190190
oprob = ODEProblem(hhmodel2, u_ss, tspan, [I₀ => 10.0]; structural_simplify = true)
191-
sol = solve(oprob, Rosenbrock23())
191+
sol = solve(oprob)
192192
plot(sol, idxs = V, legend = :outerright)
193193
```
194194

0 commit comments

Comments
 (0)