Skip to main content

Empirical Mode Decomposition

Project description

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

import emd

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

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

imf = emd.sift.sift(x)

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

IP, IF, IA = emd.spectra.frequency_transform(imf, sample_rate, 'hilbert')

Compute Hilbert-Huang spectrum

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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emd-0.8.1.tar.gz (9.4 MB view details)

Uploaded Source

Built Distribution

emd-0.8.1-py3-none-any.whl (99.1 kB view details)

Uploaded Python 3

File details

Details for the file emd-0.8.1.tar.gz.

File metadata

  • Download URL: emd-0.8.1.tar.gz
  • Upload date:
  • Size: 9.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for emd-0.8.1.tar.gz
Algorithm Hash digest
SHA256 91c75201df0f1f338ca760496268274f2bb53cd52ea966d31865629a38a3a6a2
MD5 e4e0b53a8d02c586b5e81e61cf7bb4af
BLAKE2b-256 acb7a98e776f83c2785f54d4a988078847052f8f31c06e13c922a9ab91357cb2

See more details on using hashes here.

File details

Details for the file emd-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: emd-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 99.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for emd-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bbd8fb9e9a7c02b1d4de206409b859978577ab8c3ec2b163ce1ccc095c271b3f
MD5 c5b82ff9bef6d4d46c617237764fe76e
BLAKE2b-256 3b301ea1212487d08cd46b51b1453ebda013df14cd89d15c6485927c0fae6d25

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page