@@ -19,7 +19,7 @@ include("../test_functions.jl")
1919# ## Base Tests ###
2020
2121# Checks that systems with symbolic stoichiometries, created using different approaches, are identical.
22- let
22+ let
2323 @parameters p k d:: Float64 n1:: Int64 n2 n3
2424 @species X (t) Y (t)
2525 rxs1 = [
7171end
7272
7373# Compares the Catalyst-generated ODE function to a manually computed ODE function.
74- let
74+ let
7575 # With combinatoric ratelaws.
7676 function oderhs (u, p, t)
7777 k,α = p
8989 end
9090 @test f_eval (rs, u0_1, ps_1, τ) ≈ oderhs (u0_2, ps_2, τ)
9191
92- # Without combinatoric ratelaws.
92+ # Without combinatoric ratelaws.
9393 function oderhs_no_crl (u, p, t)
9494 k,α = p
9595 A,B,C,D = u
108108end
109109
110110# Compares the Catalyst-generated SDE noise function to a manually computed SDE noise function.
111- let
112- # With combinatoric ratelaws.
111+ let
112+ # With combinatoric ratelaws.
113113 function sdenoise (u, p, t)
114114 k,α = p
115115 A,B,C,D = u
126126 end
127127 @test g_eval (rs, u0_1, ps_1, τ) ≈ sdenoise (u0_2, ps_2, τ)
128128
129- # Without combinatoric ratelaws.
129+ # Without combinatoric ratelaws.
130130 function sdenoise_no_crl (u, p, t)
131131 k,α = p
132132 A,B,C,D = u
192192# Tests symbolic stoichiometries in simulations.
193193# Tests for decimal numbered symbolic stoichiometries.
194194let
195- # Declares models. The references models have the `n` parameters so they can use the same
195+ # Declares models. The references models have the `n` parameters so they can use the same
196196 # parameter vectors as the non-reference ones.
197197 rs_int = @reaction_network begin
198198 @parameters n:: Int64
211211 (k1, k2), 2.5 * X1 <--> X2
212212 end
213213
214- # Set simulation settings. Initial conditions are design to start, more or less, at
214+ # Set simulation settings. Initial conditions are design to start, more or less, at
215215 # steady state concentrations.
216- # Values are selected so that stochastic tests should always pass within the bounds (independent
216+ # Values are selected so that stochastic tests should always pass within the bounds (independent
217217 # of seed).
218218 u0_int = [:X1 => 150 , :X2 => 600 ]
219219 u0_dec = [:X1 => 100 , :X2 => 600 ]
@@ -247,10 +247,10 @@ let
247247 @test mean (ssol_dec[:X1 ]) ≈ mean (ssol_dec_ref[:X1 ]) atol = 2 * 1e0
248248
249249 # Test Jump simulations with integer coefficients.
250- dprob_int = DiscreteProblem (rs_int, u0_int, tspan_stoch, ps_int)
251- dprob_int_ref = DiscreteProblem (rs_ref_int, u0_int, tspan_stoch, ps_int)
252- jprob_int = JumpProblem (rs_int, dprob_int, Direct () ; rng, save_positions = (false , false ))
253- jprob_int_ref = JumpProblem (rs_ref_int, dprob_int_ref, Direct () ; rng, save_positions = (false , false ))
250+ jin_int = JumpInputs (rs_int, u0_int, tspan_stoch, ps_int)
251+ jin_int_ref = JumpInputs (rs_ref_int, u0_int, tspan_stoch, ps_int)
252+ jprob_int = JumpProblem (jin_int ; rng, save_positions = (false , false ))
253+ jprob_int_ref = JumpProblem (jin_int_ref ; rng, save_positions = (false , false ))
254254 jsol_int = solve (jprob_int, SSAStepper (); seed, saveat = 1.0 )
255255 jsol_int_ref = solve (jprob_int_ref, SSAStepper (); seed, saveat = 1.0 )
256256 @test mean (jsol_int[:X1 ]) ≈ mean (jsol_int_ref[:X1 ]) atol = 1e-2 rtol = 1e-2
@@ -265,11 +265,11 @@ let
265265 @parameters n:: Int64 k:: Int64
266266 i, S + n* I --> k* I
267267 r, n* I --> n* R
268- end
268+ end
269269 sir_ref = @reaction_network begin
270270 i, S + I --> 2 I
271271 r, I --> R
272- end
272+ end
273273
274274 ps = [:i => 1e-4 , :r => 1e-2 , :n => 1.0 , :k => 2.0 ]
275275 ps_ref = [:i => 1e-4 , :r => 1e-2 ]
@@ -283,10 +283,10 @@ let
283283 @test solve (oprob, Tsit5 ()) ≈ solve (oprob_ref, Tsit5 ())
284284
285285 # Jumps. First ensemble problems for each systems is created.
286- dprob = DiscreteProblem (sir, u0, tspan, ps)
287- dprob_ref = DiscreteProblem (sir_ref, u0, tspan, ps_ref)
288- jprob = JumpProblem (sir, dprob, Direct () ; rng, save_positions = (false , false ))
289- jprob_ref = JumpProblem (sir_ref, dprob_ref, Direct () ; rng, save_positions = (false , false ))
286+ jin = JumpInputs (sir, u0, tspan, ps)
287+ jin_ref = JumpInputs (sir_ref, u0, tspan, ps_ref)
288+ jprob = JumpProblem (jin ; rng, save_positions = (false , false ))
289+ jprob_ref = JumpProblem (jin_ref ; rng, save_positions = (false , false ))
290290 eprob = EnsembleProblem (jprob)
291291 eprob_ref = EnsembleProblem (jprob_ref)
292292
0 commit comments