emd-signal

Python implementation of Empirical Mode Decompoisition (EMD) method

https://github.com/laszukdawid/pyemd

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.4%) to scientific vocabulary

Keywords

decomposition signal-processing time-series
Last synced: 6 months ago · JSON representation ·

Repository

Python implementation of Empirical Mode Decompoisition (EMD) method

Basic Info
  • Host: GitHub
  • Owner: laszukdawid
  • License: apache-2.0
  • Language: Python
  • Default Branch: master
  • Homepage: https://pyemd.readthedocs.io/
  • Size: 1.63 MB
Statistics
  • Stars: 911
  • Watchers: 22
  • Forks: 230
  • Open Issues: 1
  • Releases: 2
Topics
decomposition signal-processing time-series
Created over 9 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License Citation

README.md

codecov DocStatus Codacy Badge DOI Conda

PyEMD

Links

Introduction

Python implementation of the Empirical Mode Decomposition (EMD). The package contains multiple EMD variations and intends to deliver more in time.

EMD variations

  • Ensemble EMD (EEMD),
  • "Complete Ensemble EMD" (CEEMDAN)
  • different settings and configurations of vanilla EMD.
  • Image decomposition (EMD2D & BEMD) (experimental, no support)
  • Just-in-time compiled EMD (JitEMD)

PyEMD allows you to use different splines for envelopes, stopping criteria and extrema interpolations.

Available splines

  • Natural cubic (default)
  • Pointwise cubic
  • Hermite cubic
  • Akima
  • PChip
  • Linear

Available stopping criteria

  • Cauchy convergence (default)
  • Fixed number of iterations
  • Number of consecutive proto-imfs

Extrema detection

  • Discrete extrema (default)
  • Parabolic interpolation

Installation

Note: Downloadable package is called emd-signal.

PyPi (recommended)

The quickest way to install package is through pip.

sh pip install EMD-signal

or with uv you can do

```sh uv add emd-signal

or

uv pip install EMD-signal

```

In this way you install the latest stable release of PyEMD hosted on PyPi.

Conda

PyEMD (as emd-signal) is available for Conda via conda-forge channel

sh conda install -c conda-forge emd-signal

Source: https://anaconda.org/conda-forge/emd-signal

From source

In case, if you only want to use EMD and its variations, the best way to install PyEMD is through pip. However, if you want the latest version of PyEMD, anyhow you might want to download the code and build package yourself. The source is publicaly available and hosted on GitHub. To download the code you can either go to the source code page and click Code -> Download ZIP, or use git command line

sh git clone https://github.com/laszukdawid/PyEMD

Installing package from source is done using command line:

sh python3 -m pip install .

after entering the PyEM directory created by git.

A quicker way to install PyEMD from source is done using pip and git in the same command:

sh python3 -m pip install git+https://github.com/laszukdawid/PyEMD.git

Note, however, that this will install it in your current environment. If you are working on many projects, or sharing reources with others, we suggest using virtual environments. If you want to make your installation editable use the -e flag for pip

Example

More detailed examples are included in the documentation or in the PyEMD/examples.

EMD

In most cases default settings are enough. Simply import EMD and pass your signal to instance or to emd() method.

```python from PyEMD import EMD import numpy as np

s = np.random.random(100) emd = EMD() IMFs = emd(s) ```

The Figure below was produced with input: $S(t) = cos(22 \pi t^2) + 6t^2$

simpleExample

EEMD

Simplest case of using Ensemble EMD (EEMD) is by importing EEMD and passing your signal to the instance or eemd() method.

Windows: Please don't skip the if __name__ == "__main__" section.

```python from PyEMD import EEMD import numpy as np

if name == "main": s = np.random.random(100) eemd = EEMD() eIMFs = eemd(s) ```

CEEMDAN

As with previous methods, also there is a simple way to use CEEMDAN.

Windows: Please don't skip the if __name__ == "__main__" section.

```python from PyEMD import CEEMDAN import numpy as np

if name == "main": s = np.random.random(100) ceemdan = CEEMDAN() cIMFs = ceemdan(s) ```

Visualisation

The package contains a simple visualisation helper that can help, e.g., with time series and instantaneous frequencies.

```python import numpy as np from PyEMD import EMD, Visualisation

t = np.arange(0, 3, 0.01) S = np.sin(13t + 0.2t*1.4) - np.cos(3t)

Extract imfs and residue

In case of EMD

emd = EMD() emd.emd(S) imfs, res = emd.getimfsand_residue()

In general:

components = EEMD()(S)

imfs, res = components[:-1], components[-1]

vis = Visualisation() vis.plotimfs(imfs=imfs, residue=res, t=t, includeresidue=True) vis.plotinstantfreq(t, imfs=imfs) vis.show() ```

Experimental

JitEMD

Just-in-time (JIT) compiled EMD is a version of EMD which exceed on very large signals or reusing the same instance multiple times. It's strongly sugested to be used in Jupyter notebooks when experimenting by modifyig input rather than the method itself.

The problem with JIT is that the compilation happens on the first execution and it can be quite costly. With small signals, or performing decomposition just once, the extra time for compilation will be significantly larger than the decomposition, making it less performant.

Please see documentation for more information or examples for how to use the code. This is experimental as it's value is still questionable, and the author (me) isn't proficient in JIT optimization so mistakes could've been made.

Any feedback is welcomed. Happy to improve if there's intrest. Please open tickets with questions and suggestions.

To enable JIT in your PyEMD, please install with jit option, i.e.

sh pip install EMD-signal[jit]

EMD2D/BEMD

Unfortunately, this is Experimental and we can't guarantee that the output is meaningful. The simplest use is to pass image as monochromatic numpy 2D array. Sample as with the other modules one can use the default setting of an instance or, more explicitly, use the emd2d() method.

```python from PyEMD.EMD2d import EMD2D #, BEMD import numpy as np

x, y = np.arange(128), np.arange(128).reshape((-1,1)) img = np.sin(0.1x)np.cos(0.2*y) emd2d = EMD2D() # BEMD() also works IMFs_2D = emd2d(img) ```

F.A.Q

Why is EEMD/CEEMDAN so slow?

Unfortunately, that's their nature. They execute EMD multiple times every time with slightly modified version. Added noise can cause a creation of many extrema which will decrease performance of the natural cubic spline. For some tweaks on how to deal with that please see Speedup tricks in the documentation.

Contact

Feel free to contact me with any questions, requests or simply to say hi. It's always nice to know that I've helped someone or made their work easier. Contributing to the project is also acceptable and warmly welcomed.

Citation

If you found this package useful and would like to cite it in your work please use the following structure:

latex @misc{pyemd, author = {Laszuk, Dawid}, title = {Python implementation of Empirical Mode Decomposition algorithm}, year = {2017}, publisher = {GitHub}, journal = {GitHub Repository}, howpublished = {\url{https://github.com/laszukdawid/PyEMD}}, doi = {10.5281/zenodo.5459184} }

Owner

  • Name: Dawid Laszuk
  • Login: laszukdawid
  • Kind: user
  • Location: BC, Canada

Now SDE/MLE, ex-academic. Data processing orientation.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Laszuk"
  given-names: "Dawid"
  orcid: "https://orcid.org/0000-0001-6811-3253"
title: "Python implementation of Empirical Mode Decomposition algorithm"
version: 1.0.1
date-released: 2017-01-01
doi: 10.5281/zenodo.5459184
url: "https://github.com/laszukdawid/PyEMD"

GitHub Events

Total
  • Issues event: 10
  • Watch event: 67
  • Issue comment event: 11
  • Push event: 1
  • Fork event: 10
Last Year
  • Issues event: 10
  • Watch event: 67
  • Issue comment event: 11
  • Push event: 1
  • Fork event: 10

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 195
  • Total Committers: 10
  • Avg Commits per committer: 19.5
  • Development Distribution Score (DDS): 0.149
Past Year
  • Commits: 9
  • Committers: 4
  • Avg Commits per committer: 2.25
  • Development Distribution Score (DDS): 0.556
Top Committers
Name Email Commits
Dawid Laszuk l****d@g****m 166
Laszuk l****k@a****m 9
Dawid Laszuk 1****d 8
Dawid g****t@d****k 4
Renato F. Miotto 3****o 2
Arnab Paul Choudhury 3****4 2
Jacopo Fadanni 1****i 1
nescirem n****m@o****m 1
Yuriy Gabuev y****v@g****m 1
Debasis Tripathy 1****1 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 102
  • Total pull requests: 25
  • Average time to close issues: 4 months
  • Average time to close pull requests: 14 days
  • Total issue authors: 89
  • Total pull request authors: 9
  • Average comments per issue: 2.8
  • Average comments per pull request: 0.96
  • Merged pull requests: 20
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 0
  • Average time to close issues: about 2 months
  • Average time to close pull requests: N/A
  • Issue authors: 4
  • Pull request authors: 0
  • Average comments per issue: 1.75
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • laszukdawid (4)
  • JhonAndersonVelasco (3)
  • wunderbarr (3)
  • kimyoungjin06 (3)
  • ki-ljl (2)
  • oshin94 (2)
  • shenjianaixuexi (2)
  • SChandel-cmd (2)
  • LeonardoLancia (2)
  • rfmiotto (1)
  • alexsomoza (1)
  • zeydabadi (1)
  • rsprmo (1)
  • ljqq1022 (1)
  • ewoodsusmc (1)
Pull Request Authors
  • laszukdawid (16)
  • JFadanni (3)
  • rfmiotto (3)
  • Giddy-eg (2)
  • oshin94 (2)
  • kritchie (1)
  • codacy-badger (1)
  • debasistripathy01 (1)
  • ygabuev (1)
Top Labels
Issue Labels
enhancement (2) feature (1) invalid (1) bug (1) question (1)
Pull Request Labels
enhancement (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 20,764 last-month
  • Total dependent packages: 3
  • Total dependent repositories: 6
  • Total versions: 33
  • Total maintainers: 1
pypi.org: emd-signal

Implementation of the Empirical Mode Decomposition (EMD) and its variations

  • Versions: 33
  • Dependent Packages: 3
  • Dependent Repositories: 6
  • Downloads: 20,764 Last month
Rankings
Stargazers count: 2.3%
Downloads: 2.5%
Dependent packages count: 3.2%
Average: 3.5%
Forks count: 3.6%
Dependent repos count: 6.0%
Maintainers (1)
Last synced: 6 months ago

Dependencies

requirements-extra.txt pypi
  • matplotlib *
  • numpy >=1.12
  • numpydoc >=1.1.0
  • pathos >=0.2.1
  • scikit-image >=0.13
  • scipy >=0.19
requirements.txt pypi
  • numpy >=1.12
  • pathos >=0.2.1
  • scipy >=0.19
.github/workflows/ci-lint.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/ci-test.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/python-publish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite