emd


Nameemd JSON
Version 0.8.0 PyPI version JSON
download
home_pageNone
SummaryEmpirical Mode Decomposition
upload_time2025-01-09 16:23:17
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords emd frequency hilbert-huang holospectrum non-linear spectrum
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            A python package for Empirical Mode Decomposition and related spectral analyses.

Please note that this project is in active development for the moment - the API may change relatively quickly between releases!

# Installation

You can install the latest stable release from the PyPI repository

```
pip install emd
```

or clone and install the source code.

```
git clone https://gitlab.com/emd-dev/emd.git
cd emd
pip install .
```

Requirements are specified in requirements.txt. Main functionality only depends
on numpy and scipy for computation and matplotlib for visualisation.

# Quick Start

Full documentation can be found at https://emd.readthedocs.org and development/issue tracking at gitlab.com/emd-dev/emd

Import emd

```python
import emd
```

Define a simulated waveform containing a non-linear wave at 5Hz and a sinusoid at 1Hz.

```python
sample_rate = 1000
seconds = 10
num_samples = sample_rate*seconds

import numpy as np
time_vect = np.linspace(0, seconds, num_samples)

freq = 5
nonlinearity_deg = .25  # change extent of deformation from sinusoidal shape [-1 to 1]
nonlinearity_phi = -np.pi/4  # change left-right skew of deformation [-pi to pi]
x = emd.simulate.abreu2010(freq, nonlinearity_deg, nonlinearity_phi, sample_rate, seconds)
x += np.cos(2*np.pi*1*time_vect)
```

Estimate IMFs

```python
imf = emd.sift.sift(x)
```

Compute instantaneous frequency, phase and amplitude using the Normalised Hilbert Transform Method.

```python
IP, IF, IA = emd.spectra.frequency_transform(imf, sample_rate, 'hilbert')
```
Compute Hilbert-Huang spectrum

```python
freq_range = (0, 10, 100)  # 0 to 10Hz in 100 steps
f, hht = emd.spectra.hilberthuang(IF, IA, freq_range, sum_time=False)
```
```
Make a summary plot

```python
import matplotlib.pyplot as plt
plt.figure(figsize=(16, 8))
plt.subplot(211, frameon=False)
plt.plot(time_vect, x, 'k')
plt.plot(time_vect, imf[:, 0]-4, 'r')
plt.plot(time_vect, imf[:, 1]-8, 'g')
plt.plot(time_vect, imf[:, 2]-12, 'b')
plt.xlim(time_vect[0], time_vect[-1])
plt.grid(True)
plt.subplot(212)
plt.pcolormesh(time_vect, f, hht, cmap='ocean_r')
plt.ylabel('Frequency (Hz)')
plt.xlabel('Time (secs)')
plt.grid(True)
plt.show()
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "emd",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "EMD, Frequency, Hilbert-Huang, Holospectrum, Non-Linear, Spectrum",
    "author": null,
    "author_email": "Andrew Quinn <a.quinn@bham.ac.uk>",
    "download_url": "https://files.pythonhosted.org/packages/22/df/ca91e02e1e5126a99ed15c8912f021fdcb426c8da9720244374e32e92258/emd-0.8.0.tar.gz",
    "platform": null,
    "description": "A python package for Empirical Mode Decomposition and related spectral analyses.\n\nPlease note that this project is in active development for the moment - the API may change relatively quickly between releases!\n\n# Installation\n\nYou can install the latest stable release from the PyPI repository\n\n```\npip install emd\n```\n\nor clone and install the source code.\n\n```\ngit clone https://gitlab.com/emd-dev/emd.git\ncd emd\npip install .\n```\n\nRequirements are specified in requirements.txt. Main functionality only depends\non numpy and scipy for computation and matplotlib for visualisation.\n\n# Quick Start\n\nFull documentation can be found at https://emd.readthedocs.org and development/issue tracking at gitlab.com/emd-dev/emd\n\nImport emd\n\n```python\nimport emd\n```\n\nDefine a simulated waveform containing a non-linear wave at 5Hz and a sinusoid at 1Hz.\n\n```python\nsample_rate = 1000\nseconds = 10\nnum_samples = sample_rate*seconds\n\nimport numpy as np\ntime_vect = np.linspace(0, seconds, num_samples)\n\nfreq = 5\nnonlinearity_deg = .25  # change extent of deformation from sinusoidal shape [-1 to 1]\nnonlinearity_phi = -np.pi/4  # change left-right skew of deformation [-pi to pi]\nx = emd.simulate.abreu2010(freq, nonlinearity_deg, nonlinearity_phi, sample_rate, seconds)\nx += np.cos(2*np.pi*1*time_vect)\n```\n\nEstimate IMFs\n\n```python\nimf = emd.sift.sift(x)\n```\n\nCompute instantaneous frequency, phase and amplitude using the Normalised Hilbert Transform Method.\n\n```python\nIP, IF, IA = emd.spectra.frequency_transform(imf, sample_rate, 'hilbert')\n```\nCompute Hilbert-Huang spectrum\n\n```python\nfreq_range = (0, 10, 100)  # 0 to 10Hz in 100 steps\nf, hht = emd.spectra.hilberthuang(IF, IA, freq_range, sum_time=False)\n```\n```\nMake a summary plot\n\n```python\nimport matplotlib.pyplot as plt\nplt.figure(figsize=(16, 8))\nplt.subplot(211, frameon=False)\nplt.plot(time_vect, x, 'k')\nplt.plot(time_vect, imf[:, 0]-4, 'r')\nplt.plot(time_vect, imf[:, 1]-8, 'g')\nplt.plot(time_vect, imf[:, 2]-12, 'b')\nplt.xlim(time_vect[0], time_vect[-1])\nplt.grid(True)\nplt.subplot(212)\nplt.pcolormesh(time_vect, f, hht, cmap='ocean_r')\nplt.ylabel('Frequency (Hz)')\nplt.xlabel('Time (secs)')\nplt.grid(True)\nplt.show()\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Empirical Mode Decomposition",
    "version": "0.8.0",
    "project_urls": {
        "Documentation": "https://emd.readthedocs.io/",
        "Issue Tracker": "https://gitlab.com/emd-dev/emd/-/issues",
        "Source": "https://gitlab.com/emd-dev/emd"
    },
    "split_keywords": [
        "emd",
        " frequency",
        " hilbert-huang",
        " holospectrum",
        " non-linear",
        " spectrum"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9ba9c5794bf4d05d68bd066719351c61cdbd5e600feb248cacfe41b38ab298bb",
                "md5": "a03c38293d9f82011c8ba8ce61b88c76",
                "sha256": "0e7c6d7784f6d22e1b5271959d5b636c344ad9b777437cfc4531b2bf2e860a66"
            },
            "downloads": -1,
            "filename": "emd-0.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a03c38293d9f82011c8ba8ce61b88c76",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 99106,
            "upload_time": "2025-01-09T16:23:15",
            "upload_time_iso_8601": "2025-01-09T16:23:15.370088Z",
            "url": "https://files.pythonhosted.org/packages/9b/a9/c5794bf4d05d68bd066719351c61cdbd5e600feb248cacfe41b38ab298bb/emd-0.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "22dfca91e02e1e5126a99ed15c8912f021fdcb426c8da9720244374e32e92258",
                "md5": "56b169f7b64517f11c9cd84bbb10dae3",
                "sha256": "bd5e5fe6bf3bd11fb7d2429bd3671b74804d715d76f64e9d451e40125b5dd6b6"
            },
            "downloads": -1,
            "filename": "emd-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "56b169f7b64517f11c9cd84bbb10dae3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 9285126,
            "upload_time": "2025-01-09T16:23:17",
            "upload_time_iso_8601": "2025-01-09T16:23:17.769887Z",
            "url": "https://files.pythonhosted.org/packages/22/df/ca91e02e1e5126a99ed15c8912f021fdcb426c8da9720244374e32e92258/emd-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-09 16:23:17",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "emd-dev",
    "gitlab_project": "emd",
    "lcname": "emd"
}
        
Elapsed time: 0.46220s