Installation 🚀
You can install PySDKit through pip:
pip install pysdkit
We only used NumPy, Scipy and matplotlib when developing the project.
Example Script ✨
This project integrates simple signal processing methods, signal decomposition and visualization, and builds a general interface similar to Scikit-learn. It is mainly divided into three steps:
- Import the signal decomposition method;
- Create an instance for signal decomposition;
- Use the
fit_transform method to implement signal decomposition;
- Visualize and analyze the original signal and the intrinsic mode functions IMFs obtained by decomposition.
import numpy as np
from pysdkit import EMD
from pysdkit.plot import plot_IMFs
t = np.linspace(0, 1, 1000)
signal = np.sin(2 * np.pi * 5 * t) + 0.7 * np.sin(2 * np.pi * 25 * t) + 0.45 * np.sin(2 * np.pi * 80 * t)
emd = EMD()
IMFs = emd.fit_transform(signal, max_imfs=3)
plot_IMFs(signal, IMFs, view="2d_freq", fs=1000, freq_max=150)

The EMD in the above example is the most classic empirical mode decomposition algorithm in signal decomposition. For more complex signals, you can try other algorithms such as variational mode decomposition (VMD).
from pysdkit import VMD
from pysdkit.data import test_vmd
from pysdkit.plot import plot_IMFs
t, signal, fs = test_vmd()
vmd = VMD(alpha=2000, K=4, tau=0.0, tol=1e-7)
IMFs = vmd.fit_transform(signal)
plot_IMFs(signal, IMFs, view="2d_freq", fs=fs, freq_max=fs / 2)

For multichannel recordings, algorithms such as multivariate VMD (MVMD) keep shared oscillations mode-aligned across channels:
import numpy as np
from pysdkit import MVMD
from pysdkit.plot import plot_IMFs
t = np.arange(0, 1, 0.001)
# ch1: 2+36 Hz, ch2: 24+36 Hz, ch3: 80+36 Hz (36 Hz shared)
signal = np.vstack([
np.cos(2*np.pi*2*t) + np.cos(2*np.pi*36*t),
np.cos(2*np.pi*24*t) + np.cos(2*np.pi*36*t),
np.cos(2*np.pi*80*t) + np.cos(2*np.pi*36*t),
])
mvmd = MVMD(alpha=2000, K=4, tau=0.0, init="uniform")
IMFs = mvmd.fit_transform(signal) # shape: (K, T, C)
plot_IMFs(signal, IMFs) # per-channel panels

Target 🎯
PySDKit is still under development. We are currently working on reproducing the signal decomposition algorithms in the table below, including not only common decomposition algorithms for univariate signals such as EMD, VMD, OVMD, AVNCMD, ALIF and APMD, but also decomposition algorithms for multivariate signals such as MEMD and MVMD. We will also further reproduce the decomposition algorithms for two-dimensional images to make PySDKit not only suitable for signal processing, but also for image analysis and understanding. See Mission for the reasons why we developed PySDKit.
Acknowledgements 🎖️
We would like to thank the researchers in signal processing for providing us with valuable algorithms and promoting the continuous progress in this field. However, since the main programming language used in signal processing is Matlab, and Python is the main battlefield of machine learning and deep learning, the usage of signal decomposition in machine learning and deep learning is far less extensive than wavelet transformation. In order to further promote the organic combination of signal decomposition and machine learning, we developed PySDKit. We would like to express our gratitude to PyEMD, Sktime, Scikit-learn, Scikit-Image, statsmodels, vmdpy, MEMD-Python-, ewtpy, EWT-Python, PyLMD, pywt, SP_Lib, dsatools and signal-decomposition.
Contributing 🤗
This project exists thanks to all the people who contribute. Please read
CONTRIBUTING.md for how to add an algorithm, tests, and
gallery examples (the same guide is in the
documentation).
评论