-
Notifications
You must be signed in to change notification settings - Fork 6
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
Basins of Attraction of irregularly spaced grid #35
Comments
Hi! Once you have the mapper you can feed the initial conditions to the mapper in any order you like. For example
But you can define any grid you fancy and iterate over the initial conditions. If the grid is very large you can also use on the fly statistics to compute the basins volumes or whatever measure you need. |
Thanks, @awage. I have a quick follow-up question on this. I noticed that it must be gr = range(0.01, 70; length=npts*2)
fr = range(1.0, 4.5; length=npts*2)
ar = range(1, 40; length=npts*2)
cr = range(1, 250; length=npts*2)
grid = (gr, fr, ar, cr) But if I provide this one instead, gr = vcat(exp10.(range(log10(0.01), log10(0.74), length=npts)),exp10.(range(log10(0.75), log10(72),length=npts)))
fr = range(1.0, 4.5; length=npts*2)
ar = range(1, 40; length=npts*2)
cr = range(1, 250; length=npts*2)
grid = (gr, fr, ar, cr) |
Notice that Attractors.jl is a separate module now that has several updates and modifications from the version of basins/tipping/etc. currently present in the feature frozen DynamicalSystems.jl documentation. I've transferred the issue to the appropriate repo. I'd recommend using Attractors.jl directly for now. |
@mdepitta the problem is that the grid needs to be a tuple of From a computing perspective, there is no reason for things to be ranges. The code would work exactly the same given vectors or ranges or practically any iterable. Scientifically, I am not sure however if anything outside a range would make sense. You want to have a tesselation of the stapte space so that in the limit of box size of tesselation going to 0 you get the exact answer of the basins of attractions. On the other hand, maybe we should allow any arbitrary vector to be given as a grid for a dimension, provided the vector is sorted? In the source code it is a rather trivial change of |
For the future; Please, when you say "doing X fails", always also paste the actual error message, so that the devs don't have to speculate. At the moment I am speculating about your actual error. |
Also, hi, and welcome to Julia and the DynamicalSystems.jl framework, and thanks a lot for opening issues, this is very helpful :) |
@Datseris Thanks for the welcoming words! For my case of non-uniform / mixed data type grid I came up with the following temporary solution: that is an edit of the ## These are my variable ranges
npts = 50
gr = vcat(exp10.(range(log10(0.01), log10(32), length=npts)),range(log10(35), log10(72),length=npts))
fr = range(1.0, 4.5; length=npts*2)
ar = exp10.(range(log10(1.0), log10(40.0), length=npts*2))
cr = exp10.(range(log10(1.0), log10(250.0), length=npts*2))
## Refined
grid = (gr, fr, ar, cr)
# # Calculate basins of attraction (old)
reltol = 1e-6
abstol = 1e-6
diffeq = (alg = Vern9(), reltol = reltol, abstol = abstol)
## Find basins by proximity
## In my case attractors are known and I read them from data
mapper = AttractorsViaProximity(mevmo, attractors; diffeq=diffeq)
## This is a modified version of `estimate_by_proximity`
## Allocate basins (this is a modified for-cycle from basins_of_attraction.estimate_basins_proximity to account for special ICs)
basins = zeros(Int16, map(length, grid))
progress = ProgressMeter.Progress(
length(basins); desc = "Basins of attraction: ", dt = 1.0
)
for (k,ind) in enumerate(CartesianIndices(basins))
ProgressMeter.update!(progress, k)
## ICs
y0 = SVector{4}([gr[ind[1]],fr[ind[2]],ar[ind[3]],cr[ind[4]]]) #<------------------- This is the modified line, instead of using `generate_ic_on_grid`
## Associated basins to that ics
basins[ind] = mapper(y0)
end |
I don't understand what (Also, please use |
This change would not break anything and I don't see any possible regression on performances. The function |
* One issue in function store_attractor! to be discussed, rest works quite well, both for regular and irregular * tests * changelog * typo fix * mfs test fail fix * Update src/mapping/attractor_mapping_recurrences.jl Co-authored-by: George Datseris <datseris.george@gmail.com> * sketch of example * sketch of example * Update docs/src/examples.md Co-authored-by: George Datseris <datseris.george@gmail.com> * fixes * typo * create an example that showcases everything correctly --------- Co-authored-by: George Datseris <datseris.george@gmail.com>
How can I do a search/characterization of the basins of attraction on an irregular grid? It is, in fact, not an uncommon situation to have basins of attraction that are robust against some state variable perturbations rather than others. So it is convenient to have a search on, say, N points on variables that are known to have little impact on trajectories' ending points within a reasonable interval, but on 2xN or more points on those that are critical, and show high variability.
Ideally say, we would like to have:
When I tried to run something similar to this I get in
IJulia
:MethodError: no method matching generate_ic_on_grid(::Tuple{Matrix{Float64}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, ::CartesianIndex{4})
Closest candidates are:
generate_ic_on_grid(::Tuple{Vararg{T, B}}, ::Any) where {B, T} at ~/.julia/packages/ChaosTools/PHPDF/src/basins/attractor_mapping.jl:145
The text was updated successfully, but these errors were encountered: