emd


Nameemd JSON
Version 0.7.0 PyPI version JSON
download
home_page
SummaryEmpirical Mode Decomposition
upload_time2024-03-14 14:13:55
maintainer
docs_urlNone
authorAndrew Quinn <a.quinn@bham.ac.uk>
requires_python>3.6
license
keywords emd spectrum frequency non-linear holospectrum hilbert-huang
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": "",
    "name": "emd",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">3.6",
    "maintainer_email": "",
    "keywords": "EMD Spectrum Frequency Non-Linear Holospectrum Hilbert-Huang",
    "author": "Andrew Quinn <a.quinn@bham.ac.uk>",
    "author_email": "a.quinn@bham.ac.uk",
    "download_url": "",
    "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": "",
    "summary": "Empirical Mode Decomposition",
    "version": "0.7.0",
    "project_urls": null,
    "split_keywords": [
        "emd",
        "spectrum",
        "frequency",
        "non-linear",
        "holospectrum",
        "hilbert-huang"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "056ca72629410a7a987d9612347a09215116df652a0c34df1a7fd358e81db9f5",
                "md5": "3a48d0590a8e5ecb504ddcce8f635def",
                "sha256": "e9c1c9fba444f51438f20e5a70f6f1ac880c2ecd7aae84bd2f5a9e7f4ad0465a"
            },
            "downloads": -1,
            "filename": "emd-0.7.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3a48d0590a8e5ecb504ddcce8f635def",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">3.6",
            "size": 85256,
            "upload_time": "2024-03-14T14:13:55",
            "upload_time_iso_8601": "2024-03-14T14:13:55.752881Z",
            "url": "https://files.pythonhosted.org/packages/05/6c/a72629410a7a987d9612347a09215116df652a0c34df1a7fd358e81db9f5/emd-0.7.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-14 14:13:55",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "emd"
}
        
Elapsed time: 0.25475s