EMD's max_imf doesn't return the expected number of IMFs
See original GitHub issueDescribe the bug
From the documentation, the ``EMD.emd()method is supposed to return
max_imf` number of IMFs
The decomposition is limited to *max_imf* imfs.
However, it returns that number + 1.
To Reproduce
from PyEMD import EMD
import numpy as np
s = np.random.random(100)
emd = EMD()
IMFs = emd(s, max_imf=3)
assert len(IMFs) == 3
Expected behavior Either return the appropriate number of IMFs or adjust the documentation.
Issue Analytics
- State:
- Created 10 months ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
hht/empirical_mode_decomposition.R at master - GitHub
RULE as quoted from the EMD package: "stopping rule of sifting. ... MAX.IMF - How many IMFs are allowed, IMFs above this number...
Read more >MATLAB emd - Empirical mode decomposition - MathWorks
This MATLAB function returns intrinsic mode functions imf and residual signal residual corresponding to the empirical mode decomposition of x.
Read more >hht: The Hilbert-Huang Transform: Tools and Methods
Description Builds on the EMD package to provide additional tools for empirical mode ... Number of IMFs to record, IMFs past this number...
Read more >EMD — PyEMD 0.2.13 documentation
Performs Empirical Mode Decomposition on signal S. The decomposition is limited to max_imf imfs. Returns IMF functions and residue in a single numpy...
Read more >Introduction to the Empirical Mode Decomposition Method
MaxIMF is the maximum permissible number of IMFs. Decomposition of the input sequence into separate IMFs will stop, when the number of IMF's...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @kritchie, I think the confusion is from distinguishing what is an IMF (Intrinsic Mode Function). I had a long chat initially with folks who were using this package (and also for own research). The conclusion was to extract IMFs and then any remaining is added as the residue. In such a case, if you set
max_imf=3
you’ll get at least 3 signals and sometimes 4 - the last being residue. If you prefer, you can also useemd.get_imfs_and_residue
method which returns tuple of (imfs, residue).Hope this helps, Dawid
Added info with commit 7ebc39eb449b234e401d006266430a62de2db0c5