Skip to content

Commit db27621

Browse files
authored
Test for the bug patch in #177 (#179)
* fix basins * only change the output basins, not the mapper state * change patch number * fix doc compiling errors * add test * fix test * move test
1 parent 88334d7 commit db27621

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name = "Attractors"
22
uuid = "f3fd9213-ca85-4dba-9dfd-7fc91308fec7"
33
authors = ["George Datseris <[email protected]>", "Kalel Rossi", "Alexandre Wagemakers"]
44
repo = "https://github.com/JuliaDynamics/Attractors.jl.git"
5-
version = "1.26.3"
5+
version = "1.26.4"
66

77

88
[deps]

docs/make.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ pages = [
2828
Documenter.hide("recurrences_animation.md"),
2929
]
3030

31+
size_threshold_ignore = [
32+
"tutorial.md",
33+
"api.md",
34+
"examples.md",
35+
"references.md",
36+
]
37+
3138
import Downloads
3239
Downloads.download(
3340
"https://raw.githubusercontent.com/JuliaDynamics/doctheme/master/build_docs_with_style.jl",
@@ -44,4 +51,5 @@ bib = CitationBibliography(
4451

4552
build_docs_with_style(pages, Attractors, StateSpaceSets;
4653
expandfirst = ["index.md"], bib, warnonly = [:doctest, :missing_docs, :cross_references],
54+
htmlkw = (;size_threshold_ignore)
4755
)

docs/refs.bib

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@ @article{Krakovska2024ResilienceDynamicalSystems
295295
@article{Morr2025,
296296
title = {To be published},
297297
author = {Andreas Morr, George Datseris},
298+
journal = {},
299+
volume = {},
300+
number = {},
301+
pages = {},
298302
year = {2025},
299303
}
300304

test/mapping/attractor_mapping.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ function test_basins(ds, u0s, grid, expected_fs_raw, featurizer;
7171
test_basins_fractions(mapper; err = rerr)
7272
end
7373

74+
75+
7476
@testset "Featurizing, clustering" begin
7577
optimal_radius_method = "silhouettes_optim"
7678
config = GroupViaClustering(; num_attempts_radius=20, optimal_radius_method)
@@ -330,3 +332,27 @@ if DO_EXTENSIVE_TESTS
330332
end
331333

332334
end
335+
336+
@testset "Basins of Attraction" begin
337+
# The reason of this test is to check whether
338+
# basins_of_attraction does not modify the internal
339+
# state of the mapper changing. (regression bug)
340+
function map_3_states(z, p, n)
341+
if z[1] < -1
342+
return SVector(-2.0, 0.)
343+
elseif -1 z[1] 1
344+
return SVector(0.0, 0.)
345+
else
346+
return SVector(2.0, 0.)
347+
end
348+
end
349+
ds = DiscreteDynamicalSystem(map_3_states, zeros(2))
350+
xg = yg = range(-3, 3; length = 20)
351+
grid = (xg, yg)
352+
mapper = AttractorsViaRecurrences(ds, grid; sparse = false)
353+
basins, atts = basins_of_attraction(mapper; show_progress = false)
354+
ics = [ [x,1.0] for x in range(-3,3,length = 20)]
355+
fractions, labels = basins_fractions(mapper, ics)
356+
357+
@test 0 keys(fractions)
358+
end

0 commit comments

Comments
 (0)