Giter Site home page Giter Site logo

vrcarva / vmdpy Goto Github PK

View Code? Open in Web Editor NEW
316.0 7.0 59.0 18 KB

Variational mode decomposition (VMD) in Python

License: MIT License

Python 100.00%
eeg-signals-processing vmd python signal-processing signal-analysis seizure-detection epilepsy-monitoring

vmdpy's Introduction

NOTE: vmdpy is officially distributed with, and maintained in, sktime, since August 2023.

Please ask questions or open issues or PR on the sktime repository.

vmdpy: Variational mode decomposition in Python

Function for decomposing a signal according to the Variational Mode Decomposition (Dragomiretskiy and Zosso, 2014) method.

This package is a Python translation of the original VMD MATLAB toolbox

Installation

vmdpy is distributed with sktime.

Install sktime via pip or conda, i.e.,

pip install sktime

or

conda install sktime

For further details, see the sktime installation guide

Citation and Contact

Paper available at: https://doi.org/10.1016/j.bspc.2020.102073

If you find this package useful, we kindly ask you to cite it in your work: Vinícius R. Carvalho, Márcio F.D. Moraes, Antônio P. Braga, Eduardo M.A.M. Mendes, Evaluating five different adaptive decomposition methods for EEG signal seizure detection and classification, Biomedical Signal Processing and Control, Volume 62, 2020, 102073, ISSN 1746-8094, https://doi.org/10.1016/j.bspc.2020.102073.

For contributing new functionality or fixing anything in the package, kindly make a PR to the sktime repository (libs.vmdpy module).

For suggestions, questions, comments:

Example script

#%% Simple example: generate signal with 3 components + noise
import numpy as np
import matplotlib.pyplot as plt
from sktime.libs.vmdpy import VMD

# Time Domain 0 to T
T = 1000
fs = 1 / T
t = np.arange(1, T + 1) / T
freqs = 2 * np.pi * (t - 0.5 - fs) / (fs)

# center frequencies of components
f_1 = 2
f_2 = 24
f_3 = 288

# modes
v_1 = np.cos(2 * np.pi * f_1 * t)
v_2 = 1 / 4 * (np.cos(2 * np.pi * f_2 * t))
v_3 = 1 / 16 * (np.cos(2 * np.pi * f_3 * t))

f = v_1 + v_2 + v_3 + 0.1 * np.random.randn(v_1.size)

# some sample parameters for VMD
alpha = 2000  # moderate bandwidth constraint
tau = 0.0  # noise-tolerance (no strict fidelity enforcement)
K = 3  # 3 modes
DC = 0  # no DC part imposed
init = 1  # initialize omegas uniformly
tol = 1e-7

# Run VMD
u, u_hat, omega = VMD(f, alpha, tau, K, DC, init, tol)

# Visualize decomposed modes
plt.figure()
plt.subplot(2, 1, 1)
plt.plot(f)
plt.title("Original signal")
plt.xlabel("time (s)")
plt.subplot(2, 1, 2)
plt.plot(u.T)
plt.title("Decomposed modes")
plt.xlabel("time (s)")
plt.legend(["Mode %d" % m_i for m_i in range(u.shape[0])])
plt.tight_layout()

vmdpy's People

Contributors

fkiraly avatar vrcarva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

vmdpy's Issues

transferring issues to `sktime`

Given that vmdpy is now maintained in sktime (official fork/continuation), we should transfer any open issues to the sktime issue tracker and handle them there.

Continuing the discussion from #19 (comment) here, since I'm apprehensive of messages on closed PRs not causing a notification.

@vrcarva, for the transfer: How about June 14, 14 UTC, or June 17, anytime 11-12, or 14?
It is maybe easier to send direct messages on the sktime discord: https://discord.com/invite/54ACzaFsn7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.