PySDKit 0.4.12__tar.gz → 0.4.14__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. {pysdkit-0.4.12 → pysdkit-0.4.14}/PKG-INFO +2 -3
  2. {pysdkit-0.4.12 → pysdkit-0.4.14}/PySDKit.egg-info/PKG-INFO +2 -3
  3. {pysdkit-0.4.12 → pysdkit-0.4.14}/PySDKit.egg-info/SOURCES.txt +15 -7
  4. {pysdkit-0.4.12 → pysdkit-0.4.14}/README.md +1 -2
  5. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/__init__.py +7 -1
  6. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/data/__init__.py +15 -9
  7. pysdkit-0.4.14/pysdkit/data/_cube.py +276 -0
  8. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/data/_generator.py +27 -86
  9. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/data/_image.py +12 -12
  10. pysdkit-0.4.14/pysdkit/data/_time_series.py +137 -0
  11. pysdkit-0.4.14/pysdkit/emd/__init__.py +23 -0
  12. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/emd/_find_extrema.py +1 -1
  13. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/emd/ceemdan.py +4 -0
  14. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/emd/eemd.py +4 -0
  15. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/emd/emd.py +11 -6
  16. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/emd/memd.py +4 -0
  17. pysdkit-0.4.14/pysdkit/emd/remd.py +538 -0
  18. {pysdkit-0.4.12/pysdkit/tvf_emd → pysdkit-0.4.14/pysdkit/emd}/tvf_emd.py +10 -0
  19. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/ewt/ewt.py +7 -1
  20. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/faemd/faemd.py +7 -0
  21. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/faemd/md_faemd.py +11 -0
  22. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/faemd/mv_faemd.py +7 -0
  23. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/hvd/hvd.py +4 -0
  24. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/itd/itd.py +16 -6
  25. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/jmd/jmd.py +7 -0
  26. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/jmd/mjmd.py +7 -0
  27. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/lmd/lmd.py +4 -0
  28. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/lmd/rlmd.py +7 -0
  29. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/plot/__init__.py +3 -0
  30. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/plot/_plot_images.py +54 -32
  31. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/plot/_plot_imfs.py +86 -42
  32. pysdkit-0.4.14/pysdkit/plot/_plot_signal.py +134 -0
  33. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/ssa/ssa.py +4 -0
  34. pysdkit-0.4.14/pysdkit/tsa/__init__.py +8 -0
  35. pysdkit-0.4.14/pysdkit/tsa/_dtw.py +264 -0
  36. pysdkit-0.4.14/pysdkit/tsa/_moving_decomp.py +246 -0
  37. pysdkit-0.4.14/pysdkit/tsa/mstl.py +24 -0
  38. pysdkit-0.4.14/pysdkit/tsa/stl.py +28 -0
  39. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/utils/__init__.py +13 -10
  40. pysdkit-0.4.14/pysdkit/utils/_cite.py +8 -0
  41. pysdkit-0.4.12/pysdkit/utils/instantaneous.py → pysdkit-0.4.14/pysdkit/utils/_instantaneous.py +16 -2
  42. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/utils/_smooth1d.py +4 -3
  43. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/vmd/acmd.py +13 -0
  44. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/vmd/avmd.py +3 -0
  45. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/vmd/ba_acmd.py +7 -0
  46. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/vmd/base.py +4 -0
  47. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/vmd/mvmd.py +4 -0
  48. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/vmd/vmd_c.py +4 -3
  49. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/vmd2d/vmd2d.py +14 -0
  50. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/vncmd/vncmd.py +6 -1
  51. {pysdkit-0.4.12 → pysdkit-0.4.14}/setup.py +1 -1
  52. pysdkit-0.4.12/pysdkit/emd/__init__.py +0 -14
  53. pysdkit-0.4.12/pysdkit/emd/remd.py +0 -28
  54. pysdkit-0.4.12/pysdkit/tvf_emd/__init__.py +0 -7
  55. {pysdkit-0.4.12 → pysdkit-0.4.14}/PySDKit.egg-info/dependency_links.txt +0 -0
  56. {pysdkit-0.4.12 → pysdkit-0.4.14}/PySDKit.egg-info/requires.txt +0 -0
  57. {pysdkit-0.4.12 → pysdkit-0.4.14}/PySDKit.egg-info/top_level.txt +0 -0
  58. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/data/_add_noise.py +0 -0
  59. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/data/texture.txt +0 -0
  60. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/emd/_prepare_points.py +0 -0
  61. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/emd/_splines.py +0 -0
  62. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/emd2d/__init__.py +0 -0
  63. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/emd2d/bemd.py +0 -0
  64. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/emd2d/bmemd.py +0 -0
  65. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/emd2d/emd2d.py +0 -0
  66. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/esmd/__init__.py +0 -0
  67. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/esmd/esmd.py +0 -0
  68. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/ewt/__init__.py +0 -0
  69. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/ewt/ewt2d.py +0 -0
  70. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/faemd/__init__.py +0 -0
  71. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/fmd/__init__.py +0 -0
  72. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/fmd/fmd.py +0 -0
  73. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/hht/__init__.py +0 -0
  74. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/hht/hht.py +0 -0
  75. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/hvd/__init__.py +0 -0
  76. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/ifd/__init__.py +0 -0
  77. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/itd/__init__.py +0 -0
  78. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/jmd/__init__.py +0 -0
  79. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/lmd/__init__.py +0 -0
  80. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/plot/_fourier_spectra.py +0 -0
  81. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/plot/_functions.py +0 -0
  82. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/ssa/__init__.py +0 -0
  83. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/utils/_Index_of_Orthogonality.py +0 -0
  84. /pysdkit-0.4.12/pysdkit/utils/correlation.py → /pysdkit-0.4.14/pysdkit/utils/_correlation.py +0 -0
  85. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/utils/_diagnalization.py +0 -0
  86. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/utils/_differ.py +0 -0
  87. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/utils/_fft.py +0 -0
  88. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/utils/_function.py +0 -0
  89. /pysdkit-0.4.12/pysdkit/utils/hilbert.py → /pysdkit-0.4.14/pysdkit/utils/_hilbert.py +0 -0
  90. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/utils/_kernel_matrix.py +0 -0
  91. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/utils/_lags.py +0 -0
  92. /pysdkit-0.4.12/pysdkit/utils/mirror.py → /pysdkit-0.4.14/pysdkit/utils/_mirror.py +0 -0
  93. /pysdkit-0.4.12/pysdkit/utils/process.py → /pysdkit-0.4.14/pysdkit/utils/_process.py +0 -0
  94. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/utils/_types.py +0 -0
  95. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/vmd/__init__.py +0 -0
  96. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/vmd/svmd.py +0 -0
  97. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/vmd/vmd_f.py +0 -0
  98. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/vmd2d/__init__.py +0 -0
  99. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/vncmd/__init__.py +0 -0
  100. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/vncmd/anvcmd.py +0 -0
  101. {pysdkit-0.4.12 → pysdkit-0.4.14}/pysdkit/vncmd/mncmd.py +0 -0
  102. {pysdkit-0.4.12 → pysdkit-0.4.14}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: PySDKit
3
- Version: 0.4.12
3
+ Version: 0.4.14
4
4
  Summary: A Python library for signal decomposition algorithms with a unified interface.
5
5
  Home-page: https://github.com/wwhenxuan/PySDKit
6
6
  Author: whenxuan
@@ -43,7 +43,6 @@ Dynamic: summary
43
43
  ![License](https://img.shields.io/github/license/wwhenxuan/PySDKit)
44
44
  [![Python](https://img.shields.io/badge/python-3.8+-blue?logo=python)](https://www.python.org/)
45
45
  [![Downloads](https://pepy.tech/badge/pysdkit)](https://pepy.tech/project/pysdkit)
46
- ![Visits Badge](https://badges.pufler.dev/visits/ForestsKing/D3R)
47
46
  [![codestyle](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
48
47
 
49
48
  A Python library for signal decomposition algorithms 🥳
@@ -132,7 +131,7 @@ plot_IMFs_amplitude_spectra(IMFs, smooth="exp") # use exp smooth
132
131
  | [`BEMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd2d/bemd.py) (Bidimensional Empirical Mode Decomposition) | [[paper]](https://www.sciencedirect.com/science/article/abs/pii/S0262885603000945) | [[code]](https://github.com/laszukdawid/PyEMD/blob/master/PyEMD/BEMD.py) | ✖️ |
133
132
  | [`CEMD`]() (Complex Empirical Mode Decomposition) | [[paper]](https://ieeexplore.ieee.org/abstract/document/4063369) | [[code]]() | ✖️ |
134
133
  | [`EEMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd/eemd.py) (Ensemble Empirical Mode Decomposition) | [[paper]](https://www.sciencedirect.com/topics/physics-and-astronomy/ensemble-empirical-mode-decomposition) | [[code]](https://github.com/laszukdawid/PyEMD/blob/master/PyEMD/EEMD.py) | ✔️ |
135
- | [`REMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd/remd.py) (Robust Empirical Mode Decomposition) | [[paper]](https://www.sciencedirect.com/science/article/pii/S0019057821003785) | [[code]](https://www.mathworks.com/matlabcentral/fileexchange/70032-robust-empirical-mode-decomposition-remd) | ✖️ |
134
+ | [`REMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd/remd.py) (Robust Empirical Mode Decomposition) | [[paper]](https://www.sciencedirect.com/science/article/pii/S0019057821003785) | [[code]](https://www.mathworks.com/matlabcentral/fileexchange/70032-robust-empirical-mode-decomposition-remd) | ✔️ |
136
135
  | [`BMEMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd2d/bmemd.py) (Bidimensional Multivariate Empirical Mode Decomposition) | [[paper]](https://ieeexplore.ieee.org/document/8805082) | [[code]](https://www.mathworks.com/matlabcentral/fileexchange/72343-bidimensional-multivariate-empirical-mode-decomposition?s_tid=FX_rc1_behav) | ✖️ |
137
136
  | [`CEEMDAN`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd/ceemdan.py) (Complete Ensemble EMD with Adaptive Noise) | [[paper]](https://ieeexplore.ieee.org/document/5947265) | [[code]](https://github.com/laszukdawid/PyEMD/blob/master/PyEMD/EEMD.py) | ✔️ |
138
137
  | [`TVF_EMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/tvf_emd/tvf_emd.py) (Time Varying Filter Based EMD) | [[paper]](https://www.sciencedirect.com/science/article/pii/S0165168417301135) | [[code]](https://github.com/stfbnc/pytvfemd/tree/master) | ✔️ |
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: PySDKit
3
- Version: 0.4.12
3
+ Version: 0.4.14
4
4
  Summary: A Python library for signal decomposition algorithms with a unified interface.
5
5
  Home-page: https://github.com/wwhenxuan/PySDKit
6
6
  Author: whenxuan
@@ -43,7 +43,6 @@ Dynamic: summary
43
43
  ![License](https://img.shields.io/github/license/wwhenxuan/PySDKit)
44
44
  [![Python](https://img.shields.io/badge/python-3.8+-blue?logo=python)](https://www.python.org/)
45
45
  [![Downloads](https://pepy.tech/badge/pysdkit)](https://pepy.tech/project/pysdkit)
46
- ![Visits Badge](https://badges.pufler.dev/visits/ForestsKing/D3R)
47
46
  [![codestyle](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
48
47
 
49
48
  A Python library for signal decomposition algorithms 🥳
@@ -132,7 +131,7 @@ plot_IMFs_amplitude_spectra(IMFs, smooth="exp") # use exp smooth
132
131
  | [`BEMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd2d/bemd.py) (Bidimensional Empirical Mode Decomposition) | [[paper]](https://www.sciencedirect.com/science/article/abs/pii/S0262885603000945) | [[code]](https://github.com/laszukdawid/PyEMD/blob/master/PyEMD/BEMD.py) | ✖️ |
133
132
  | [`CEMD`]() (Complex Empirical Mode Decomposition) | [[paper]](https://ieeexplore.ieee.org/abstract/document/4063369) | [[code]]() | ✖️ |
134
133
  | [`EEMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd/eemd.py) (Ensemble Empirical Mode Decomposition) | [[paper]](https://www.sciencedirect.com/topics/physics-and-astronomy/ensemble-empirical-mode-decomposition) | [[code]](https://github.com/laszukdawid/PyEMD/blob/master/PyEMD/EEMD.py) | ✔️ |
135
- | [`REMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd/remd.py) (Robust Empirical Mode Decomposition) | [[paper]](https://www.sciencedirect.com/science/article/pii/S0019057821003785) | [[code]](https://www.mathworks.com/matlabcentral/fileexchange/70032-robust-empirical-mode-decomposition-remd) | ✖️ |
134
+ | [`REMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd/remd.py) (Robust Empirical Mode Decomposition) | [[paper]](https://www.sciencedirect.com/science/article/pii/S0019057821003785) | [[code]](https://www.mathworks.com/matlabcentral/fileexchange/70032-robust-empirical-mode-decomposition-remd) | ✔️ |
136
135
  | [`BMEMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd2d/bmemd.py) (Bidimensional Multivariate Empirical Mode Decomposition) | [[paper]](https://ieeexplore.ieee.org/document/8805082) | [[code]](https://www.mathworks.com/matlabcentral/fileexchange/72343-bidimensional-multivariate-empirical-mode-decomposition?s_tid=FX_rc1_behav) | ✖️ |
137
136
  | [`CEEMDAN`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd/ceemdan.py) (Complete Ensemble EMD with Adaptive Noise) | [[paper]](https://ieeexplore.ieee.org/document/5947265) | [[code]](https://github.com/laszukdawid/PyEMD/blob/master/PyEMD/EEMD.py) | ✔️ |
138
137
  | [`TVF_EMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/tvf_emd/tvf_emd.py) (Time Varying Filter Based EMD) | [[paper]](https://www.sciencedirect.com/science/article/pii/S0165168417301135) | [[code]](https://github.com/stfbnc/pytvfemd/tree/master) | ✔️ |
@@ -8,8 +8,10 @@ PySDKit.egg-info/top_level.txt
8
8
  pysdkit/__init__.py
9
9
  pysdkit/data/__init__.py
10
10
  pysdkit/data/_add_noise.py
11
+ pysdkit/data/_cube.py
11
12
  pysdkit/data/_generator.py
12
13
  pysdkit/data/_image.py
14
+ pysdkit/data/_time_series.py
13
15
  pysdkit/data/texture.txt
14
16
  pysdkit/emd/__init__.py
15
17
  pysdkit/emd/_find_extrema.py
@@ -20,6 +22,7 @@ pysdkit/emd/eemd.py
20
22
  pysdkit/emd/emd.py
21
23
  pysdkit/emd/memd.py
22
24
  pysdkit/emd/remd.py
25
+ pysdkit/emd/tvf_emd.py
23
26
  pysdkit/emd2d/__init__.py
24
27
  pysdkit/emd2d/bemd.py
25
28
  pysdkit/emd2d/bmemd.py
@@ -53,25 +56,30 @@ pysdkit/plot/_fourier_spectra.py
53
56
  pysdkit/plot/_functions.py
54
57
  pysdkit/plot/_plot_images.py
55
58
  pysdkit/plot/_plot_imfs.py
59
+ pysdkit/plot/_plot_signal.py
56
60
  pysdkit/ssa/__init__.py
57
61
  pysdkit/ssa/ssa.py
58
- pysdkit/tvf_emd/__init__.py
59
- pysdkit/tvf_emd/tvf_emd.py
62
+ pysdkit/tsa/__init__.py
63
+ pysdkit/tsa/_dtw.py
64
+ pysdkit/tsa/_moving_decomp.py
65
+ pysdkit/tsa/mstl.py
66
+ pysdkit/tsa/stl.py
60
67
  pysdkit/utils/_Index_of_Orthogonality.py
61
68
  pysdkit/utils/__init__.py
69
+ pysdkit/utils/_cite.py
70
+ pysdkit/utils/_correlation.py
62
71
  pysdkit/utils/_diagnalization.py
63
72
  pysdkit/utils/_differ.py
64
73
  pysdkit/utils/_fft.py
65
74
  pysdkit/utils/_function.py
75
+ pysdkit/utils/_hilbert.py
76
+ pysdkit/utils/_instantaneous.py
66
77
  pysdkit/utils/_kernel_matrix.py
67
78
  pysdkit/utils/_lags.py
79
+ pysdkit/utils/_mirror.py
80
+ pysdkit/utils/_process.py
68
81
  pysdkit/utils/_smooth1d.py
69
82
  pysdkit/utils/_types.py
70
- pysdkit/utils/correlation.py
71
- pysdkit/utils/hilbert.py
72
- pysdkit/utils/instantaneous.py
73
- pysdkit/utils/mirror.py
74
- pysdkit/utils/process.py
75
83
  pysdkit/vmd/__init__.py
76
84
  pysdkit/vmd/acmd.py
77
85
  pysdkit/vmd/avmd.py
@@ -6,7 +6,6 @@
6
6
  ![License](https://img.shields.io/github/license/wwhenxuan/PySDKit)
7
7
  [![Python](https://img.shields.io/badge/python-3.8+-blue?logo=python)](https://www.python.org/)
8
8
  [![Downloads](https://pepy.tech/badge/pysdkit)](https://pepy.tech/project/pysdkit)
9
- ![Visits Badge](https://badges.pufler.dev/visits/ForestsKing/D3R)
10
9
  [![codestyle](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
11
10
 
12
11
  A Python library for signal decomposition algorithms 🥳
@@ -95,7 +94,7 @@ plot_IMFs_amplitude_spectra(IMFs, smooth="exp") # use exp smooth
95
94
  | [`BEMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd2d/bemd.py) (Bidimensional Empirical Mode Decomposition) | [[paper]](https://www.sciencedirect.com/science/article/abs/pii/S0262885603000945) | [[code]](https://github.com/laszukdawid/PyEMD/blob/master/PyEMD/BEMD.py) | ✖️ |
96
95
  | [`CEMD`]() (Complex Empirical Mode Decomposition) | [[paper]](https://ieeexplore.ieee.org/abstract/document/4063369) | [[code]]() | ✖️ |
97
96
  | [`EEMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd/eemd.py) (Ensemble Empirical Mode Decomposition) | [[paper]](https://www.sciencedirect.com/topics/physics-and-astronomy/ensemble-empirical-mode-decomposition) | [[code]](https://github.com/laszukdawid/PyEMD/blob/master/PyEMD/EEMD.py) | ✔️ |
98
- | [`REMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd/remd.py) (Robust Empirical Mode Decomposition) | [[paper]](https://www.sciencedirect.com/science/article/pii/S0019057821003785) | [[code]](https://www.mathworks.com/matlabcentral/fileexchange/70032-robust-empirical-mode-decomposition-remd) | ✖️ |
97
+ | [`REMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd/remd.py) (Robust Empirical Mode Decomposition) | [[paper]](https://www.sciencedirect.com/science/article/pii/S0019057821003785) | [[code]](https://www.mathworks.com/matlabcentral/fileexchange/70032-robust-empirical-mode-decomposition-remd) | ✔️ |
99
98
  | [`BMEMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd2d/bmemd.py) (Bidimensional Multivariate Empirical Mode Decomposition) | [[paper]](https://ieeexplore.ieee.org/document/8805082) | [[code]](https://www.mathworks.com/matlabcentral/fileexchange/72343-bidimensional-multivariate-empirical-mode-decomposition?s_tid=FX_rc1_behav) | ✖️ |
100
99
  | [`CEEMDAN`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/emd/ceemdan.py) (Complete Ensemble EMD with Adaptive Noise) | [[paper]](https://ieeexplore.ieee.org/document/5947265) | [[code]](https://github.com/laszukdawid/PyEMD/blob/master/PyEMD/EEMD.py) | ✔️ |
101
100
  | [`TVF_EMD`](https://github.com/wwhenxuan/PySDKit/blob/main/pysdkit/tvf_emd/tvf_emd.py) (Time Varying Filter Based EMD) | [[paper]](https://www.sciencedirect.com/science/article/pii/S0165168417301135) | [[code]](https://github.com/stfbnc/pytvfemd/tree/master) | ✔️ |
@@ -7,11 +7,14 @@ from .emd import EEMD
7
7
  # 具有自适应噪声的完全集合经验模态分解
8
8
  from .emd import CEEMDAN
9
9
 
10
+ # 稳健经验模态分解
11
+ from .emd import REMD
12
+
10
13
  # 多元变分模态分解算法
11
14
  from .emd import MEMD
12
15
 
13
16
  # 基于时变滤波器的经验模态分解
14
- from .tvf_emd import TVF_EMD
17
+ from .emd import TVF_EMD
15
18
 
16
19
  # 希尔伯特震动分解
17
20
  from .hvd import HVD
@@ -45,3 +48,6 @@ from .vncmd import VNCMD
45
48
 
46
49
  # 经验小波变换
47
50
  from .ewt import ewt, EWT
51
+
52
+ # 滑动平均分解
53
+ from .tsa import Moving_Decomp
@@ -14,17 +14,17 @@ from ._generator import (
14
14
  )
15
15
  from ._generator import generate_am_signal, generate_exponential_signal
16
16
 
17
+ # Generator for 1D univariate time series data
18
+ from ._time_series import generate_time_series
19
+
17
20
  # Generates the main test sample signal
18
21
  from ._generator import test_emd
19
22
 
20
23
  # Generator for 1D univariate
21
- from ._generator import test_uni_signal
24
+ from ._generator import test_univariate_signal
22
25
 
23
26
  # Generator for 1D multivariate
24
- from ._generator import test_multi_signal
25
-
26
- # Functions that generate signal visualizations
27
- from ._generator import plot_signal
27
+ from ._generator import test_multivariate_signal
28
28
 
29
29
  # add Gaussian noise
30
30
  from ._add_noise import add_noise
@@ -32,8 +32,14 @@ from ._add_noise import add_noise
32
32
  # Test case for loading a 2D grayscale image
33
33
  from ._image import test_grayscale
34
34
 
35
- # Test case for univariate image
36
- from ._image import test_uni_image
35
+ # Test case for univariate 2D image
36
+ from ._image import test_univariate_image
37
+
38
+ # Test case for multivariate 2D image
39
+ from ._image import test_multivariate_image
40
+
41
+ # Test case for univariate 3D cube
42
+ from ._cube import test_univariate_cube
37
43
 
38
- # Test case for multivariate image
39
- from ._image import test_multi_image
44
+ # Test case for multivariate 3D cube
45
+ from ._cube import test_multivariate_cube
@@ -0,0 +1,276 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Created on 2025/02/11 00:19:03
4
+ @author: Whenxuan Wang
5
+ @email: wwhenxuan@gmail.com
6
+ Generate 3D cube test sample
7
+ """
8
+ import numpy as np
9
+
10
+ from typing import Optional, Union, Tuple, List
11
+
12
+
13
+ def get_meshgrid_3D(
14
+ low: Union[int, np.ndarray], high: Union[int, np.ndarray], sampling_rate: int = 30
15
+ ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
16
+ """
17
+ Generate a grid 3D cube given an input and output range
18
+ :param low: Minimum value of grid matrix,
19
+ If it is a ndarray array, its length must be 3 to indicate the range of three dimensions.
20
+ :param high: Maximum value of grid matrix,
21
+ If it is a ndarray array, its length must be 3 to indicate the range of three dimensions.
22
+ :param sampling_rate: The sampling rate of the grid matrix, which is the number of points in the matrix
23
+ :return: A grid matrix generated from a range in the form of a tuple
24
+ """
25
+ # First obtain a one-dimensional range array by specifying the ranges `low` and `high`
26
+ if isinstance(low, np.ndarray) and isinstance(high, np.ndarray):
27
+ # Both range parameters are Numpy arrays
28
+ X = np.linspace(low[0], high[0], sampling_rate)
29
+ Y = np.linspace(low[1], high[1], sampling_rate)
30
+ Z = np.linspace(low[2], high[2], sampling_rate)
31
+
32
+ elif isinstance(low, np.ndarray) and isinstance(high, int):
33
+ # `low` is a Numpy array `high` is a constant
34
+ X = np.linspace(low[0], high, sampling_rate)
35
+ Y = np.linspace(low[1], high, sampling_rate)
36
+ Z = np.linspace(low[2], high, sampling_rate)
37
+
38
+ elif isinstance(low, int) and isinstance(high, np.ndarray):
39
+ # `low` is a constant `high` is a Numpy array
40
+ X = np.linspace(low, high[0], sampling_rate)
41
+ Y = np.linspace(low, high[1], sampling_rate)
42
+ Z = np.linspace(low, high[2], sampling_rate)
43
+
44
+ elif isinstance(low, int) and isinstance(high, int):
45
+ # Both range parameters are constants
46
+ X = np.linspace(low, high, sampling_rate)
47
+ Y = np.linspace(low, high, sampling_rate)
48
+ Z = np.linspace(low, high, sampling_rate)
49
+
50
+ else:
51
+ raise TypeError("The params `low` and `high` must be int or ndarray of numpy!")
52
+
53
+ # Further generate network cube
54
+ x, y, z = np.meshgrid(X, Y, Z)
55
+
56
+ return x, y, z
57
+
58
+
59
+ def test_univariate_cube(
60
+ case: int = 1,
61
+ low: Union[int, np.ndarray] = 0,
62
+ high: Union[int, np.ndarray] = 10,
63
+ sampling_rate: int = 30,
64
+ ) -> np.ndarray:
65
+ """
66
+ Generate a 3D cube data for testing 3D univariate signal decomposition algorithms
67
+
68
+ :param case: Test case, range in [1, 2, 3, 4, 5, 6]
69
+ :param low: Minimum value of grid matrix,
70
+ If it is a ndarray array, its length must be 3 to indicate the range of three dimensions.
71
+ :param high: Maximum value of grid matrix,
72
+ If it is a ndarray array, its length must be 3 to indicate the range of three dimensions.
73
+ :param sampling_rate: The sampling rate of the grid matrix, which is the number of points in the matrix
74
+ :return: Get a 3D cube data of a specified range
75
+ """
76
+ # Generate data based on the input test sample number
77
+ if case == 1:
78
+ return test_cube_1(low=low, high=high, sampling_rate=sampling_rate)
79
+ elif case == 2:
80
+ return test_cube_2(low=low, high=high, sampling_rate=sampling_rate)
81
+ elif case == 3:
82
+ return test_cube_3(low=low, high=high, sampling_rate=sampling_rate)
83
+ elif case == 4:
84
+ return test_cube_4(low=low, high=high, sampling_rate=sampling_rate)
85
+ elif case == 5:
86
+ return test_cube_5(low=low, high=high, sampling_rate=sampling_rate)
87
+ elif case == 6:
88
+ return test_cube_6(low=low, high=high, sampling_rate=sampling_rate)
89
+ else:
90
+ raise TypeError("The params `case` must be in the range of [1, 2, 3, 4, 5, 6]")
91
+
92
+
93
+ def test_multivariate_cube(
94
+ case: Union[List[int], Tuple[int], np.ndarray] = None,
95
+ low: Union[int, np.ndarray] = 0,
96
+ high: Union[int, np.ndarray] = 10,
97
+ sampling_rate: int = 30,
98
+ ) -> np.ndarray:
99
+ """
100
+ Generate 3D cubes data for testing 3D multivariate signal decomposition algorithms
101
+ :param case: The test cases to use are specified by inputting a list or tuple or ndarray in the range [1, 2, 3, 4, 5, 6],
102
+ The default parameter settings are [1, 2, 3].
103
+ :param low: Minimum value of grid matrix,
104
+ If it is a ndarray array, its length must be 3 to indicate the range of three dimensions.
105
+ :param high: Maximum value of grid matrix,
106
+ If it is a ndarray array, its length must be 3 to indicate the range of three dimensions.
107
+ :param sampling_rate: The sampling rate of the grid matrix, which is the number of points in the matrix
108
+ :return: Get 3D cube data of multiple different channels
109
+ """
110
+ # Default Parameters
111
+ if case is None:
112
+ case = [1, 2, 3]
113
+ # Make sure it is the correct data type
114
+ if (
115
+ isinstance(case, tuple)
116
+ or isinstance(case, list)
117
+ or isinstance(case, np.ndarray)
118
+ ):
119
+ # Make sure there is content
120
+ if len(case) >= 1:
121
+ cubes = np.vstack(
122
+ [
123
+ test_univariate_cube(
124
+ case=c, low=low, high=high, sampling_rate=sampling_rate
125
+ )
126
+ for c in case
127
+ ]
128
+ )
129
+ return cubes
130
+ else:
131
+ raise ValueError("The number in `case` must be greater than 1!")
132
+ else:
133
+ raise TypeError("The params `case` should be a list or tuple or ndarray!")
134
+
135
+
136
+ def test_cube_1(
137
+ low: Union[int, np.ndarray], high: Union[int, np.ndarray], sampling_rate: int = 30
138
+ ) -> np.ndarray:
139
+ """
140
+ Generate a 3D cube test example 1
141
+ :param low: Minimum value of grid matrix
142
+ :param high: Maximum value of grid matrix
143
+ :param sampling_rate: The sampling rate of the grid matrix, which is the number of points in the matrix
144
+ :return: Cube generated by sine and cosine functions
145
+ """
146
+ # First generate the grid array
147
+ x, y, z = get_meshgrid_3D(low=low, high=high, sampling_rate=sampling_rate)
148
+ # Generate cubes of different frequencies
149
+ uc1 = np.sin(3.5 * x) + np.sin(3.5 * y) + np.sin(3.5 * z)
150
+ uc2 = np.sin(x) + np.sin(y) + np.sin(z)
151
+ ru = np.cos(x / 24) + np.cos(y / 24) + np.cos(z / 24)
152
+ # Fusion of different modalities
153
+ u = uc1 + uc2 + ru
154
+ # Standardize the results of the integration
155
+ u = (u - np.mean(u)) / np.std(u + 0.01)
156
+ return u
157
+
158
+
159
+ def test_cube_2(
160
+ low: Union[int, np.ndarray], high: Union[int, np.ndarray], sampling_rate: int = 30
161
+ ) -> np.ndarray:
162
+ """
163
+ Generate a 3D cube test example 2
164
+ :param low: Minimum value of grid matrix
165
+ :param high: Maximum value of grid matrix
166
+ :param sampling_rate: The sampling rate of the grid matrix, which is the number of points in the matrix
167
+ :return: Cube generated by sine and cosine functions
168
+ """
169
+ # First generate the grid array
170
+ x, y, z = get_meshgrid_3D(low=low, high=high, sampling_rate=sampling_rate)
171
+ # Generate cubes of different frequencies
172
+ uc1 = np.sin(5 * x) + np.sin(5 * y) + np.sin(5 * z)
173
+ uc2 = np.sin(x) + np.sin(y) + np.sin(z)
174
+ ru = np.cos(x / 16) + np.cos(y / 16) + np.cos(z / 16)
175
+ # Fusion of different modalities
176
+ u = uc1 + uc2 + ru
177
+ # Standardize the results of the integration
178
+ u = (u - np.mean(u)) / np.std(u + 0.001)
179
+ return u
180
+
181
+
182
+ def test_cube_3(
183
+ low: Union[int, np.ndarray], high: Union[int, np.ndarray], sampling_rate: int = 30
184
+ ) -> np.ndarray:
185
+ """
186
+ Generate a 3D cube test example 3
187
+ :param low: Minimum value of grid matrix
188
+ :param high: Maximum value of grid matrix
189
+ :param sampling_rate: The sampling rate of the grid matrix, which is the number of points in the matrix
190
+ :return: Cube generated by sine and cosine functions
191
+ """
192
+ # First generate the grid array
193
+ x, y, z = get_meshgrid_3D(low=low, high=high, sampling_rate=sampling_rate)
194
+ # Generate cubes of different frequencies
195
+ uc1 = np.sin(2 * x) + np.sin(2 * y) + np.sin(2 * z)
196
+ uc2 = np.sin(4 * x) + np.sin(4 * y) + np.sin(4 * z)
197
+ ru = np.cos(x / 24) + np.cos(y / 24) + np.cos(z / 24)
198
+ # Fusion of different modalities
199
+ u = uc1 + uc2 + ru
200
+ # Standardize the results of the integration
201
+ u = (u - np.mean(u)) / np.std(u + 0.001)
202
+ return u
203
+
204
+
205
+ def test_cube_4(
206
+ low: Union[int, np.ndarray], high: Union[int, np.ndarray], sampling_rate: int = 30
207
+ ) -> np.ndarray:
208
+ """
209
+ Generate a 3D cube test example 4
210
+ :param low: Minimum value of grid matrix
211
+ :param high: Maximum value of grid matrix
212
+ :param sampling_rate: The sampling rate of the grid matrix, which is the number of points in the matrix
213
+ :return: Cube generated by sine and cosine functions
214
+ """
215
+ # First generate the grid array
216
+ x, y, z = get_meshgrid_3D(low=low, high=high, sampling_rate=sampling_rate)
217
+ # Generate cubes of different frequencies
218
+ uc1 = np.sin(2 * x**1.5) + np.sin(2 * y**1.5) + np.sin(2 * z * 1.5)
219
+ uc2 = np.sin(5 * x) + np.sin(5 * y) + np.sin(5 * z)
220
+ ru = np.cos(x / 24) + np.cos(y / 24) + np.cos(z / 24)
221
+ # Fusion of different modalities
222
+ u = uc1 + uc2 + ru
223
+ # Standardize the results of the integration
224
+ u = (u - np.mean(u)) / np.std(u + 0.001)
225
+ return u
226
+
227
+
228
+ def test_cube_5(
229
+ low: Union[int, np.ndarray], high: Union[int, np.ndarray], sampling_rate: int = 30
230
+ ) -> np.ndarray:
231
+ """
232
+ Generate a 3D cube test example 5
233
+ :param low: Minimum value of grid matrix
234
+ :param high: Maximum value of grid matrix
235
+ :param sampling_rate: The sampling rate of the grid matrix, which is the number of points in the matrix
236
+ :return: Cube generated by sine and cosine functions
237
+ """
238
+ # First generate the grid array
239
+ x, y, z = get_meshgrid_3D(low=low, high=high, sampling_rate=sampling_rate)
240
+ # Generate cubes of different frequencies
241
+ uc1 = np.cos(x**2) + np.cos(y**2) + np.cos(z * 2)
242
+ uc2 = np.sin(5 * x) + np.sin(5 * y) + np.sin(5 * z)
243
+ ru = np.cos(x / 24) + np.cos(y / 24) + np.cos(z / 24)
244
+ # Fusion of different modalities
245
+ u = uc1 + uc2 + ru
246
+ # Standardize the results of the integration
247
+ u = (u - np.mean(u)) / np.std(u + 0.001)
248
+ return u
249
+
250
+
251
+ def test_cube_6(
252
+ low: Union[int, np.ndarray], high: Union[int, np.ndarray], sampling_rate: int = 30
253
+ ) -> np.ndarray:
254
+ """
255
+ Generate a 3D cube test example 6
256
+ :param low: Minimum value of grid matrix
257
+ :param high: Maximum value of grid matrix
258
+ :param sampling_rate: The sampling rate of the grid matrix, which is the number of points in the matrix
259
+ :return: Cube generated by sine and cosine functions
260
+ """
261
+ # First generate the grid array
262
+ x, y, z = get_meshgrid_3D(low=low, high=high, sampling_rate=sampling_rate)
263
+ # Generate cubes of different frequencies
264
+ uc1 = np.cos(x**2) + np.cos(y**2) + np.cos(z * 2)
265
+ uc2 = np.sin(5 * x) + np.sin(5 * y) + np.sin(5 * z)
266
+ ru = np.cos(x / 24) + np.cos(y / 24) + np.cos(z / 24)
267
+ # Fusion of different modalities
268
+ u = uc1 + uc2 + ru
269
+ # Standardize the results of the integration
270
+ u = (u - np.mean(u)) / np.std(u + 0.001)
271
+ return u
272
+
273
+
274
+ if __name__ == "__main__":
275
+ print(test_univariate_cube().shape)
276
+ print(test_univariate_cube())
@@ -8,7 +8,7 @@ import numpy as np
8
8
  from scipy.signal import sawtooth
9
9
  from matplotlib import pyplot as plt
10
10
 
11
- from typing import Tuple
11
+ from typing import Tuple, Optional
12
12
 
13
13
 
14
14
  def generate_sin_signal(
@@ -198,7 +198,7 @@ def generate_exponential_signal(
198
198
  return t, noisy_exp_signal
199
199
 
200
200
 
201
- def test_uni_signal(
201
+ def test_univariate_signal(
202
202
  case: int = 1,
203
203
  duration: float = 1.0,
204
204
  sampling_rate: int = 1000,
@@ -254,7 +254,12 @@ def test_1D_2(
254
254
  :return: Tuple containing time array and the 3 * 2 ^ (-t) * sin(sin(2 * pi * t)) signal.
255
255
  """
256
256
  t = np.linspace(0, duration, int(sampling_rate * duration), endpoint=False)
257
- signal = 3 * 2 ^ (-t) * np.sin(np.sin(2 * np.pi * t))
257
+ signal = (
258
+ 3 * 2 ** (-t) * np.sin(np.sin(2 * np.pi * t))
259
+ + np.cos(2 * np.pi * t * 5)
260
+ + np.sin(2 * np.pi * (t + 2 * t**2))
261
+ + np.sin(2 * np.pi * t * 30)
262
+ )
258
263
  return t, signal
259
264
 
260
265
 
@@ -274,7 +279,13 @@ def test_1D_3(
274
279
  """
275
280
  np.random.seed(seed=random_state)
276
281
  t = np.linspace(0, duration, int(sampling_rate * duration), endpoint=False)
277
- signal = 5 * np.sin(2 * np.pi * t) + 3 * np.sin(2 * np.pi * t)
282
+ signal = (
283
+ 5 * np.sin(2 * np.pi * t)
284
+ + 3 * np.cos(2 * np.pi * t)
285
+ + 2 * np.cos(2 * np.pi * t**2)
286
+ + np.sin(2 * np.pi * t**3)
287
+ + np.sin(2 * np.pi * (t * 30 + t**2 * 2))
288
+ )
278
289
  noise = np.random.normal(0, noise_level, signal.shape)
279
290
  noise_signal = signal + noise
280
291
  return t, noise_signal
@@ -302,7 +313,7 @@ def test_emd(
302
313
  return t, noise_signal
303
314
 
304
315
 
305
- def test_multi_signal(
316
+ def test_multivariate_signal(
306
317
  case: int = 1,
307
318
  duration: float = 1.0,
308
319
  sampling_rate: int = 1000,
@@ -316,18 +327,18 @@ def test_multi_signal(
316
327
  :return: the generated signal for multivariate 1D.
317
328
  """
318
329
  if case == 1:
319
- return test_multi_1D_1(duration=duration, sampling_rate=sampling_rate)
330
+ return test_multivariate_1D_1(duration=duration, sampling_rate=sampling_rate)
320
331
  elif case == 2:
321
- return test_multi_1D_2(duration=duration, sampling_rate=sampling_rate)
332
+ return test_multivariate_1D_2(duration=duration, sampling_rate=sampling_rate)
322
333
  elif case == 3:
323
- return test_multi_1D_3(duration=duration, sampling_rate=sampling_rate)
334
+ return test_multivariate_1D_3(duration=duration, sampling_rate=sampling_rate)
324
335
  else:
325
336
  # When there is no such test instance, the function returns `case==1`
326
337
  print(f"There is no case {case}, so it will return case==1!")
327
- return test_multi_1D_1(duration=duration, sampling_rate=sampling_rate)
338
+ return test_multivariate_1D_1(duration=duration, sampling_rate=sampling_rate)
328
339
 
329
340
 
330
- def test_multi_1D_1(
341
+ def test_multivariate_1D_1(
331
342
  duration: float = 1.0, sampling_rate: int = 1000
332
343
  ) -> Tuple[np.array, np.array]:
333
344
  """
@@ -350,7 +361,7 @@ def test_multi_1D_1(
350
361
  return t, signal
351
362
 
352
363
 
353
- def test_multi_1D_2(
364
+ def test_multivariate_1D_2(
354
365
  duration: float = 1.0, sampling_rate: int = 1000
355
366
  ) -> Tuple[np.array, np.array]:
356
367
  """
@@ -361,7 +372,6 @@ def test_multi_1D_2(
361
372
  """
362
373
  np.random.seed(seed=42)
363
374
  t = np.linspace(0, duration, int(sampling_rate * duration), endpoint=False)
364
- t = np.linspace(0, duration, int(sampling_rate * duration), endpoint=False)
365
375
 
366
376
  # Generate the multi-channels signals
367
377
  signal_1 = (
@@ -391,7 +401,7 @@ def test_multi_1D_2(
391
401
  return t, signal
392
402
 
393
403
 
394
- def test_multi_1D_3(
404
+ def test_multivariate_1D_3(
395
405
  duration: float = 1.0,
396
406
  sampling_rate: int = 1000,
397
407
  noise_level: float = 0.1,
@@ -445,85 +455,16 @@ def test_multi_1D_3(
445
455
  return t, f
446
456
 
447
457
 
448
- def plot_signal(
449
- t: np.array,
450
- signal: np.array,
451
- color: str = "royalblue",
452
- save: bool = False,
453
- dpi: int = 128,
454
- fontsize: int = 12,
455
- ) -> plt.figure:
456
- """
457
- Plot and optionally save an amplitude modulated (AM) signal with time on the x-axis and amplitude on the y-axis.
458
- :param t: Array of time points corresponding to the signal.
459
- :param signal: Array containing the signal data to be plotted.
460
- :param color: Color of the plot line.
461
- :param save: Boolean flag to indicate whether the plot should be saved to a file.
462
- :param dpi: Dots per inch (resolution) of the figure, if saved.
463
- :param fontsize: Font size of the axis labels.
464
- :return: The figure object containing the plot.
465
- """
466
-
467
- # Determine the number of input signals
468
- n_dim = len(signal.shape)
469
-
470
- if n_dim == 1:
471
- # Create a figure and a single subplot
472
- fig, ax = plt.subplots(figsize=(8, 3))
473
-
474
- # Plot the signal against time with specified line color
475
- ax.plot(t, signal, color=color)
476
-
477
- # Set the x-axis label with specified font size
478
- ax.set_xlabel("Time (seconds)", fontsize=fontsize)
479
-
480
- # Set the y-axis label with default font size
481
- ax.set_ylabel("Amplitude", fontsize=fontsize)
482
-
483
- # Enable grid for better readability
484
- ax.grid(True)
485
-
486
- elif n_dim == 2:
487
- # Determining the number of multivariate signals
488
- n_vars = signal.shape[0]
489
-
490
- # Create a figure and a single subplot
491
- fig, ax = plt.subplots(nrows=n_vars, figsize=(10, 1 + 2 * n_vars), sharex=True)
492
-
493
- for i in range(n_vars):
494
- # Plot the signal against time with specified line color
495
- ax[i].plot(t, signal[i, :], color=color)
496
-
497
- # Set the y-axis label with default font size
498
- ax[i].set_ylabel("Amplitude", fontsize=fontsize)
499
-
500
- # Enable grid for better readability
501
- ax[i].grid(True)
502
-
503
- # Set the x-axis label with specified font size
504
- ax[-1].set_xlabel("Time (seconds)", fontsize=fontsize)
505
-
506
- else:
507
- raise ValueError("Wrong input signal, please input the 1D signal.")
508
-
509
- # Check if the figure needs to be saved
510
- if save:
511
- # Save the figure with the specified dpi and bounding box tightly around the figure
512
- fig.savefig("generate_signal.jpg", dpi=dpi, bbox_inches="tight")
513
-
514
- # Return the figure object
515
- return fig
516
-
517
-
518
458
  if __name__ == "__main__":
519
- from pysdkit.data import test_emd, plot_signal, test_multi_signal
459
+ from pysdkit.data import test_emd, test_multivariate_signal
460
+ from pysdkit.plot import plot_signal
520
461
 
521
- t, signal = test_uni_signal(case=1)
462
+ t, signal = test_univariate_signal(case=1)
522
463
  print(signal.shape)
523
464
 
524
465
  fig = plot_signal(t, signal)
525
466
 
526
- t, signal = test_multi_signal(case=2)
467
+ t, signal = test_multivariate_signal(case=2)
527
468
  print(signal.shape)
528
469
 
529
470
  fig = plot_signal(t, signal, save=False)