From 91af0c1e00e8eda585b8500abfd475a8d3fc576b Mon Sep 17 00:00:00 2001 From: Datseris Date: Sun, 22 Sep 2024 23:28:24 +0100 Subject: [PATCH 1/2] change Dataset name --- Project.toml | 2 +- src/chaosdetection/lyapunovs/local_growth_rates.jl | 2 +- src/chaosdetection/lyapunovs/lyapunov_from_data.jl | 4 ++-- src/dimreduction/dyca.jl | 2 +- src/periodicity/periodicorbits.jl | 8 ++++---- test/rareevents/return_time_tests.jl | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Project.toml b/Project.toml index 1fd0acb5..51318979 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ChaosTools" uuid = "608a59af-f2a3-5ad4-90b4-758bdf3122a7" repo = "https://github.com/JuliaDynamics/ChaosTools.jl.git" -version = "3.2.0" +version = "3.2.1" [deps] Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" diff --git a/src/chaosdetection/lyapunovs/local_growth_rates.jl b/src/chaosdetection/lyapunovs/local_growth_rates.jl index d1bb1d7d..2c98af88 100644 --- a/src/chaosdetection/lyapunovs/local_growth_rates.jl +++ b/src/chaosdetection/lyapunovs/local_growth_rates.jl @@ -1,7 +1,7 @@ export local_growth_rates """ - local_growth_rates(ds::DynamicalSystem, points::Dataset; kwargs...) → λlocal + local_growth_rates(ds::DynamicalSystem, points::StateSpaceSet; kwargs...) → λlocal Compute the local exponential growth rate(s) of perturbations of the dynamical system `ds` for initial conditions given in `points`. For each initial condition `u ∈ points`, diff --git a/src/chaosdetection/lyapunovs/lyapunov_from_data.jl b/src/chaosdetection/lyapunovs/lyapunov_from_data.jl index 72c838e8..481712f9 100644 --- a/src/chaosdetection/lyapunovs/lyapunov_from_data.jl +++ b/src/chaosdetection/lyapunovs/lyapunov_from_data.jl @@ -8,7 +8,7 @@ export lyapunov_from_data export Euclidean, FirstElement """ - lyapunov_from_data(R::Dataset, ks; kwargs...) + lyapunov_from_data(R::StateSpaceSet, ks; kwargs...) For the given dataset `R`, which is expected to represent a trajectory of a dynamical system, calculate and return `E(k)`, which is the average logarithmic @@ -64,7 +64,7 @@ the absolute distance of *only the first elements* of the points of `R` [^Kantz1994]: Kantz, H., Phys. Lett. A **185**, pp 77–87 (1994) """ -function lyapunov_from_data(R::AbstractDataset{D, T}, ks; +function lyapunov_from_data(R::AbstractStateSpaceSet{D, T}, ks; refstates = 1:(length(R) - ks[end]), w = 1, distance = FirstElement(), ntype = NeighborNumber(1), ) where {D, T} diff --git a/src/dimreduction/dyca.jl b/src/dimreduction/dyca.jl index 59b05611..5f3e2b6c 100644 --- a/src/dimreduction/dyca.jl +++ b/src/dimreduction/dyca.jl @@ -43,7 +43,7 @@ is projected onto. 10.1109/mlsp.2018.8517024, 2018 IEEE 28th International Workshop on Machine Learning for Signal Processing (MLSP) """ -dyca(A::AbstractDataset, e) = dyca(Matrix(A), e) +dyca(A::AbstractStateSpaceSet, e) = dyca(Matrix(A), e) function dyca(data, eig_threshold::AbstractFloat; norm_eigenvectors::Bool=false) derivative_data = matrix_gradient(data) #get the derivative of the data diff --git a/src/periodicity/periodicorbits.jl b/src/periodicity/periodicorbits.jl index 7bd17ea7..607dc648 100644 --- a/src/periodicity/periodicorbits.jl +++ b/src/periodicity/periodicorbits.jl @@ -30,8 +30,8 @@ a random permutation will be chosen for them, with `λ=0.001`. the next one is `≤ disttol` then it has converged to a fixed point. * `inftol = 10.0`: If a state reaches `norm(state) ≥ inftol` it is assumed that it has escaped to infinity (and is thus abandoned). -* `abstol = 1e-8`: A detected fixed point isn't stored if it is in `abstol` - neighborhood of some previously detected point. Distance is measured by +* `abstol = 1e-8`: A detected fixed point isn't stored if it is in `abstol` + neighborhood of some previously detected point. Distance is measured by euclidian norm. If you are getting duplicate fixed points, decrease this value. ## Description @@ -78,7 +78,7 @@ function periodicorbits( Λ = lambdamatrix(λ, inds, sings) _periodicorbits!(FP, ds, o, ics, Λ, maxiters, disttol, inftol, abstol) end - return Dataset(collect(FP)) + return StateSpaceSet(collect(FP)) end function periodicorbits( @@ -99,7 +99,7 @@ function periodicorbits( FP = Set{type}() Λ = lambdamatrix(0.001, dimension(ds)) _periodicorbits!(FP, ds, o, ics, Λ, maxiters, disttol, inftol, abstol) - return Dataset(collect(FP)) + return StateSpaceSet(collect(FP)) end function _periodicorbits!(FP, ds, o, ics, Λ, maxiter, disttol, inftol, abstol) diff --git a/test/rareevents/return_time_tests.jl b/test/rareevents/return_time_tests.jl index 59cafdfe..5d499a95 100644 --- a/test/rareevents/return_time_tests.jl +++ b/test/rareevents/return_time_tests.jl @@ -220,7 +220,7 @@ function visual_guidance(ro, times, u0, diffeq, εs, crossing_method) step!(integ) push!(tr4, current_state(integ)) end - tr4 = Dataset(tr4) + tr4 = StateSpaceSet(tr4) else tr4 = trajectory(ro, times[4], u0; diffeq) end From b47d5ac93d367d5bb78f1cf0b1ec361fd437b7e2 Mon Sep 17 00:00:00 2001 From: Datseris Date: Mon, 23 Sep 2024 08:17:07 +0100 Subject: [PATCH 2/2] fix wrong usage of size --- test/stability/fixedpoints.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/stability/fixedpoints.jl b/test/stability/fixedpoints.jl index 34f39ff2..af3125e4 100644 --- a/test/stability/fixedpoints.jl +++ b/test/stability/fixedpoints.jl @@ -14,7 +14,8 @@ using ChaosTools, Test @testset "J=$(J)" for J in (nothing, henon_jacob) fp, eigs, stable = fixedpoints(ds, box, J) - @test size(fp) == (2,2) + @test length(fp) == 2 + @test dimension(fp) == 2 @test stable == [false, false] @test (henon_fp ≈ fp[1]) || (henon_fp ≈ fp[2]) end