Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements on the pkg #14

Open
henry2004y opened this issue Apr 30, 2021 · 5 comments
Open

Improvements on the pkg #14

henry2004y opened this issue Apr 30, 2021 · 5 comments

Comments

@henry2004y
Copy link
Contributor

henry2004y commented Apr 30, 2021

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.

@felixcremer
Copy link
Owner

felixcremer commented Apr 30, 2021

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:

Thank you for your interest.
I am going to split a few of your questions into their own issues, so that we can then further discuss these.
I will leave this open, for general discussions.

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.

The stopping criteria is implemented here. I think, it wouldn't be too hard to expose this, so that you could experiment with different stopping criteria see #19.

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](https://docs.julialang.org/en/v1/NEWS/), and that may be helpful here.

I think, it would be better to relay only on an interpolation implementation in pure Julia. I used Dierckx because Interpolations.jl didn't have an implementation of cubic splines on irregular grids, we could check, whether this is now implemented or have a look into DataInterpolations.jl

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

It should be possible to expose the used interpolation function to the user and I am not sure, whether we would have to do the streamlining of the different functions ourselves, or whether we can relay on the interface of an external interpolation package.
See #20

  1. 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.

Yes we can switch to this package, when the performance is better.
For the performance comparison it is important to take into account, that localmaxmin!is operating inplace and since we use this a lot of times in the inner loops, it would be best to test this on an actual emd decomposition.

  1. maketestdata in testdata.jl and runtests.jl are almost identical, which may be merged together?

Yes they should be merged. I am going to have a look and most likely I am going to delete the functions in runtests, because I like to expose this, because some of these functions are also used in the literature and it makes it easier to do a quick sanity check. We can also reuse them in the documentation.

  1. I would also like to improve on the documentations.

Yes please. Don't hesitate to ask any questions.
see #8.

  1. 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?

Unfortunately there is no collaboration happening at the moment. I asked for it, but it didn't happen in the end.
I would like to register this as well and I am currently thinking about broadening the scope of the package a bit and to also implement the Hilbert-Huang transform and functions to compute the instantaneous frequency and instantaneous amplitude.
See #11

I may soon submit some PRs.

Feel free to do so.

@henry2004y
Copy link
Contributor Author

It turns out that the current localmaxmin! performs ~3 times faster than Peaks.jl. No need to switch then

@henry2004y
Copy link
Contributor Author

I happened to learn that MATLAB has this emd implementation, and it's well documented.

@henry2004y
Copy link
Contributor Author

henry2004y commented Apr 30, 2021

The way you utilize iterators is completely new to me and also intriguing! What is your thoughts behind this paradigm instead of a more regular while-loop, continue, break style for implementing the sifting algorithm?

@felixcremer
Copy link
Owner

The way you utilize iterators is completely new to me and also intriguing! What is your thoughts behind this paradigm instead of a more regular while-loop, continue, break style for implementing the sifting algorithm?

This is based on this blog post https://lostella.github.io/2018/07/25/iterative-methods-done-right.html
I also found it intriguing and wanted to try it and the EMD methods seem to be a perfect example of something where we can experiment with such a setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants