Skip to content

Commit

Permalink
More tests in test_morris_lecar.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Aug 14, 2018
1 parent 0f44d36 commit 51d6253
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/base/tools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ function count_special_points(sol::BifurcationSolution)
end
return counter
end

count_special_points(solver::BifurcationSolver) =
count_special_points(solver.sol)
1 change: 1 addition & 0 deletions src/codim2/solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ function re_analyze!(solver::Codim2Solver, u::AbstractVector)
# Suppress special point recording:
# It's a bit ugly hack... (communicate by sharing!)
solver.cache.point_type = PointTypes.none # TODO: FIX!
solver.cache.lyapunov_coefficient = NaN # TODO: FIX!

record!(solver.sol, solver.cache)
end
Expand Down
39 changes: 39 additions & 0 deletions test/test_morris_lecar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ include("preamble.jl")
using StaticArrays: SVector

using Bifurcations: resolved_points
using Bifurcations.BifurcationsBase: count_special_points
using Bifurcations.Codim2LimitCycle: FoldLimitCycleProblem
using Bifurcations.Examples.MorrisLecar

Expand Down Expand Up @@ -65,4 +66,42 @@ flc_solver = init(
)
@time solve!(flc_solver)



sn_prob = BifurcationProblem(
special_points(solver1, Codim1.PointTypes.saddle_node)[1],
solver1,
(@lens _.z),
(-1.0, 1.0),
)
sn_solver = init(
sn_prob;
nominal_angle_rad = 2π * (5 / 360),
max_samples = 1000,
start_from_nearest_root = true,
)
@time solve!(sn_solver)

@test count_special_points(sn_solver) == Dict(
Codim2.PointTypes.bogdanov_takens => 1,
Codim2.PointTypes.cusp => 1,
)


hopf_prob2 = BifurcationProblem(
special_points(sn_solver, Codim2.PointTypes.bogdanov_takens)[1],
sn_solver,
)
hopf_solver2 = init(hopf_prob2)
@time solve!(hopf_solver2)

count_hopf_solver2 = count_special_points(hopf_solver2)

@test Set(keys(count_hopf_solver2)) <= Set([Codim2.PointTypes.bogdanov_takens])
if Codim2.PointTypes.bogdanov_takens in keys(count_hopf_solver2)
@test count_hopf_solver2 == Dict(
Codim2.PointTypes.bogdanov_takens => 1,
)
end

end # module

0 comments on commit 51d6253

Please sign in to comment.