Skip to content
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

Key 0 returned by AttractrosViaRecurrences #73

Closed
Datseris opened this issue Jun 1, 2023 · 3 comments
Closed

Key 0 returned by AttractrosViaRecurrences #73

Datseris opened this issue Jun 1, 2023 · 3 comments
Labels
bug Something isn't working recurrences Finding attractors via recurrences in state space (Datseris & Wagemakers 2021)

Comments

@Datseris
Copy link
Member

Datseris commented Jun 1, 2023

Describe the bug

If my understanding is correct, the output of basins_fractions or basins_of_attraction with AttractorsViaRecurrences should never contain 0 as an attractor ID. Only -1 and the positive integers. Yet, here is an example where 0 is a key in the found basins!

Minimal Working Example

using Attractors

function dissipative_standard_map_rule(u, p, n)
    x, y = u
    ν, f₀ = p
    s = x + y
    xn = mod2pi(s)
    yn = (1 - ν)*y + f₀*(sin(s))
    return SVector(xn, yn)
end

p0 == 0.02, f0 = 4.0)
u0 = [0.1, 0.1]
ds = DeterministicIteratedMap(dissipative_standard_map_rule, u0, p0)
density = 2000
xg = range(0, 2π; length = density+1)[1:end-1]
yg = range(-ymax, ymax; length = density)
grid = (xg, yg)

mapper_kwargs = (
    mx_chk_att = 3,       # attractors are well-separated in the state space: so this is small
    mx_chk_fnd_att = 200, # attractors are low period orbits, so this is small
    mx_chk_loc_att = 200, # very high multistability means this should be high
    mx_chk_hit_bas = 10,  # for more accuracy, but in any case basins are so riddled
                          # that it is unlikely that this clause will even be hit...
    sparse = false, # we want to compute full basins
    Ttr = 10,
)

mapper = AttractorsViaRecurrences(ds, grid; mapper_kwargs...)

basins, attractors = basins_of_attraction(mapper)
ids = sort!(unique(basins))
142-element Vector{Int32}:
  -1
   0
   1
   2
   3
   4
   5
   6
   7
   8
   ⋮

Package versions

Latest stable.


This issue also highlights that a logging system is useful (discussed in #70 )

@Datseris Datseris added bug Something isn't working recurrences Finding attractors via recurrences in state space (Datseris & Wagemakers 2021) labels Jun 1, 2023
@awage
Copy link
Contributor

awage commented Jun 1, 2023

Using sparse = true gives the correct answer. That's a problem with the matrix in bsn_nfo. I'll check this

@Datseris
Copy link
Member Author

Datseris commented Jun 1, 2023

This means that there are some cells whose initial conditions are not used (because by defualt teh grid isinitialized with 0s everywhere when sparse = false). But why would this be? Why would some cells be skipped?

@awage
Copy link
Contributor

awage commented Jun 1, 2023

Shouldn't happen. The key 0 is not present in attractors. Some cells are not initialized or they are skipped for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working recurrences Finding attractors via recurrences in state space (Datseris & Wagemakers 2021)
Projects
None yet
Development

No branches or pull requests

2 participants