Skip to content

Commit 6881140

Browse files
committed
format
1 parent 0f5318e commit 6881140

File tree

11 files changed

+33
-42
lines changed

11 files changed

+33
-42
lines changed

src/CriticalTransitions.jl

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ using StochasticDiffEq:
2020
terminate!,
2121
u_modified!
2222
using DynamicalSystemsBase:
23-
DynamicalSystemsBase,
24-
CoupledSDEs,
25-
dynamic_rule,
26-
current_state,
27-
set_state!
23+
DynamicalSystemsBase, CoupledSDEs, dynamic_rule, current_state, set_state!
2824

2925
#StochasticSystemsBase = Base.get_extension(DynamicalSystemsBase, :StochasticSystemsBase)
3026
#using DynamicalSystemsBase.StochasticSystemsBase: CoupledSDEs
@@ -68,10 +64,7 @@ include("../systems/CTLibrary.jl")
6864
using .CTLibrary
6965

7066
# Core types
71-
export CoupledSDEs,
72-
noise_process,
73-
covariance_matrix,
74-
diffusion_matrix
67+
export CoupledSDEs, noise_process, covariance_matrix, diffusion_matrix
7568

7669
# Methods
7770
export equilib, basins, basinboundary, basboundary

src/largedeviations/action.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ generalized norm ``||a||_Q^2 := \\langle a, Q^{-1} b \\rangle`` (see `anorm``).
2020
function fw_action(sys::CoupledSDEs, path, time)
2121
@assert all(diff(time) .≈ diff(time[1:2])) "Freidlin-Wentzell action is only defined for equispaced time"
2222
# Inverse of covariance matrix
23-
A = inv(covariance_matrix(sys))
23+
A = inv(covariance_matrix(sys))
2424

2525
# Compute action integral
2626
integrand = fw_integrand(sys, path, time, A)

src/trajectories/equib.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ Returns the equilibrium solution of the system `sys` for given initial condition
1212
* `dt = 0.01`: time step of the ODE solver.
1313
* `solver = Euler()`: ODE solver used for evolving the state.
1414
"""
15-
function equilib(sys::CoupledSDEs, state=nothing; dt=0.01, tmax=1e5, abstol=1e-5, solver=Tsit5())
15+
function equilib(
16+
sys::CoupledSDEs, state=nothing; dt=0.01, tmax=1e5, abstol=1e-5, solver=Tsit5()
17+
)
1618
condition(u, t, integrator) = norm(integrator.uprev - u) < abstol
1719
affect!(integrator) = terminate!(integrator)
1820
equilib_cond = DiscreteCallback(condition, affect!)

test/CoupledSDEs.jl

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,15 @@
1515
u0 = zeros(2)
1616
sys = CoupledSDEs(fitzhugh_nagumo, u0, param; noise_strength=σ)
1717

18-
@testset "correlation" begin
19-
20-
end
18+
@testset "correlation" begin end
2119

2220
@testset "noise" begin
2321
diff = diffusion_matrix(sys)
2422
cov = covariance_matrix(sys)
2523
@test diff isa AbstractMatrix
2624
@test cov isa AbstractMatrix
2725
@test all(diag(diff) .== σ)
28-
@test diff.^2 == cov
26+
@test diff .^ 2 == cov
2927

3028
W = noise_process(sys)
3129
int_cov = W.covariance
@@ -35,9 +33,8 @@
3533

3634
@testset "drift" begin
3735
using CriticalTransitions: drift
38-
drift_vector = drift(sys, [0,0])
39-
drift_vector isa SVector{2, Float64}
40-
@test drift_vector == [0,0]
36+
drift_vector = drift(sys, [0, 0])
37+
drift_vector isa SVector{2,Float64}
38+
@test drift_vector == [0, 0]
4139
end
42-
4340
end

test/basin/basin_boundary-N54XDK9GMK.jl renamed to test/basin/basin_boundary.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
box = intervals_to_box([-2.0, -2.0], [2.00, 2.0])
99
step = 0.1
1010

11-
boas = basins(system, A, B, C, box; bstep = [step, step])
11+
boas = basins(system, A, B, C, box; bstep=[step, step])
1212
X, Y, attractors, h = boas
1313
boundary = basinboundary(boas)
1414
@test length(attractors) == 2
1515
@test length(unique(h)) == 3
16-
@test h[end÷2+1, end÷2+1] == -1
17-
@test boundary[:,end÷2+1] == zeros(2)
16+
@test h[end ÷ 2 + 1, end ÷ 2 + 1] == -1
17+
@test boundary[:, end ÷ 2 + 1] == zeros(2)
1818
end

test/issue14.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ using CriticalTransitions, StaticArrays, Test
22

33
function meier_stein(u, p, t) # in-place
44
x, y = u
5-
dx = x-x^3 -10*x*y^2
6-
dy = -(1+x^2)*y
7-
SA[dx, dy]
5+
dx = x - x^3 - 10 * x * y^2
6+
dy = -(1 + x^2) * y
7+
return SA[dx, dy]
88
end
99
σ = 0.25
1010
sys = StochSystem(meier_stein, [], zeros(2), σ, idfunc, nothing, I(2), "WhiteGauss")
1111

1212
# initial path: parabola
13-
xx = range(-1.0,1.0, length=30)
14-
yy = 0.3 .* (- xx .^ 2 .+ 1)
13+
xx = range(-1.0, 1.0; length=30)
14+
yy = 0.3 .* (-xx .^ 2 .+ 1)
1515
init = Matrix([xx yy]')
1616

17-
gm = geometric_min_action_method(sys, init, maxiter=1000)
18-
@test all(isapprox.(path[2,:][end-5:end], 0, atol=1e-3))
17+
gm = geometric_min_action_method(sys, init; maxiter=1000)
18+
@test all(isapprox.(path[2, :][(end - 5):end], 0, atol=1e-3))
1919

2020
gm[2][end]
2121

22-
isapprox(gm[2][end], 0.338, atol=1e-3)
22+
isapprox(gm[2][end], 0.338; atol=1e-3)

test/largedeviations/MAM.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
fhn, x_i, x_f, N, T; maxiter=100, verbose=false, save_info=false
1010
)
1111
S = fw_action(fhn, inst, range(0.0, T; length=N))
12-
@test isapprox(S, 0.18, atol=0.01) broken=true
12+
@test isapprox(S, 0.18, atol=0.01) broken = true
1313
end
1414

1515
@testset "MAM Ornstein-Uhlenbeck" begin

test/largedeviations/action_fhn.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ time = range(0.0, T; length=N)
1717

1818
@testset "fw_action" begin
1919
S = fw_action(sys, path, time)
20-
@test isapprox(S, 0.32, atol=0.01) broken=true
20+
@test isapprox(S, 0.32, atol=0.01) broken = true
2121
end
2222

2323
# Test om_action function
2424
@testset "om_action" begin
2525
S = om_action(sys, path, time, σ)
26-
@test isapprox(S, 0.26, atol=0.01) broken=true
26+
@test isapprox(S, 0.26, atol=0.01) broken = true
2727
end
2828

2929
# Test action function
@@ -34,13 +34,13 @@ end
3434
# Test geometric_action function
3535
@testset "geometric_action" begin
3636
S = geometric_action(sys, path)
37-
@test isapprox(S, 0.23, atol=0.01) broken=true
37+
@test isapprox(S, 0.23, atol=0.01) broken = true
3838
end
3939

4040
# Test fw_integrand function
4141
@testset "fw_integrand" begin
4242
integrand = CriticalTransitions.fw_integrand(sys, path, time, A)
43-
@test minimum(integrand) > 0.18 skip=true
43+
@test minimum(integrand) > 0.18 skip = true
4444
#^ This test is does not test something meaningful
4545
end
4646

test/largedeviations/gMAM.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
N = 100
88
res = geometric_min_action_method(fhn, x_i, x_f; N=75, maxiter=200, verbose=false)
99
S = geometric_action(fhn, res[1][end])
10-
@test isapprox(S, 0.18, atol=0.01) broken=true
10+
@test isapprox(S, 0.18, atol=0.01) broken = true
1111
end
1212

1313
@testset "gMAM Meier Stein" begin
@@ -36,7 +36,7 @@ end
3636
path = gm[1][end]
3737
action_val = gm[2][end]
3838
@test all(isapprox.(path[2, :][(end - 5):end], 0, atol=1e-3))
39-
@test all(isapprox.(action_val, 0.3375, atol=1e-3)) broken=true
39+
@test all(isapprox.(action_val, 0.3375, atol=1e-3)) broken = true
4040
end
4141

4242
@testset "HeymannVandenEijnden" begin # broken

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ end
4545
end
4646

4747
@testset "CoupledSDEs" begin
48-
include("CoupledSDEs.jl")
48+
include("CoupledSDEs.jl")
4949
end
5050

5151
@testset "ModelingToolkit" begin
@@ -59,7 +59,7 @@ end
5959
end
6060

6161
@testset "utilities" begin
62-
include("utils.jl")
62+
include("utils.jl")
6363
end
6464

6565
# @testset "Trajactories" begin

test/trajactories/transition.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
@test ensemble.t_trans 4.493941793363376 atol = 1e-2
2323
# SEED is different on github
2424
# SEED doesn;t work on github
25-
@test length(ensemble.times) == 11 broken=true
26-
@test ensemble.t_res 5299.98 broken=true
27-
25+
@test length(ensemble.times) == 11 broken = true
26+
@test ensemble.t_res 5299.98 broken = true
2827
end

0 commit comments

Comments
 (0)