# PySDKit: signal decomposition in Python
[![PyPI version](https://badge.fury.io/py/PySDKit.svg)](https://pypi.org/project/PySDKit/) ![License](https://img.shields.io/github/license/wwhenxuan/PySDKit) [![codecov](https://codecov.io/gh/wwhenxuan/PySDKit/branch/main/graph/badge.svg?token=YOUR_TOKEN)](https://codecov.io/gh/wwhenxuan/PySDKit) [![arXiv](https://img.shields.io/badge/arXiv-1234.56789-brightgreen.svg)](https://arxiv.org/abs/1234.56789) [![Downloads](https://pepy.tech/badge/pysdkit)](https://pepy.tech/project/pysdkit) ![Static Badge](https://img.shields.io/badge/https%3A%2F%2Fimg.shields.io%2Fbadge%2Fjust%2520the%2520message--8A2BE2?logo=appveyor&logoColor=royalblue&label=NumPy&link=https%3A%2F%2Fnumpy.org%2Fdoc%2Fstable%2F) ![Static Badge](https://img.shields.io/badge/https%3A%2F%2Fimg.shields.io%2Fbadge%2Fjust%2520the%2520message--8A2BE2?logo=appveyor&logoColor=violet&label=SciPy&link=https%3A%2F%2Fdocs.scipy.org%2Fdoc%2Fscipy%2F)
A Python library for signal decomposition algorithms
![Logo](https://raw.githubusercontent.com/wwhenxuan/PySDKit/main/images/Logo_sd.png)
## Installation
You can install `PySDKit` through pip.
~~~
pip install pysdkit
~~~
We only used [`NumPy`](https://numpy.org/), [`Scipy`](https://scipy.org/) and [`matplotlib`](https://matplotlib.org/) 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`](https://scikit-learn.org/stable/). 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.
~~~python
from pysdkit import EMD
from pysdkit.data import test_emd
from pysdkit.plot import plot_IMFs
t, signal = test_emd()
# create an instance for signal decomposition
emd = EMD()
# implement signal decomposition
IMFs = emd.fit_transform(signal, max_imf=2)
plot_IMFs(signal, IMFs)
~~~
![example](https://raw.githubusercontent.com/wwhenxuan/PySDKit/main/images/example.jpg)
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`](https://ieeexplore.ieee.org/abstract/document/6655981)).
~~~python
from pysdkit import VMD
# load new signal
signal = np.load("example.npy")
# use variational mode decomposition
vmd = VMD(alpha=500, K=3, tau=0.0, tol=1e-9)
IMFs = vmd.fit_transform(signal=signal)
print(IMFs.shape)
vmd.plot_IMFs(save_figure=True)
~~~
![vmd_example](https://raw.githubusercontent.com/wwhenxuan/PySDKit/main/images/vmd_example.jpg)
Better observe the characteristics of the decomposed intrinsic mode function in the frequency domain.
~~~python
from pysdkit.plot import plot_IMFs_amplitude_spectra
# frequency domain visualization
plot_IMFs_amplitude_spectra(IMFs, smooth="exp") # use exp smooth
~~~
![frequency_example](https://raw.githubusercontent.com/wwhenxuan/PySDKit/main/images/frequency_example.jpg)
Raw data
{
"_id": null,
"home_page": "https://github.com/wwhenxuan/PySDKit",
"name": "PySDKit",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "signal, decomposition",
"author": "whenxuan",
"author_email": "wwhenxuan@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d4/75/801085d4a37c161c129426a11bb9c206298963b30c9933699c3c2ad79bea/PySDKit-0.4.7.tar.gz",
"platform": null,
"description": "# PySDKit: signal decomposition in Python\r\n\r\n[![PyPI version](https://badge.fury.io/py/PySDKit.svg)](https://pypi.org/project/PySDKit/) ![License](https://img.shields.io/github/license/wwhenxuan/PySDKit) [![codecov](https://codecov.io/gh/wwhenxuan/PySDKit/branch/main/graph/badge.svg?token=YOUR_TOKEN)](https://codecov.io/gh/wwhenxuan/PySDKit) [![arXiv](https://img.shields.io/badge/arXiv-1234.56789-brightgreen.svg)](https://arxiv.org/abs/1234.56789) [![Downloads](https://pepy.tech/badge/pysdkit)](https://pepy.tech/project/pysdkit) ![Static Badge](https://img.shields.io/badge/https%3A%2F%2Fimg.shields.io%2Fbadge%2Fjust%2520the%2520message--8A2BE2?logo=appveyor&logoColor=royalblue&label=NumPy&link=https%3A%2F%2Fnumpy.org%2Fdoc%2Fstable%2F) ![Static Badge](https://img.shields.io/badge/https%3A%2F%2Fimg.shields.io%2Fbadge%2Fjust%2520the%2520message--8A2BE2?logo=appveyor&logoColor=violet&label=SciPy&link=https%3A%2F%2Fdocs.scipy.org%2Fdoc%2Fscipy%2F)\r\n\r\n\r\nA Python library for signal decomposition algorithms\r\n\r\n![Logo](https://raw.githubusercontent.com/wwhenxuan/PySDKit/main/images/Logo_sd.png)\r\n\r\n## Installation\r\n\r\nYou can install `PySDKit` through pip.\r\n\r\n~~~\r\npip install pysdkit\r\n~~~\r\n\r\nWe only used [`NumPy`](https://numpy.org/), [`Scipy`](https://scipy.org/) and [`matplotlib`](https://matplotlib.org/) when developing the project.\r\n\r\n## Example script\r\n\r\nThis project integrates simple signal processing methods, signal decomposition and visualization, and builds a general interface similar to [`Scikit-learn`](https://scikit-learn.org/stable/). It is mainly divided into three steps:\r\n1. Import the signal decomposition method;\r\n2. Create an instance for signal decomposition;\r\n3. Use the `fit_transform` method to implement signal decomposition;\r\n4. Visualize and analyze the original signal and the intrinsic mode functions IMFs obtained by decomposition.\r\n\r\n~~~python\r\nfrom pysdkit import EMD\r\nfrom pysdkit.data import test_emd\r\nfrom pysdkit.plot import plot_IMFs\r\n\r\nt, signal = test_emd()\r\n\r\n# create an instance for signal decomposition\r\nemd = EMD()\r\n# implement signal decomposition\r\nIMFs = emd.fit_transform(signal, max_imf=2)\r\nplot_IMFs(signal, IMFs)\r\n~~~\r\n\r\n![example](https://raw.githubusercontent.com/wwhenxuan/PySDKit/main/images/example.jpg)\r\n\r\nThe 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`](https://ieeexplore.ieee.org/abstract/document/6655981)).\r\n\r\n~~~python\r\nfrom pysdkit import VMD\r\n\r\n# load new signal\r\nsignal = np.load(\"example.npy\")\r\n\r\n# use variational mode decomposition\r\nvmd = VMD(alpha=500, K=3, tau=0.0, tol=1e-9)\r\nIMFs = vmd.fit_transform(signal=signal)\r\nprint(IMFs.shape)\r\n\r\nvmd.plot_IMFs(save_figure=True)\r\n~~~\r\n\r\n![vmd_example](https://raw.githubusercontent.com/wwhenxuan/PySDKit/main/images/vmd_example.jpg)\r\n\r\nBetter observe the characteristics of the decomposed intrinsic mode function in the frequency domain.\r\n\r\n~~~python\r\nfrom pysdkit.plot import plot_IMFs_amplitude_spectra\r\n\r\n# frequency domain visualization\r\nplot_IMFs_amplitude_spectra(IMFs, smooth=\"exp\") # use exp smooth\r\n~~~\r\n\r\n![frequency_example](https://raw.githubusercontent.com/wwhenxuan/PySDKit/main/images/frequency_example.jpg)\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python library for signal decomposition algorithms with a unified interface.",
"version": "0.4.7",
"project_urls": {
"Homepage": "https://github.com/wwhenxuan/PySDKit"
},
"split_keywords": [
"signal",
" decomposition"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a17cc7e40174ac27ba9237d855533217abe14c7318a28ce74eafc9ccf717151c",
"md5": "9e2fac1c0f152c72386d46dfb15b2ebc",
"sha256": "df613fa869d14a5f83c5e15e59f3cf23421a6813b3cc6c863acf96398fab2111"
},
"downloads": -1,
"filename": "PySDKit-0.4.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9e2fac1c0f152c72386d46dfb15b2ebc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 57181,
"upload_time": "2024-11-18T15:35:37",
"upload_time_iso_8601": "2024-11-18T15:35:37.374845Z",
"url": "https://files.pythonhosted.org/packages/a1/7c/c7e40174ac27ba9237d855533217abe14c7318a28ce74eafc9ccf717151c/PySDKit-0.4.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d475801085d4a37c161c129426a11bb9c206298963b30c9933699c3c2ad79bea",
"md5": "98272f1db339abcbb85e42a0f9cdb061",
"sha256": "e404d3a01a45423c76dfa87e21889dff8462023bf75f0d2d938916d95620c721"
},
"downloads": -1,
"filename": "PySDKit-0.4.7.tar.gz",
"has_sig": false,
"md5_digest": "98272f1db339abcbb85e42a0f9cdb061",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 44495,
"upload_time": "2024-11-18T15:35:39",
"upload_time_iso_8601": "2024-11-18T15:35:39.423414Z",
"url": "https://files.pythonhosted.org/packages/d4/75/801085d4a37c161c129426a11bb9c206298963b30c9933699c3c2ad79bea/PySDKit-0.4.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-18 15:35:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "wwhenxuan",
"github_project": "PySDKit",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "numpy",
"specs": [
[
">=",
"1.24.3"
]
]
},
{
"name": "scipy",
"specs": [
[
">=",
"1.11.1"
]
]
},
{
"name": "matplotlib",
"specs": [
[
">=",
"3.7.2"
]
]
}
],
"lcname": "pysdkit"
}