GithubHelp home page GithubHelp logo

empiricalmodedecomposition.jl's People

Contributors

felixcremer avatar henry2004y avatar markuszehner avatar meggart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

empiricalmodedecomposition.jl's Issues

emd and eemd num_imf do not behave as expected

emd:
always calculates 7 imfs, returns the first to num_imf. If num_imf is larger than 7, zero filled elements are added.

eemd:
always calculates 7 imfs, returns the first to num_imf but does not return more than 7 elements.

emd return type

It is not so nice to see the emd function returning types of e.g. 2-element Vector{Any}. I propose to modify it like:

function emd(measurements::Vector{T}, xvec, num_imfs=6) where T<:AbstractFloat
    collect(Vector{T}, take(EMDIterable(measurements, xvec), num_imfs))
end

such that it will then return concrete types like 2-element Vector{Vector{Float64}}.

A PR for this is coming up.

Change to explicit imports

It is not good to use using in Packages.
Therefore I should check which functions I am using from the different packages and import them directly.

Expose Stopping criteria for sift function

There are different stopping criteria in use and it would be good to allow the user to set the stopping criteria as a function.
It might be enough to add the stof function as a keyword argument in the sift function.

One example for another stopping criteria as mentioned in #14

1. What is the stopping criterion for sifting implemented and where can I find it? For my current need I would like to use the [threshold criteria](http://perso.ens-lyon.fr/patrick.flandrin/NSIP03.pdf), which may be a nice addition to the package.

Documentation out of date?

I'm trying to use the functions listed in the documentation, with no luck

julia> ceemd(h, t; num_imfs=3)
ERROR: UndefVarError: ceemd not defined
Stacktrace:

Improvements on the pkg

Greetings,

I am looking for some functionalities in Julia for doing EMD, and this package seems to fit my needs. I want to ask a few questions before proceeding:

  1. What is the stopping criterion for sifting implemented and where can I find it? For my current need I would like to use the threshold criteria, which may be a nice addition to the package.
  2. I see that you use both Interpolations.jl and Dierckx.jl for interpolations, and you also define a new interpolate method which a wrapper over Dierckx's Spline1D. To avoid confusion, there are these package names in front of each calls, which may seem redundant. Starting from Julia 1.6, we are able to rename imported pkgs and methods, and that may be helpful here.
    From the interpolation method,
function interpolate(knotxvals::Vector, knotyvals::Vector, predictxvals::AbstractVector, m::DierckXInterp, k=3)
    spl = Dierckx.Spline1D(knotxvals, knotyvals, k=k)
    #@show spl, predictxvals
    Dierckx.evaluate(spl,predictxvals)
end

the input argument m is not used. Is it possible to support other kinds of interpolation method beside spline?
3. For the extrema finding, there is a nice package called Peaks.jl. I will try to test if it performs better than localmaxmin! or not.
4. maketestdata in testdata.jl and runtests.jl are almost identical, which may be merged together?
5. I would also like to improve on the documentations.
6. I saw another registered pkg with the same name, but less maintained. Is there a collaboration happening? Do you expect to register this one as well?

I may soon submit some PRs.

eemd question

using Plots, EmpiricalModeDecomposition
gr()

## simulate data of length....
N_tim = 240
NpY   = 24         # samples/year
t     = 1:N_tim
t     = t./NpY # your time vector

# constant seasonal cycle 
A   = 2          # amplitude
phi = 13*pi/12   # initial phase
S   = A*cos.(2*pi*t+phi)

# some other oscillation
a = 0.2 
b = 0.1
C = (1+a*cos.(b*2*pi*t))

# some noise
E = randn(N_tim).*0.1

X = S.*C + E

# works
X_dec = emd(X, t)

# does not work
X_dec = eemd(X, t)

ismonotonic only works for Float

The current implementation of monotonic checking

ismonotonic(x::AbstractVector{T}) where T = isfinite(foldl((x,y)->y>=x ? y : typemax(T), x, init=typemin(T))) || isfinite(foldl((x,y)->y<=x ? y : typemin(T), x, init=typemax(T)))

does not work for numeric types other than Float, because typemax(Int) is not Inf. A quick fix would be

ismonotonic(x::AbstractVector{T}) where T<:AbstractFloat

However, I would like to propose an alternative approach:

ismonotonic2(x::AbstractVector) = issorted(x) || issorted(x, rev=true)

Tests:

using Test, BenchmarkTools

ismonotonic(x::AbstractVector{T}) where T<:AbstractFloat =
   isfinite(foldl((x,y)->y>=x ? y : typemax(T), x, init=typemin(T))) ||
   isfinite(foldl((x,y)->y<=x ? y : typemin(T), x, init=typemax(T)))

ismonotonic2(x::AbstractVector) = issorted(x) || issorted(x, rev=true)

x = collect(1.:8.)
x[5] = -1.

@test ismonotonic(x) == ismonotonic2(x)

#@btime ismonotonic($x)
#@btime ismonotonic2($x)

x = collect(10000:-1.:1)
x[100] = -1

@test ismonotonic(x) == ismonotonic2(x)

@btime ismonotonic($x)
@btime ismonotonic2($x)

x = collect(1:1.:10000)
x[9900] = -1

@test ismonotonic(x) == ismonotonic2(x)

@btime ismonotonic($x)
@btime ismonotonic2($x)

which are ~2-100 times faster, depending on where the monotonicity condition is violated for the first time.

35.078 μs (0 allocations: 0 bytes)
324.025 ns (0 allocations: 0 bytes)
35.079 μs (0 allocations: 0 bytes)
22.458 μs (0 allocations: 0 bytes)

CEEMD looks strange after the fifth imf

At the moment I suspect, this is due to the oversifting of the white noise.
I should have a look into the paper of the libeemd implementation, to see how the handled that.

Expose interpolation methods

From #14:

From the interpolation method,

function interpolate(knotxvals::Vector, knotyvals::Vector, predictxvals::AbstractVector, m::DierckXInterp, k=3)
    spl = Dierckx.Spline1D(knotxvals, knotyvals, k=k)
    #@show spl, predictxvals
    Dierckx.evaluate(spl,predictxvals)
end

the input argument m is not used. Is it possible to support other kinds of interpolation method beside spline?

Set up struct to handle the metadata of the EMDDecomp

To see whether this is a good idea I can have a look into the implementation of Interpolations.
The most important counter argument is the speed for the use of EMD on cubes. There we don't need the metadata on every pixel, but rather on the whole cube.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.