Skip to content

Commit

Permalink
Merge pull request #118 from JuliaDynamics/run-formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
oameye authored Oct 12, 2024
2 parents 9151cae + 63b9f82 commit a507ddc
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ makedocs(;
Base.get_extension(CriticalTransitions, :ChaosToolsExt),
Base.get_extension(CriticalTransitions, :CoupledSDEsBaisin),
DynamicalSystemsBase,
Base.get_extension(DynamicalSystemsBase, :StochasticSystemsBase)
Base.get_extension(DynamicalSystemsBase, :StochasticSystemsBase),
],
doctest=false,
format=Documenter.HTML(; html_options...),
Expand All @@ -56,4 +56,4 @@ makedocs(;
plugins=[bib, links],
)

deploydocs(; repo="github.com/JuliaDynamics/CriticalTransitions.jl.git", push_preview=false)
deploydocs(; repo="github.com/JuliaDynamics/CriticalTransitions.jl.git", push_preview=false)
9 changes: 7 additions & 2 deletions src/CriticalTransitions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ using StochasticDiffEq:
terminate!,
u_modified!
using DynamicalSystemsBase:
DynamicalSystemsBase, CoupledSDEs, CoupledODEs,
dynamic_rule, current_state, set_state!, trajectory
DynamicalSystemsBase,
CoupledSDEs,
CoupledODEs,
dynamic_rule,
current_state,
set_state!,
trajectory

using ForwardDiff: ForwardDiff
using IntervalArithmetic: IntervalArithmetic, interval
Expand Down
2 changes: 1 addition & 1 deletion src/trajectories/transition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function transition(
condition(u, t, integrator) = subnorm(u - x_f; directions=rad_dims) < rad_f
affect!(integrator) = terminate!(integrator)
cb_ball = DiscreteCallback(condition, affect!)

prob = remake(sys.integ.sol.prob; u0=x_i, tspan=(0, tmax))
sim = solve(prob, sys.integ.alg; callback=cb_ball, kwargs...)
success = sim.retcode == SciMLBase.ReturnCode.Terminated
Expand Down
2 changes: 1 addition & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Normalizes the covariance matrix ``Q`` (in-place) by dividing it by
function normalize_covariance!(covariance)
l1norm = norm(covariance, 1)
dim = size(covariance)[1]
return covariance * dim/l1norm
return covariance * dim / l1norm
end

# Central finite difference, second derivative
Expand Down
2 changes: 1 addition & 1 deletion test/largedeviations/action_fhn.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ end
@testset "div_drift" begin
@test CT.div_drift(sys, zeros(2)) == -2.0
@test CT.div_drift(sys, x_i) == -4.0
end
end
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ end

@testset "Trajectories" begin
include("trajectories/simulate.jl")
# include("trajectories/transition.jl")
# include("trajectories/transition.jl")
end

@testset "Extentions" begin
Expand Down
6 changes: 3 additions & 3 deletions test/trajectories/simulate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
sys = CoupledSDEs(fitzhugh_nagumo, init, p; noise_strength=σ)
traj = trajectory(sys, 10, init)
relax = deterministic_orbit(sys, 10, init)
@test traj[1][1,1] == 1.0
@test isapprox(relax[1][end,1], 0.816; atol=1e-2)

@test traj[1][1, 1] == 1.0
@test isapprox(relax[1][end, 1], 0.816; atol=1e-2)
# These tests could be improved - Reyk
end

0 comments on commit a507ddc

Please sign in to comment.