-
Notifications
You must be signed in to change notification settings - Fork 4
Using new CoupledSDEs
#116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
ca5112c
load CoupledSDEs from DynamicalSystemsBase v3.11
reykboerner b529363
worked on compatibility with new CoupledSDEs
reykboerner 268e9b5
updated LDT functions, made om_action require noise_strength input
reykboerner 3358570
export functions from StochasticSystemsBase
reykboerner a27b135
worked on updating tests
reykboerner 454162c
CoupledSDEs test's
oameye 5c12110
try out new format action
oameye 0f5318e
turn on all tests
oameye 6881140
format
oameye 06115ab
fix downgrade compat
oameye c220516
better format CI
oameye 65ec611
update code example in README
reykboerner fa68b32
fixed Large Deviations tests by normalizing covariance matrix
reykboerner ec60076
updated simulation functions
reykboerner b5ecd7d
added simulation tests
reykboerner 5a8f5a4
removed 'simulate', renamed 'relax' to 'deterministic_orbit'
reykboerner 98b5db0
tried to fix docs, still not finding docstrings from DynamicalSystems…
reykboerner 397ba55
add stochasticSystemsBase do docs modules
oameye 78c787a
fixed typo in makedocs
reykboerner f520ef4
Merge branch 'main' into base_coupledsdes
oameye d7b2477
exported missing functions, removed unneeded dep
reykboerner 2fbbf33
worked on fixing docs errors
reykboerner 7b57b1e
added dependency to docs
reykboerner d9e2845
added another dep to docs
reykboerner 59af416
updated changelog to v0.4.0
reykboerner ffd0dad
fixed errors in docstrings
reykboerner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
$(TYPEDSIGNATURES) | ||
|
||
Returns the deterministic drift ``f(x)`` of the CoupledSDEs `sys` at state `x`. For time- | ||
dependent systems, the time can be specified as a keyword argument `t` (by default `t=0`). | ||
""" | ||
function drift(sys::CoupledSDEs{IIP}, x; t=0) where {IIP} | ||
f = dynamic_rule(sys) | ||
if IIP | ||
dx = similar(x) | ||
f(dx, x, sys.p0, t) | ||
return dx | ||
else | ||
return f(x, sys.p0, t) | ||
end | ||
end | ||
|
||
""" | ||
$(TYPEDSIGNATURES) | ||
|
||
Computes the divergence of the drift field ``f(x)`` at state `x`. For time- | ||
dependent systems, the time can be specified as a keyword argument `t` (by default `t=0`). | ||
""" | ||
function div_drift(sys::CoupledSDEs, x; t=0) | ||
b(x) = drift(sys, x; t) | ||
return tr(ForwardDiff.jacobian(b, x)) | ||
end; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@testset "fitzhugh_nagumo" begin | ||
# Define systems | ||
g = diag_noise_funtion(0.215) | ||
system = CoupledSDEs(fitzhugh_nagumo, g, [2.0, 0.1], [0.1, 3.0, 1.0, 1.0, 1.0, 0.0]) | ||
|
||
# Set up domain | ||
A, B, C = [0.0, 0.0], [1.0, 0.0], [0.0, 1.0] | ||
box = intervals_to_box([-2.0, -2.0], [2.00, 2.0]) | ||
step = 0.1 | ||
|
||
boas = basins(system, A, B, C, box; bstep = [step, step]) | ||
oameye marked this conversation as resolved.
Show resolved
Hide resolved
|
||
X, Y, attractors, h = boas | ||
boundary = basinboundary(boas) | ||
@test length(attractors) == 2 | ||
@test length(unique(h)) == 3 | ||
@test h[end÷2+1, end÷2+1] == -1 | ||
@test boundary[:,end÷2+1] == zeros(2) | ||
oameye marked this conversation as resolved.
Show resolved
Hide resolved
|
||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using CriticalTransitions, StaticArrays, Test | ||
|
||
function meier_stein(u, p, t) # in-place | ||
x, y = u | ||
dx = x-x^3 -10*x*y^2 | ||
dy = -(1+x^2)*y | ||
SA[dx, dy] | ||
oameye marked this conversation as resolved.
Show resolved
Hide resolved
|
||
end | ||
σ = 0.25 | ||
sys = StochSystem(meier_stein, [], zeros(2), σ, idfunc, nothing, I(2), "WhiteGauss") | ||
|
||
# initial path: parabola | ||
xx = range(-1.0,1.0, length=30) | ||
yy = 0.3 .* (- xx .^ 2 .+ 1) | ||
oameye marked this conversation as resolved.
Show resolved
Hide resolved
|
||
init = Matrix([xx yy]') | ||
|
||
gm = geometric_min_action_method(sys, init, maxiter=1000) | ||
@test all(isapprox.(path[2,:][end-5:end], 0, atol=1e-3)) | ||
oameye marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
gm[2][end] | ||
|
||
isapprox(gm[2][end], 0.338, atol=1e-3) | ||
oameye marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.