Skip to content

Commit c3d5552

Browse files
committed
up
1 parent e820c2e commit c3d5552

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

test/extensions/homotopy_continuation.jl

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ let
2525
u0 = [:X1 => 2.0, :X2 => 2.0, :X3 => 2.0, :X2_2X3 => 2.0]
2626

2727
# Computes the single steady state, checks that when given to the ODE rhs, all are evaluated to 0.
28-
hc_ss = hc_steady_states(rs, ps; u0=u0, show_progress=false)
28+
hc_ss = hc_steady_states(rs, ps; u0 = u0, show_progress = false, seed = 1234)
2929
hc_ss = Pair.(unknowns(rs), hc_ss[1])
30-
@test maximum(abs.(f_eval(rs, hc_ss, ps, 0.0))) 0.0 atol=1e-12
30+
@test maximum(abs.(f_eval(rs, hc_ss, ps, 0.0))) 0.0 atol = 1e-12
3131

3232
# Checks that not giving a `u0` argument yields an error for systems with conservation laws.
33-
@test_throws Exception hc_steady_states(rs, ps; show_progress=false)
33+
@test_throws Exception hc_steady_states(rs, ps; show_progress = false)
3434
end
3535

3636
# Tests for network with multiple steady state.
@@ -45,11 +45,11 @@ let
4545
end
4646
ps = [:k3 => 1.0, :k2 => 2.0, :k4 => 1.5, :k1=>8.0]
4747

48-
hc_ss_1 = hc_steady_states(wilhelm_2009_model, ps; seed=0x000004d1, show_progress=false)
49-
@test sort(hc_ss_1, by=sol->sol[1]) [[0.0, 0.0], [0.5, 2.0], [4.5, 6.0]]
48+
hc_ss_1 = hc_steady_states(wilhelm_2009_model, ps; seed = 1234, show_progress = false)
49+
@test sort(hc_ss_1, by = sol->sol[1]) [[0.0, 0.0], [0.5, 2.0], [4.5, 6.0]]
5050

51-
hc_ss_2 = hc_steady_states(wilhelm_2009_model, ps; seed=0x000004d2, show_progress=false)
52-
hc_ss_3 = hc_steady_states(wilhelm_2009_model, ps; seed=0x000004d2, show_progress=false)
51+
hc_ss_2 = hc_steady_states(wilhelm_2009_model, ps; seed = 1234, show_progress = false)
52+
hc_ss_3 = hc_steady_states(wilhelm_2009_model, ps; seed = 1234, show_progress = false)
5353
@test hc_ss_1 != hc_ss_2
5454
@test hc_ss_2 == hc_ss_3
5555
end
@@ -69,7 +69,7 @@ let
6969
ps = (:kY1 => 1.0, :kY2 => 3, :kZ1 => 1.0, :kZ2 => 4.0)
7070
u0_1 = (:Y1 => 1.0, :Y2 => 3, :Z1 => 10, :Z2 =>40.0)
7171

72-
ss_1 = sort(hc_steady_states(rs_1, ps; u0=u0_1, show_progress=false), by=sol->sol[1])
72+
ss_1 = sort(hc_steady_states(rs_1, ps; u0 = u0_1, show_progress = false, seed = 1234), by = sol->sol[1])
7373
@test ss_1 [[0.2, 0.1, 3.0, 1.0, 40.0, 10.0]]
7474

7575
rs_2 = @reaction_network begin
@@ -81,7 +81,7 @@ let
8181
end
8282
u0_2 = [:B2 => 1.0, :B1 => 3.0, :A2 => 10.0, :A1 =>40.0]
8383

84-
ss_2 = sort(hc_steady_states(rs_2, ps; u0=u0_2, show_progress=false), by=sol->sol[1])
84+
ss_2 = sort(hc_steady_states(rs_2, ps; u0 = u0_2, show_progress = false, seed = 1234), by = sol->sol[1])
8585
@test ss_1 ss_2
8686
end
8787

@@ -96,14 +96,15 @@ let
9696
d, X --> 0
9797
end
9898
ps = [:v => 5.0, :K => 2.5, :n => 3, :d => 1.0]
99-
sss = hc_steady_states(rs, ps; filter_negative=false, show_progress=false)
99+
sss = hc_steady_states(rs, ps; filter_negative = false, show_progress = false, seed = 1234)
100100

101101
@test length(sss) == 4
102102
for ss in sss
103-
@test f_eval(rs,sss[1], last.(ps), 0.0)[1] 0.0 atol=1e-12
103+
@test f_eval(rs,sss[1], last.(ps), 0.0)[1] 0.0 atol = 1e-12
104104
end
105105

106-
@test_throws Exception hc_steady_states(rs, [:v => 5.0, :K => 2.5, :n => 2.7, :d => 1.0]; show_progress=false)
106+
ps = [:v => 5.0, :K => 2.5, :n => 2.7, :d => 1.0]
107+
@test_throws Exception hc_steady_states(rs, ps; show_progress = false, seed = 1234)
107108
end
108109

109110

@@ -124,7 +125,7 @@ let
124125

125126
# Checks that homotopy continuation correctly find the system's single steady state.
126127
ps = [:p => 2.0, :d => 1.0, :k => 5.0]
127-
hc_ss = hc_steady_states(rs, ps)
128+
hc_ss = hc_steady_states(rs, ps; show_progress = false, seed = 1234)
128129
@test hc_ss [[2.0, 0.2, 10.0]]
129130
end
130131

@@ -137,7 +138,7 @@ let
137138
p_start = [:p => 1.0, :d => 0.2]
138139

139140
# Computes bifurcation diagram.
140-
@test_throws Exception hc_steady_states(incomplete_network, p_start)
141+
@test_throws Exception hc_steady_states(incomplete_network, p_start; show_progress = false, seed = 1234)
141142
end
142143

143144
# Tests that non-autonomous system throws an error
@@ -146,5 +147,5 @@ let
146147
(k,t), 0 <--> X
147148
end
148149
ps = [:k => 1.0]
149-
@test_throws Exception hc_steady_states(rs, ps)
150+
@test_throws Exception hc_steady_states(rs, ps; show_progress = false, seed = 1234)
150151
end

0 commit comments

Comments
 (0)