question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EMD's max_imf doesn't return the expected number of IMFs

See original GitHub issue

Describe the bug From the documentation, the ``EMD.emd()method is supposed to returnmax_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:closed
  • Created 10 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
laszukdawidcommented, Dec 4, 2022

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 use emd.get_imfs_and_residue method which returns tuple of (imfs, residue).

Hope this helps, Dawid

0reactions
laszukdawidcommented, Dec 15, 2022

Added info with commit 7ebc39eb449b234e401d006266430a62de2db0c5

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found