JuliaDynamics/ComplexityMeasures.jl

Improve `PowerSpectrum` estimator: add threhsold

Offen

#104 geöffnet am 27.09.2022

 (7 Kommentare) (1 Reaktion) (0 zugewiesene Personen)Julia (19 Forks)auto 404
good first issueimprovement

Repository-Metriken

Stars
 (79 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

The power spectrum estimator will yield rather uncoverged results for small timeseries of regular signals, due to the noise induced by the FOurier transform affecting the signal a lot. We should add a threshold that reduces to 0 all spectral power less than this threshold. This would make the results much more reasonable for signals, and better for normalized. Here is the example code I have:

using DynamicalSystems
N1, N2, a = 101, 100001, 10

for N in (N1, N2)
    t = LinRange(0, 2*a*π, N)
    x = sin.(t) # periodic
    y = sin.(t .+ cos.(t/0.5)) # periodic, complex spectrum
    z = sin.(rand(1:15, N) ./ rand(1:10, N)) # random
    w = trajectory(Systems.lorenz(), N÷10; Δt = 0.1, Ttr = 100)[:, 1] # chaotic

    for q in (x, y, z, w)
        h = entropy(q, PowerSpectrum())
        n = entropy_normalized(q, PowerSpectrum())
        println("entropy: $(h), normalized: $(n).")
    end
end

Contributor Guide