@@ -200,8 +200,7 @@ conditions to map to attractors, the method can further utilize found exit and a
200200basins, making the computation faster as the grid is processed more and more.
201201"""
202202function basins_of_attraction (mapper:: AttractorsViaRecurrences ; show_progress = true )
203- basins = mapper. bsn_nfo. basins
204- if basins isa SparseArray;
203+ if mapper. bsn_nfo. basins isa SparseArray;
205204 throw (ArgumentError ("""
206205 Sparse version of AttractorsViaRecurrences is incompatible with
207206 `basins_of_attraction(mapper)`."""
@@ -214,6 +213,8 @@ function basins_of_attraction(mapper::AttractorsViaRecurrences; show_progress =
214213 grid = mapper. grid. grid
215214 end
216215
216+ basins = zero (mapper. bsn_nfo. basins)
217+
217218 I = CartesianIndices (basins)
218219 progress = ProgressMeter. Progress (
219220 length (basins); desc = " Basins of attraction: " , dt = 1.0
@@ -227,18 +228,11 @@ function basins_of_attraction(mapper::AttractorsViaRecurrences; show_progress =
227228 if basins[ind] == 0
228229 show_progress && ProgressMeter. update! (progress, k)
229230 y0 = generate_ic_on_grid (grid, ind)
230- basins[ind] = recurrences_map_to_label! (
231- mapper. bsn_nfo, mapper. ds, y0; show_progress, mapper. kwargs...
232- )
231+ basins[ind] = mapper (y0; show_progress)
233232 end
234233 end
235234
236- # remove attractors and rescale from 1 to max number of attractors
237- bas_tmp = copy (basins)
238- ind = iseven .(basins)
239- bas_tmp[ind] .+ = 1
240- bas_tmp .= (bas_tmp .- 1 ) .÷ 2
241- return bas_tmp, mapper. bsn_nfo. attractors
235+ return basins, extract_attractors (mapper)
242236end
243237
244238# ####################################################################################
0 commit comments