Formalize basins with dedicated types
enhancementdesign discussion
**Describe the feature you'd like to have**
At the moment we handle basins of attraction as a standard Julia Array. The grid corresponding to the basins is a separate variable, and the attractors are as well. This has two major problems:
1. It is tedius as one has to carry around the grid and attractors and basins.
2. It does not play well with an alternative formulation of basins that one gets from `basins_fractions`: the sampled basins. There the basins are not an Array but rather a vector of points.
I think formalizing this concept is a benefit, and it also allows us to extend it naturally and simply to future research.
**If possible, sketch out an implementation strategy**
- Define abstarct type `BasinsOfAttraction{ID}`. Always "contains" attractors. Type parameterization `ID` is what is the thing stored as an attractor label. For standard basins this is `Int`.
- Define subtype `ArrayBasinsOfAttraction`. Contains a `grid` (instance of `Grid` subtype), and the basin array.
- Define subtype `SampledBasinsOfAttraction`. Contains two vectors: `sampled_points` and `points_ids`. Initial conditions and their labels.
We can then directly pass the instance of such types into functions like final state sensivitty, or the `heatmap_basins_attractors`, or in general all plotting functions.
We can then extend `ProbabilisticBasinsOfAttraction` where `ID` is not `Int` but rather `Dict{Int, Float}`, the probability to go to each attractor.
关闭于 2026-02-24 1 条评论