Skip to main content

PySDKit: signal decomposition in Python

PyPI version License Python Downloads codestyle

A Python library for signal decomposition algorithms 🥳

Installation | Example Script | Target | Acknowledgements

Logo_sd

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:

  1. Import the signal decomposition method;
  2. Create an instance for signal decomposition;
  3. Use the fit_transform method to implement signal decomposition;
  4. 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)

example

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)

vmd_example

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

mvmd_example

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.

Algorithm Paper Source Example
EMD (Empirical Mode Decomposition) [paper] [code] [notebook]
EEMD (Ensemble Empirical Mode Decomposition) [paper] [code] [notebook]
REMD (Robust Empirical Mode Decomposition) [paper] [code] [notebook]
CEEMDAN (Complete Ensemble EMD with Adaptive Noise) [paper] [code] [notebook]
TVF_EMD (Time Varying Filter Based EMD) [paper] [code] [notebook]
MEMD (Multivariate Empirical Mode Decomposition) [paper] [code] [notebook]
APITMEMD (Adaptive-Projection Intrinsically Transformed MEMD) [paper] [code] [notebook]
NSTEMD (Nonuniformly Sampled Trivariate EMD) [paper] [code] [notebook]
OnlineEMD (Online Empirical Mode Decomposition) [paper] [code] [notebook]
EMD2D (Empirical Mode Decomposition 2D for images) [paper] [code] [notebook]
BMEMD (Bidimensional Multivariate Empirical Mode Decomposition) [paper] [code] [notebook]
FAEMD (Fast and Adaptive EMD) [paper] [code] [notebook]
FAEMD2D (Two-Dimensional Fast and Adaptive EMD) [paper] [code] [notebook]
FAEMD3D (Three-Dimensional Fast and Adaptive EMD) [paper] [code] [notebook]
HVD (Hilbert Vibration Decomposition) [paper] [code] [notebook]
ITD (Intrinsic Time-Scale Decomposition) [paper] [code] [notebook]
ALIF (Adaptive Local Iterative Filtering) [paper] [code] [notebook]
IMD (Impulsive Mode Decomposition) [paper] [code] [notebook]
APMD (Adaptive Polymorphic Mode Decomposition) [paper] [code] [notebook]
LMD (Local Mean Decomposition) [paper] [code] [notebook]
RLMD (Robust Local Mean Decomposition) [paper] [code] [notebook]
FMD (Feature Mode Decomposition) [paper] [code] [notebook]
SSA (Singular Spectral Analysis) [paper] [code] [notebook]
EWT (Empirical Wavelet Transform) [paper] [code] [notebook]
EFD (Empirical Fourier Decomposition) [paper] [code] [notebook]
EWT2D (2D Empirical Wavelet Transform) [paper] [code] [notebook]
VMD (Variational Mode Decomposition) [paper] [code] [notebook]
MVMD (Multivariate Variational Mode Decomposition) [paper] [code] [notebook]
VMD2D (Two-Dimensional Variational Mode Decomposition) [paper] [code] [notebook]
CVMD2D (Two-Dimensional Compact Variational Mode Decomposition) [paper] [code] [notebook]
VME (Variational Mode Extraction) [paper] [code] [notebook]
OVMD (Orthogonalized Variational Mode Decomposition) [paper] [code] [notebook]
SVMD (Successive Variational Mode Decomposition) [paper] [code] [notebook]
STVMD (Short Time Variational Mode Decomposition) [paper] [code] [notebook]
VNCMD (Variational Nonlinear Chirp Mode Decomposition) [paper] [code] [notebook]
INCMD (Iterative Nonlinear Chirp Mode Decomposition) [paper] [code] [notebook]
AVNCMD (Adaptive Variational Nonlinear Chirp Mode Decomposition) [paper] [code] [notebook]
ACMD (Adaptive Chirp Mode Decomposition) [paper] [code] [notebook]
BA-ACMD (Bandwidth-aware Adaptive Chirp Mode Decomposition) [paper] [code] [notebook]
DD-ACMD (Data-driven Adaptive Chirp Mode Decomposition) [paper] [code] [notebook]
GDMD (Generalized Dispersion Mode Decomposition) [paper] [code] [notebook]
VGNMD (Variational Generalized Nonlinear Mode Decomposition) [paper] [code] [notebook]
IVGNMD (Improved Variational Generalized Nonlinear Mode Decomposition) [paper] [code] [notebook]
AGNCMD (Adaptive Generalized Dispersive Mode Decomposition) [paper] [code] [notebook]
JMD (Jump Plus AM-FM Mode Decomposition) [paper] [code] [notebook]
MJMD (Multivariate Jump Plus AM-FM Mode Decomposition) [paper] [code] [notebook]
SJMD / SMJMD (Successive Jump and Mode Decomposition) [paper] [code] [notebook]
ESMD (Extreme-Point Symmetric Mode Decomposition) [paper] [code] [notebook]
STNBMD (Short-Time Narrow-Band Mode Decomposition) [paper] [code] [notebook]
VTFMTD (Variational TF Mode Tracking Decomposition) [paper] [code] [notebook]
SWD (Swarm Decomposition) [paper] [code] [notebook]
OSD (Optimization-based Signal Decomposition) [paper] [code] [notebook]
STL (Seasonal-Trend decomposition using LOESS) [paper] [code] [notebook]
MSTL (Multivariate Seasonal-Trend decomposition using LOESS) [paper] [code] [notebook]

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.

Download files

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

Source Distribution

pysdkit-0.4.53.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysdkit-0.4.53-py3-none-any.whl (2.3 MB view details)

Uploaded Python 3

File details

Details for the file pysdkit-0.4.53.tar.gz.

File metadata

  • Download URL: pysdkit-0.4.53.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pysdkit-0.4.53.tar.gz
Algorithm Hash digest
SHA256 64611c3cd552fc77f12d5da7fdaeb5667c941b2310ad1d72460c04a3ad26c756
MD5 8faa83997fd134776e34bc3f7e814d19
BLAKE2b-256 04bd98d8721a07959733c92933ea738e387ae4164864e5576e519b47c6fa7c8b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysdkit-0.4.53.tar.gz:

Publisher: publish.yml on wwhenxuan/PySDKit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pysdkit-0.4.53-py3-none-any.whl.

File metadata

  • Download URL: pysdkit-0.4.53-py3-none-any.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pysdkit-0.4.53-py3-none-any.whl
Algorithm Hash digest
SHA256 5686113d17b6eb948e0cc25deee91dc55049a07aa0b7011e7d4ff0cca79ef412
MD5 22e76d1cdd5dd8adf735bc850f140831
BLAKE2b-256 70e5463de6c121fb3a88f9c175c7b2eec727cc19eb59771c348edf1058d88ef0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysdkit-0.4.53-py3-none-any.whl:

Publisher: publish.yml on wwhenxuan/PySDKit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.5.0

2 files

0.4.56

2 files

0.4.55

2 files

0.4.54

2 files

This release

0.4.53 This release

2 files

0.4.52

2 files

0.4.51

2 files

0.4.50

2 files

0.4.49

2 files

0.4.48

2 files

0.4.47

2 files

0.4.46

2 files

0.4.45

2 files

0.4.44

2 files

0.4.43

2 files

0.4.42

2 files

0.4.41

2 files

0.4.40

2 files

0.4.39

2 files

0.4.38

2 files

0.4.37

2 files

0.4.36

2 files

0.4.35

2 files

0.4.34

2 files

0.4.33

2 files

0.4.32

2 files

0.4.31

2 files

0.4.30

2 files

0.4.29

2 files

0.4.28

2 files

0.4.27

2 files

0.4.26

2 files

0.4.25

2 files

0.4.24

2 files

0.4.23

2 files

0.4.22

2 files

0.4.21

2 files

0.4.20

2 files

0.4.19

2 files

0.4.18

2 files

0.4.17

2 files

0.4.16

2 files

0.4.15

2 files

0.4.14

2 files

0.4.13

2 files

0.4.12

2 files

0.4.11

2 files

0.4.10

2 files

0.4.7

2 files

0.4.6

2 files

0.4.5

2 files

0.4.4

2 files

0.4.2

2 files

0.4.1

2 files

0.4

2 files

0.3

2 files

0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page