-
Notifications
You must be signed in to change notification settings - Fork 7
[WIP] nonlocal stability measure estimator #165
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 28 commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
31ff74e
Implemented all functionality of the StabilityMeasuresAccumulator int…
andreasmorr 6d31bd0
Made the plotting function compatible with the wider plotting framewo…
andreasmorr f0f675f
Adjusted the stability measure plotting functions and included docume…
andreasmorr 4d94d80
improve the docstring a bit
Datseris 2e1eafc
more docstring and comments
Datseris 33bc5bf
some typos in functions
Datseris 1bdb6cc
small error corrections in stability measure accumulation
andreasmorr c6d838d
Merge remote-tracking branch 'origin/stability_measures' into stabili…
andreasmorr 165fd11
comments on type stability
Datseris 9f97270
more todos regarding distributions and other type stability
Datseris 492f76f
comment on outside grid
Datseris ee738ff
another comment for outside grid
Datseris 1dfe651
WIP on stability_measures
andreasmorr 405dca4
WIP on stability_measures
andreasmorr 9b943a8
WIP on stability_measures
andreasmorr e308495
Merge branch 'main' into stability_measures
Datseris 1e90f29
add new stuff to the docs
Datseris 493f7ea
Fixed corrupted ipynbs
andreasmorr b862a41
Adopted new name for finalize_accumulator
andreasmorr b58a302
Removed persistence from accumulator
andreasmorr 63bc01d
Started adjusting stability measure continuation for Proximity mapper
andreasmorr 42a4e34
rework API for global continuation: now jsut use existing ACAM
Datseris be02c5f
Merge remote-tracking branch 'origin/stability_measures' into stabili…
andreasmorr 3afcdb7
Continuation with Proximity mapper and d depending on p
andreasmorr 6b6d685
Comment on Proximity problem
andreasmorr e332ea2
draft of new nonlocal stability continaution
Datseris 48eb03b
add a test draft
Datseris e7b10fb
WIP on stability_measures
andreasmorr 3ce9d1d
WIP on stability_measures
andreasmorr a7d32f7
WIP on stability_measures
andreasmorr bac8c9c
Merge branch 'main' into stability_measures
Datseris 8ec1914
allow filler value for basins plot
Datseris e275d6c
also record basin fractions in accumulator
Datseris 1493be8
better keyword names? TODO: We have to decide this!
Datseris 0102f7a
rename keywords for clarity
Datseris 7fc90d9
set Ttr to 0 for proximity
Datseris ca4c568
WIP on stability_measures
andreasmorr 71de74f
Make ε a keyword argument for proximity mapper
Datseris 533e6ce
Change the order of pcurve, ics to match that of global continuation
Datseris 3c1f37e
propagate this keyword cahnge also to the nonlocal continuation
Datseris 2c15b87
harmonize keyword `N` to `samples_per_parameter`
Datseris a6e6576
Partially corrected formatting of long code lines
andreasmorr 6bea6ae
List comprehension changes
andreasmorr 00c11e9
Update docs/src/examples.md
andreasmorr 2166b14
Update docs/src/examples.md
andreasmorr d858936
More formatting of long lines
andreasmorr 63b17d9
Comment formatting
andreasmorr 46bd803
Update src/mapping/stability_measures_accumulator.jl
andreasmorr f01b078
Case distinction for discrete systems and linear measures
andreasmorr 31388d3
reverted line break formatting
andreasmorr 6bee085
Merge remote-tracking branch 'origin/stability_measures' into stabili…
andreasmorr 0392780
Fixed calculation of mean convergence time and pace
andreasmorr 98f75ac
critical fix in convergence time of recurrences mapper
Datseris 479fe81
Merge remote-tracking branch 'origin/conv_time_fix' into stability_me…
andreasmorr f7a997b
WIP on stability_measures
andreasmorr f47fdf1
enable tests in test suite
Datseris 66cdf93
add 3 TODOs for @andreasmorr
Datseris d391b5c
add docs to general stability continuation
Datseris ba443aa
add one more TODO for andreasmorr
Datseris 26bf17a
Merge branch 'main' into stability_measures
Datseris e18b529
mention Inf value for single attractopr and fatal shocks
Datseris 3eda211
re-write tutorial: dedicated enhancement of continuation with new stuff
Datseris 8c12072
remove recomputation in the example for nonlocal continuation
Datseris ac99b07
WIP on stability_measures
andreasmorr b7dfa31
Changed term "fatal" to "critical"
andreasmorr 42869a3
Small fix in the tests of stability measures accumulator
andreasmorr daf1fd6
improve logic in `edgetracking` to avoid duplicate point storage
Datseris 3d37d87
fix edgetracking tests
Datseris a944ae0
make edgetracking give Ttr = 100 by default
Datseris 3b870bc
also fix the MFS test failure
Datseris 6cbb72d
add changelog entry for proximity
Datseris bce7688
Merge remote-tracking branch 'origin/stability_measures' into stabili…
andreasmorr b463479
allow seed option in Brute Force MCS
Datseris 5d7ad49
clarify and explain tests of MCS
Datseris cd7a321
clarify explain and fix tests
Datseris 89bd196
provide instructions on how to typeset epsilon
Datseris 65f9a4b
fix tests and doc failures
Datseris 19d617b
deprecate all "fatal" to "critical"
Datseris 428e9f1
fix test checking ε in proximity
Datseris 745dfdb
fatal to critical in exmples
Datseris ef67388
changelog and citation
Datseris dc8e201
changelog and citation
Datseris d986624
add a (failing) test for linear stability measures of a map
Datseris 5bab765
Merge branch 'main' into stability_measures
Datseris 53556dc
add changelog entry
Datseris 74cdefa
Merge remote-tracking branch 'origin/stability_measures' into stabili…
Datseris abe132b
add a test for discrete time system
Datseris 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,113 @@ | ||
# TODO: Can we make this function not duplicate the source code | ||
# of the original `ASCM` implementation? | ||
|
||
function global_continuation( | ||
acam::AttractorSeedContinueMatch{<:StabilityMeasuresAccumulator}, pcurve, ics; | ||
samples_per_parameter = 100, show_progress = true, | ||
) | ||
N = samples_per_parameter | ||
progress = ProgressMeter.Progress(length(pcurve); desc = "Continuing attractors and stability:", enabled=show_progress) | ||
mapper = acam.mapper | ||
reset_mapper!(mapper) | ||
|
||
set_parameters!(referenced_dynamical_system(mapper), pcurve[1]) | ||
if ics isa Function | ||
fs = basins_fractions(mapper, ics; show_progress = false, N = samples_per_parameter) | ||
else # we ignore labels in this continuation algorithm | ||
fs, = basins_fractions(mapper, ics; show_progress = false) | ||
end | ||
|
||
# this is the first difference with the standard continuation: we have to call finalize. | ||
measures = finalize_accumulator(mapper) | ||
measures_cont = [measures] | ||
|
||
prev_attractors = deepcopy(extract_attractors(mapper)) | ||
attractors_cont = [deepcopy(prev_attractors)] # we need the copy | ||
ProgressMeter.next!(progress) | ||
|
||
# Continue loop over all remaining parameters | ||
### For @Datseris: Is this what you had in mind when we emailed about | ||
andreasmorr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
### the global continuation algorithm with AttractorsViaProximity? | ||
### Currently, line 44 has an error because we cant pass ics to the AttractorsViaRecurrences. | ||
for p in @view(pcurve[2:end]) | ||
set_parameters!(referenced_dynamical_system(mapper), p) | ||
reset_mapper!(mapper) | ||
if typeof(mapper.mapper) <: AttractorsViaRecurrences | ||
fs = if allows_mapper_u0(mapper) | ||
seed_attractors_to_fractions_individual(mapper, prev_attractors, ics, N, acam.seeding) | ||
else | ||
seed_attractors_to_fractions_grouped(mapper, prev_attractors, ics, N, acam.seeding) | ||
end | ||
current_attractors = deepcopy(extract_attractors(mapper)) | ||
else | ||
error("Unsupported mapper type: $(typeof(mapper.mapper))") | ||
end | ||
push!(attractors_cont, current_attractors) | ||
overwrite_dict!(prev_attractors, current_attractors) | ||
ProgressMeter.next!(progress) | ||
|
||
# this is the second difference in global continuation | ||
measures = finalize_accumulator(mapper) | ||
push!(measures_cont, measures) | ||
end | ||
|
||
rmaps = match_sequentially!(attractors_cont, acam.matcher; pcurve, ds = referenced_dynamical_system(mapper)) | ||
|
||
# This is the third difference in global continuation | ||
for i in 2:length(pcurve) | ||
for dict in values(measures_cont[i]) | ||
swap_dict_keys!(dict, rmaps[i-1]) | ||
end | ||
end | ||
transposed = Dict{String, Vector{Dict{Int64, Float64}}}() | ||
for measure in measures_cont[1] | ||
measure_name = measure[1] | ||
transposed[measure_name] = Vector{Dict{Int64, Float64}}() | ||
end | ||
|
||
for measures in measures_cont | ||
for (measure_name, measure_dict) in measures | ||
push!(transposed[measure_name], measure_dict) | ||
end | ||
end | ||
measures_cont = transposed | ||
andreasmorr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
return measures_cont, attractors_cont | ||
end | ||
|
||
|
||
|
||
# make sure to allow the possiblity that the proximity options can also be | ||
# vectors of same length as `pcurve`; Same for the distributions | ||
function stability_measures_along_continuation(ds::DynamicalSystem, attractors_cont, ics, pcurve, εs, distributions, Ts; metric=Euclidean(), proximity_mapper_options=[]) | ||
measures_cont = [] | ||
for (i, p) in enumerate(pcurve) | ||
ε = εs isa AbstractVector ? εs[i] : εs # if its a vector, get i-th entry | ||
d = distributions isa AbstractVector ? distributions[i] : distributions # if its a vector, get i-th entry | ||
T = Ts isa AbstractVector ? Ts[i] : Ts # if its a vector, get i-th entry | ||
set_parameters!(ds, p) | ||
attractors = attractors_cont[i] | ||
accumulator = StabilityMeasuresAccumulator( | ||
AttractorsViaProximity(ds, attractors, ε, proximity_mapper_options...), | ||
d=d, T=T, metric=metric | ||
) | ||
andreasmorr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
for u0 in ics | ||
id = accumulator(u0) | ||
end | ||
push!(measures_cont, finalize_accumulator(accumulator)) | ||
end | ||
|
||
transposed = Dict{String, Vector{Dict{Int64, Float64}}}() | ||
for measure in measures_cont[1] | ||
measure_name = measure[1] | ||
transposed[measure_name] = Vector{Dict{Int64, Float64}}() | ||
end | ||
|
||
for measures in measures_cont | ||
for (measure_name, measure_dict) in measures | ||
push!(transposed[measure_name], measure_dict) | ||
end | ||
end | ||
measures_cont = transposed | ||
return measures_cont | ||
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
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.