PySDKit 0.4.17__tar.gz → 0.4.19__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 (130) hide show
  1. {pysdkit-0.4.17 → pysdkit-0.4.19}/PKG-INFO +4 -3
  2. {pysdkit-0.4.17 → pysdkit-0.4.19}/PySDKit.egg-info/PKG-INFO +4 -3
  3. {pysdkit-0.4.17 → pysdkit-0.4.19}/PySDKit.egg-info/SOURCES.txt +6 -3
  4. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/__init__.py +86 -42
  5. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_emd/__init__.py +2 -0
  6. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_emd/ceemdan.py +54 -38
  7. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_emd/efd.py +1 -1
  8. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_emd/emd.py +16 -1
  9. {pysdkit-0.4.17/pysdkit → pysdkit-0.4.19/pysdkit/_emd}/hht/__init__.py +1 -0
  10. pysdkit-0.4.19/pysdkit/_emd/hht/frequency.py +105 -0
  11. pysdkit-0.4.19/pysdkit/_emd/hht/hht.py +251 -0
  12. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_itd/itd.py +9 -17
  13. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_lmd/lmd.py +14 -0
  14. pysdkit-0.4.19/pysdkit/_lmd/rlmd.py +739 -0
  15. pysdkit-0.4.19/pysdkit/_vncmd/avncmd.py +347 -0
  16. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vncmd/incmd.py +1 -0
  17. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vncmd/vncmd.py +5 -2
  18. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/data/__init__.py +4 -1
  19. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/data/_generator.py +19 -1
  20. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/plot/__init__.py +7 -5
  21. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/plot/_fourier_spectra.py +80 -1
  22. pysdkit-0.4.19/pysdkit/tests/test_lmd.py +66 -0
  23. pysdkit-0.4.19/pysdkit/tests/test_rlmd.py +66 -0
  24. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tsa/_stl.py +3 -0
  25. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/utils/__init__.py +8 -0
  26. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/utils/_hilbert.py +90 -1
  27. {pysdkit-0.4.17 → pysdkit-0.4.19}/setup.py +2 -2
  28. pysdkit-0.4.17/pysdkit/_lmd/rlmd.py +0 -33
  29. pysdkit-0.4.17/pysdkit/_vncmd/anvcmd.py +0 -13
  30. pysdkit-0.4.17/pysdkit/hht/hht.py +0 -14
  31. {pysdkit-0.4.17 → pysdkit-0.4.19}/LICENSE +0 -0
  32. {pysdkit-0.4.17 → pysdkit-0.4.19}/PySDKit.egg-info/dependency_links.txt +0 -0
  33. {pysdkit-0.4.17 → pysdkit-0.4.19}/PySDKit.egg-info/requires.txt +0 -0
  34. {pysdkit-0.4.17 → pysdkit-0.4.19}/PySDKit.egg-info/top_level.txt +0 -0
  35. {pysdkit-0.4.17 → pysdkit-0.4.19}/README.md +0 -0
  36. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_emd/_find_extrema.py +0 -0
  37. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_emd/_prepare_points.py +0 -0
  38. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_emd/_splines.py +0 -0
  39. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_emd/eemd.py +0 -0
  40. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_emd/memd.py +0 -0
  41. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_emd/remd.py +0 -0
  42. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_emd/tvf_emd.py +0 -0
  43. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_emd2d/__init__.py +0 -0
  44. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_emd2d/bemd.py +0 -0
  45. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_emd2d/bmemd.py +0 -0
  46. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_emd2d/emd2d.py +0 -0
  47. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_esmd/__init__.py +0 -0
  48. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_esmd/esmd.py +0 -0
  49. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_ewt/__init__.py +0 -0
  50. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_ewt/ewt.py +0 -0
  51. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_ewt/ewt2d.py +0 -0
  52. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_faemd/__init__.py +0 -0
  53. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_faemd/extrema.py +0 -0
  54. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_faemd/faemd.py +0 -0
  55. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_faemd/faemd2d.py +0 -0
  56. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_faemd/faemd3d.py +0 -0
  57. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_faemd/filter.py +0 -0
  58. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_fmd/__init__.py +0 -0
  59. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_fmd/fmd.py +0 -0
  60. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_fmd/nfmd.py +0 -0
  61. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_hvd/__init__.py +0 -0
  62. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_hvd/hvd.py +0 -0
  63. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_ifd/__init__.py +0 -0
  64. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_itd/__init__.py +0 -0
  65. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_jmd/__init__.py +0 -0
  66. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_jmd/jmd.py +0 -0
  67. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_jmd/mjmd.py +0 -0
  68. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_lmd/__init__.py +0 -0
  69. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_osd/__init__.py +0 -0
  70. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_ssa/__init__.py +0 -0
  71. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_ssa/ssa.py +0 -0
  72. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vmd/__init__.py +0 -0
  73. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vmd/acmd.py +0 -0
  74. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vmd/avmd.py +0 -0
  75. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vmd/ba_acmd.py +0 -0
  76. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vmd/base.py +0 -0
  77. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vmd/mvmd.py +0 -0
  78. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vmd/svmd.py +0 -0
  79. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vmd/vmd_c.py +0 -0
  80. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vmd/vmd_f.py +0 -0
  81. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vmd/vme.py +0 -0
  82. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vmd2d/__init__.py +0 -0
  83. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vmd2d/cvmd2d.py +0 -0
  84. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vmd2d/vmd2d.py +0 -0
  85. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vncmd/__init__.py +0 -0
  86. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/_vncmd/mncmd.py +0 -0
  87. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/data/_add_noise.py +0 -0
  88. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/data/_cube.py +0 -0
  89. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/data/_image.py +0 -0
  90. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/data/_time_series.py +0 -0
  91. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/data/texture.txt +0 -0
  92. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/entropy/__init__.py +0 -0
  93. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/entropy/_approxiamte_entropy.py +0 -0
  94. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/entropy/_permutation_entropy.py +0 -0
  95. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/entropy/_sample_entropy.py +0 -0
  96. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/plot/_functions.py +0 -0
  97. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/plot/_plot_images.py +0 -0
  98. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/plot/_plot_imfs.py +0 -0
  99. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/plot/_plot_signal.py +0 -0
  100. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tests/__init__.py +0 -0
  101. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tests/test_all.py +0 -0
  102. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tests/test_ceemdan.py +0 -0
  103. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tests/test_emd.py +0 -0
  104. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tests/test_ewt.py +0 -0
  105. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tests/test_faemd.py +0 -0
  106. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tests/test_faemd2d.py +0 -0
  107. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tests/test_faemd3d.py +0 -0
  108. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tests/test_generator_cube.py +0 -0
  109. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tests/test_generator_image.py +0 -0
  110. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tests/test_generator_signal.py +0 -0
  111. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tests/test_moving_decomp.py +0 -0
  112. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tests/test_vmd.py +0 -0
  113. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tests/test_vmd2d.py +0 -0
  114. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tsa/__init__.py +0 -0
  115. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tsa/_dtw.py +0 -0
  116. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tsa/_knn.py +0 -0
  117. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tsa/_moving_decomp.py +0 -0
  118. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/tsa/_mstl.py +0 -0
  119. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/utils/_cite.py +0 -0
  120. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/utils/_correlation.py +0 -0
  121. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/utils/_diagnalization.py +0 -0
  122. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/utils/_differ.py +0 -0
  123. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/utils/_fft.py +0 -0
  124. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/utils/_function.py +0 -0
  125. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/utils/_instantaneous.py +0 -0
  126. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/utils/_kernel_matrix.py +0 -0
  127. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/utils/_mirror.py +0 -0
  128. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/utils/_process.py +0 -0
  129. {pysdkit-0.4.17 → pysdkit-0.4.19}/pysdkit/utils/_smooth1d.py +0 -0
  130. {pysdkit-0.4.17 → pysdkit-0.4.19}/setup.cfg +0 -0
@@ -1,9 +1,9 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: PySDKit
3
- Version: 0.4.17
3
+ Version: 0.4.19
4
4
  Summary: A Python library for signal decomposition algorithms with a unified interface.
5
5
  Home-page: https://github.com/wwhenxuan/PySDKit
6
- Author: whenxuan
6
+ Author: whenxuan, changewam, josefinez
7
7
  Author-email: wwhenxuan@gmail.com
8
8
  Keywords: signal decomposition,signal processing,machine learning
9
9
  Classifier: Development Status :: 3 - Alpha
@@ -32,6 +32,7 @@ Dynamic: description
32
32
  Dynamic: description-content-type
33
33
  Dynamic: home-page
34
34
  Dynamic: keywords
35
+ Dynamic: license-file
35
36
  Dynamic: requires-dist
36
37
  Dynamic: requires-python
37
38
  Dynamic: summary
@@ -1,9 +1,9 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: PySDKit
3
- Version: 0.4.17
3
+ Version: 0.4.19
4
4
  Summary: A Python library for signal decomposition algorithms with a unified interface.
5
5
  Home-page: https://github.com/wwhenxuan/PySDKit
6
- Author: whenxuan
6
+ Author: whenxuan, changewam, josefinez
7
7
  Author-email: wwhenxuan@gmail.com
8
8
  Keywords: signal decomposition,signal processing,machine learning
9
9
  Classifier: Development Status :: 3 - Alpha
@@ -32,6 +32,7 @@ Dynamic: description
32
32
  Dynamic: description-content-type
33
33
  Dynamic: home-page
34
34
  Dynamic: keywords
35
+ Dynamic: license-file
35
36
  Dynamic: requires-dist
36
37
  Dynamic: requires-python
37
38
  Dynamic: summary
@@ -22,6 +22,9 @@ pysdkit/_emd2d/__init__.py
22
22
  pysdkit/_emd2d/bemd.py
23
23
  pysdkit/_emd2d/bmemd.py
24
24
  pysdkit/_emd2d/emd2d.py
25
+ pysdkit/_emd/hht/__init__.py
26
+ pysdkit/_emd/hht/frequency.py
27
+ pysdkit/_emd/hht/hht.py
25
28
  pysdkit/_esmd/__init__.py
26
29
  pysdkit/_esmd/esmd.py
27
30
  pysdkit/_ewt/__init__.py
@@ -64,7 +67,7 @@ pysdkit/_vmd2d/__init__.py
64
67
  pysdkit/_vmd2d/cvmd2d.py
65
68
  pysdkit/_vmd2d/vmd2d.py
66
69
  pysdkit/_vncmd/__init__.py
67
- pysdkit/_vncmd/anvcmd.py
70
+ pysdkit/_vncmd/avncmd.py
68
71
  pysdkit/_vncmd/incmd.py
69
72
  pysdkit/_vncmd/mncmd.py
70
73
  pysdkit/_vncmd/vncmd.py
@@ -79,8 +82,6 @@ pysdkit/entropy/__init__.py
79
82
  pysdkit/entropy/_approxiamte_entropy.py
80
83
  pysdkit/entropy/_permutation_entropy.py
81
84
  pysdkit/entropy/_sample_entropy.py
82
- pysdkit/hht/__init__.py
83
- pysdkit/hht/hht.py
84
85
  pysdkit/plot/__init__.py
85
86
  pysdkit/plot/_fourier_spectra.py
86
87
  pysdkit/plot/_functions.py
@@ -98,7 +99,9 @@ pysdkit/tests/test_faemd3d.py
98
99
  pysdkit/tests/test_generator_cube.py
99
100
  pysdkit/tests/test_generator_image.py
100
101
  pysdkit/tests/test_generator_signal.py
102
+ pysdkit/tests/test_lmd.py
101
103
  pysdkit/tests/test_moving_decomp.py
104
+ pysdkit/tests/test_rlmd.py
102
105
  pysdkit/tests/test_vmd.py
103
106
  pysdkit/tests/test_vmd2d.py
104
107
  pysdkit/tsa/__init__.py
@@ -2,43 +2,7 @@
2
2
  A Python library for signal decomposition algorithms.
3
3
  """
4
4
 
5
- __version__ = "0.4.16"
6
-
7
- __all__ = [
8
- "EMD",
9
- "EEMD",
10
- "CEEMDAN",
11
- "REMD",
12
- "MEMD",
13
- "TVF_EMD",
14
- "EFD",
15
- "FAEMD",
16
- "EMD2D",
17
- "HVD",
18
- "ITD",
19
- "LMD",
20
- "RLMD",
21
- "SSA",
22
- "vmd",
23
- "VMD",
24
- "ACMD",
25
- "MVMD",
26
- "VME",
27
- "CVMD2D",
28
- "VNCMD",
29
- "INCMD",
30
- "ewt",
31
- "EWT",
32
- "JMD",
33
- "Moving_Decomp",
34
- "data",
35
- "entropy",
36
- "hht",
37
- "plot",
38
- "tsa",
39
- "utils",
40
- "__version__",
41
- ]
5
+ __version__ = "0.4.19"
42
6
 
43
7
  # Empirical Mode Decomposition
44
8
  from ._emd import EMD
@@ -79,16 +43,16 @@ from ._lmd import LMD
79
43
  # Robust Local Mean Decomposition
80
44
  from ._lmd import RLMD
81
45
 
82
- # Singular Spectral Analysis (SSA) algorithm
46
+ # Singular Spectral Analysis
83
47
  from ._ssa import SSA
84
48
 
85
- # Variational mode decomposition
49
+ # Variational Mode Decomposition
86
50
  from ._vmd import vmd, VMD
87
51
 
88
52
  # Adaptive Chirp Mode Decomposition
89
53
  from ._vmd import ACMD
90
54
 
91
- # Multivariate Variational mode decomposition
55
+ # Multivariate Variational Mode Decomposition
92
56
  from ._vmd import MVMD
93
57
 
94
58
  # Variational Mode Extraction, to extract a specific mode from the signal
@@ -103,7 +67,7 @@ from ._vmd2d import CVMD2D
103
67
  # Variational Nonlinear Chirp Mode Decomposition
104
68
  from ._vncmd import VNCMD
105
69
 
106
- # Iterative nonlinear chirp mode decomposition
70
+ # Iterative Nonlinear Chirp Mode Decomposition
107
71
  from ._vncmd import INCMD
108
72
 
109
73
  # Empirical Wavelet Transform
@@ -112,9 +76,12 @@ from ._ewt import ewt, EWT
112
76
  # Jump Plus AM-FM Mode Decomposition
113
77
  from ._jmd import JMD
114
78
 
115
- # Moving Average decomposition
79
+ # Moving Average Decomposition
116
80
  from .tsa import Moving_Decomp
117
81
 
82
+ # Hilbert-Huang Transform
83
+ from ._emd import HHT
84
+
118
85
 
119
86
  def greet():
120
87
  print(
@@ -130,3 +97,80 @@ A Python library for signal decomposition algorithms.
130
97
  https://github.com/wwhenxuan/PySDKit
131
98
  """
132
99
  )
100
+
101
+
102
+ def print_functions():
103
+ """"""
104
+ print(
105
+ """
106
+ _______________________________________________________________
107
+ Algorithm Name | Abbreviation
108
+ _______________________________________________________________
109
+ Empirical Mode Decomposition | EMD
110
+ Ensemble Empirical Mode Decomposition | EEMD
111
+ Complete Ensemble EMD with Adaptive Noise | CEEMDAN
112
+ Robust Empirical Mode Decomposition | REMD
113
+ Multivariate Empirical Mode Decomposition | MEMD
114
+ Time Varying Filter based EMD | TVF_EMD
115
+ Empirical Fourier Decomposition | EFD
116
+ Fast and Adaptive Empirical Mode Decomposition | FAEMD
117
+ Empirical Mode Decomposition 2D for images | EMD2D
118
+ Hilbert Vibration Decomposition | HVD
119
+ Intrinsic Time-Scale Decomposition | ITD
120
+ Local Mean Decomposition | LMD
121
+ Robust Local Mean Decomposition | RLMD
122
+ Singular Spectral Analysis | SSA
123
+ Variational Mode Decomposition | VMD
124
+ Multivariate Variational Mode Decomposition | MVMD
125
+ Variational Mode Extraction | VME
126
+ Variational Mode Decomposition for 2D Image | VMD2D
127
+ Compact VMD for 2D Image | CVMD2D
128
+ Variational Nonlinear Chirp Mode Decomposition | VNCMD
129
+ Iterative Nonlinear Chirp Mode Decomposition | INCMD
130
+ Empirical Wavelet Transform | EWT
131
+ Jump Plus AM-FM Mode Decomposition | JMD
132
+ Moving Average Decomposition | Moving
133
+ Hilbert-Huang Transform | HHT
134
+ _______________________________________________________________
135
+ """
136
+ )
137
+
138
+
139
+ __all__ = [
140
+ "EMD",
141
+ "EEMD",
142
+ "CEEMDAN",
143
+ "REMD",
144
+ "MEMD",
145
+ "TVF_EMD",
146
+ "EFD",
147
+ "FAEMD",
148
+ "EMD2D",
149
+ "HVD",
150
+ "ITD",
151
+ "LMD",
152
+ "RLMD",
153
+ "SSA",
154
+ "vmd",
155
+ "VMD",
156
+ "ACMD",
157
+ "MVMD",
158
+ "VME",
159
+ "VMD2D",
160
+ "CVMD2D",
161
+ "VNCMD",
162
+ "INCMD",
163
+ "ewt",
164
+ "EWT",
165
+ "JMD",
166
+ "Moving_Decomp",
167
+ "data",
168
+ "entropy",
169
+ "HHT",
170
+ "plot",
171
+ "tsa",
172
+ "utils",
173
+ "greet",
174
+ "print_functions",
175
+ "__version__",
176
+ ]
@@ -23,3 +23,5 @@ from .memd import MEMD
23
23
  from .tvf_emd import TVF_EMD
24
24
 
25
25
  from .efd import EFD
26
+
27
+ from .hht import HHT
@@ -71,24 +71,24 @@ class CEEMDAN(object):
71
71
  :param max_iter: maximum number of decomposition iterations
72
72
  :param random_seed: create a random seed for the random number generator
73
73
  """
74
- # EMD算法的固定配置
74
+ # Fixed configuration of the EMD algorithm
75
75
  self.max_imfs = max_imfs
76
76
  self.trials = trials
77
77
  self.epsilon = epsilon
78
78
  self.max_iter = max_iter
79
79
 
80
- # 与多进程相关的配置参数
80
+ # Configuration parameters related to multi-process
81
81
  self.parallel = parallel
82
82
  self.processes = processes
83
83
 
84
- # 创建噪声的参数
84
+ # Parameters for creating noise
85
85
  self.noise_scale = noise_scale
86
86
  self.noise_kind = noise_kind
87
87
  self.noise_list = ["normal", "uniform"]
88
- # 是否对分解的噪声进行标准化
88
+ # Whether to normalize the decomposed noise
89
89
  self.beta_progress = beta_progress
90
90
 
91
- # 与算法停止有关的阈值
91
+ # Thresholds related to algorithm stopping
92
92
  self.range_thr = range_thr
93
93
  self.total_power_thr = total_power_thr
94
94
 
@@ -99,16 +99,17 @@ class CEEMDAN(object):
99
99
  else ext_EMD
100
100
  )
101
101
 
102
- # 创建随机数生成器
102
+ # Creating a random number generator
103
+ self.random_seed = random_seed
103
104
  self.rng = np.random.RandomState(seed=random_seed)
104
105
 
105
- # 生成的噪声序列
106
+ # Generated noise sequence
106
107
  self.all_noises = None
107
108
 
108
- # 存放用于分解的噪声的列表
109
+ # List of noises to be decomposed
109
110
  self.all_noise_EMD = []
110
111
 
111
- # 记录本次算法分解的结果
112
+ # Record the results of this algorithm decomposition
112
113
  self.imfs = None
113
114
  self.residue = None
114
115
 
@@ -119,7 +120,7 @@ class CEEMDAN(object):
119
120
  self,
120
121
  signal: np.ndarray,
121
122
  time: Optional[np.ndarray] = None,
122
- max_imfs: Optional[int] = -1,
123
+ max_imfs: Optional[int] = None,
123
124
  progress: bool = False,
124
125
  ) -> np.ndarray:
125
126
  """allow instances to be called like functions"""
@@ -131,7 +132,13 @@ class CEEMDAN(object):
131
132
  """Get the full name and abbreviation of the algorithm"""
132
133
  return "Complete Ensemble Empirical Mode Decomposition with Adaptive Noise (CEEMDAN)"
133
134
 
134
- def generate_noise(
135
+ def update_random_seed(self, random_seed: int) -> None:
136
+ """Update the random seed for random number generator to generate noise"""
137
+ self.random_seed = random_seed
138
+ # Create the random state generate
139
+ self.rng = np.random.RandomState(seed=random_seed)
140
+
141
+ def _generate_noise(
135
142
  self, scale: float, size: Union[int, Sequence[int]]
136
143
  ) -> np.ndarray:
137
144
  """
@@ -177,7 +184,7 @@ class CEEMDAN(object):
177
184
  self,
178
185
  signal: np.ndarray,
179
186
  time: Optional[np.ndarray] = None,
180
- max_imfs: Optional[int] = -1,
187
+ max_imfs: Optional[int] = None,
181
188
  progress: Optional[bool] = True,
182
189
  ) -> np.ndarray:
183
190
  """Perform the specified EEMD algorithm to obtain the corresponding signal decomposition results."""
@@ -231,20 +238,26 @@ class CEEMDAN(object):
231
238
  noise = self.epsilon * self.all_noise_EMD[trial][0]
232
239
 
233
240
  # Return the result of a single EMD execution
234
- return self.emd(self._signal + noise, self._time, self.max_imfs)
241
+ return self._run_emd(self._signal + noise, self._time, self.max_imfs)
235
242
 
236
- def emd(
243
+ def _run_emd(
237
244
  self,
238
245
  signal: np.ndarray,
239
246
  time: Optional[np.ndarray] = None,
240
- max_imfs: Optional[int] = -1,
247
+ max_imfs: Optional[int] = None,
241
248
  ) -> np.ndarray:
242
249
  """
243
- Vanilla Empirical Mode Decomposition method
250
+ Vanilla Empirical Mode Decomposition method.
244
251
 
245
- Perform the specified EMD algorithm to obtain the corresponding signal decomposition results.
252
+ :param signal: the input 1D ndarray signal.
253
+ :param time: the time array.
254
+ :param max_imfs: the maximum number of IMFs to be decomposed.
255
+ :return: the decomposed IMFs of the input signal.
246
256
  """
247
- return self.EMD.fit_transform(signal=signal, time=time, max_imfs=max_imfs)
257
+ # Perform the specified EMD algorithm to obtain the corresponding signal decomposition results.
258
+ imfs = self.EMD.fit_transform(signal=signal, time=time, max_imfs=max_imfs)
259
+
260
+ return imfs
248
261
 
249
262
  def get_imfs_and_residue(self) -> Tuple[np.ndarray, np.ndarray]:
250
263
  """
@@ -277,6 +290,7 @@ class CEEMDAN(object):
277
290
 
278
291
  # Get the intrinsic mode function and residual respectively
279
292
  imfs, residue = self.get_imfs_and_residue()
293
+
280
294
  if np.allclose(residue, 0):
281
295
  return imfs[:-1].copy(), imfs[-1].copy()
282
296
  else:
@@ -304,12 +318,13 @@ class CEEMDAN(object):
304
318
 
305
319
  # Compute the Empirical Mode Decomposition (EMD) for the residue
306
320
  R = signal - np.sum(cIMFs, axis=0)
307
- _test_imfs = self.emd(signal=R, time=None, max_imfs=1)
308
-
309
- # Check if the residue is an IMF or has no extrema
310
- if _test_imfs.shape[0] == 1:
311
- print("Not enough extrema")
312
- return True
321
+ # _test_imfs = self._emd(signal=R, time=None, max_imfs=2)
322
+ # print("test imfs", _test_imfs.shape)
323
+ #
324
+ # # Check if the residue is an IMF or has no extrema
325
+ # if _test_imfs.shape[0] == 1:
326
+ # print("Not enough extrema")
327
+ # return True
313
328
 
314
329
  # Check for range threshold
315
330
  if np.max(R) - np.min(R) < self.range_thr:
@@ -328,7 +343,7 @@ class CEEMDAN(object):
328
343
  self,
329
344
  signal: np.ndarray,
330
345
  time: Optional[np.ndarray] = None,
331
- max_imfs: Optional[int] = -1,
346
+ max_imfs: Optional[int] = None,
332
347
  progress: bool = False,
333
348
  ) -> np.ndarray:
334
349
  """
@@ -344,11 +359,12 @@ class CEEMDAN(object):
344
359
  scale_s = np.std(signal)
345
360
  signal = signal / scale_s
346
361
 
347
- if max_imfs is not None:
348
- self.max_imfs = max_imfs
362
+ # Begin executing the specific decomposition algorithm
363
+ max_imfs = self.max_imfs if max_imfs is None else max_imfs
364
+ total = (max_imfs - 1) if max_imfs != -1 else None
349
365
 
350
366
  # Define the noise sequences to be added
351
- self.all_noises = self.generate_noise(
367
+ self.all_noises = self._generate_noise(
352
368
  self.noise_scale, size=(self.trials, signal.size)
353
369
  )
354
370
 
@@ -357,13 +373,10 @@ class CEEMDAN(object):
357
373
 
358
374
  # Create the first IMF
359
375
  last_imf = self._run_eemd(signal, time, max_imfs=1, progress=progress)[0]
360
- res = np.empty(signal.size)
361
376
 
362
377
  all_cimfs = last_imf.reshape((-1, last_imf.size))
363
378
  prev_res = signal - last_imf
364
379
 
365
- # Begin executing the specific decomposition algorithm
366
- total = (max_imfs - 1) if max_imfs != -1 else None
367
380
  # Create an iterator object for signal decomposition
368
381
  it = (
369
382
  iter
@@ -372,8 +385,7 @@ class CEEMDAN(object):
372
385
  )
373
386
 
374
387
  # Begin the algorithm's iteration
375
- for _ in it(range(self.max_imfs)):
376
-
388
+ for _ in it(range(max_imfs - 1)):
377
389
  # Number of IMFs currently decomposed
378
390
  imf_number = all_cimfs.shape[0]
379
391
 
@@ -385,31 +397,35 @@ class CEEMDAN(object):
385
397
  # Skip if noise[trial] didn't have k'th mode
386
398
  noise_imf = self.all_noise_EMD[trial]
387
399
  res = prev_res.copy()
400
+
401
+ # add noise for every imf to be decomposed.
388
402
  if len(noise_imf) > imf_number:
389
403
  res += beta * noise_imf[imf_number]
390
404
 
391
405
  # Extract the local mean, which is at the 2nd position
392
- imfs = self.emd(res, time, max_imfs=1)
406
+ imfs = self._run_emd(res, time, max_imfs=1)
393
407
  local_mean += imfs[-1] / self.trials
394
408
 
395
409
  # Record the results of this decomposition
396
410
  last_imf = prev_res - local_mean
411
+ # vstack the new imf
397
412
  all_cimfs = np.vstack((all_cimfs, last_imf))
398
413
  prev_res = local_mean.copy()
399
414
 
400
415
  # Determine whether the decomposition algorithm should stop iterating
401
- if self.end_condition(
402
- signal=signal, cIMFs=all_cimfs, max_imf=self.max_imfs
403
- ):
416
+ if self.end_condition(signal=signal, cIMFs=all_cimfs, max_imf=max_imfs):
404
417
  # Reached the stopping condition
405
- print("End Decomposition")
418
+ # print("End Decomposition")
406
419
  break
407
420
 
408
421
  # Clear all IMF noise
422
+ # The noise will be initialized for the new input signal
409
423
  del self.all_noise_EMD[:]
410
424
 
411
425
  # Record the results of this decomposition
412
426
  self.imfs = all_cimfs
427
+
428
+ # Calculate the remaining residual components
413
429
  self.residue = signal * scale_s - np.sum(self.imfs, axis=0)
414
430
 
415
431
  return all_cimfs
@@ -89,7 +89,7 @@ class EFD(object):
89
89
  imfs = np.zeros(shape=(number, len(signal)))
90
90
 
91
91
  # The results are stored in the frequency domain
92
- ft = np.zeros([number, len(ff)])
92
+ ft = np.zeros([number, len(ff)], dtype=complex)
93
93
 
94
94
  # We define an ideal functions and extract components
95
95
  for k in range(0, number):
@@ -510,7 +510,8 @@ class EMD(object):
510
510
  if f1 and f2:
511
511
  break
512
512
 
513
- else: # Less than 2 ext, i.e. trend
513
+ else:
514
+ # Less than 2 ext, i.e. trend
514
515
  finished = True
515
516
  break
516
517
 
@@ -535,3 +536,17 @@ class EMD(object):
535
536
  IMF = np.vstack((IMF, self.residue))
536
537
 
537
538
  return IMF
539
+
540
+
541
+ if __name__ == "__main__":
542
+ from pysdkit.data import test_hht, test_univariate_signal
543
+ from matplotlib import pyplot as plt
544
+ from pysdkit.plot import plot_IMFs
545
+
546
+ time, signal = test_univariate_signal(case=1)
547
+ emd = EMD(max_imfs=5)
548
+ imfs = emd.fit_transform(signal, max_imfs=6)
549
+ print(imfs.shape)
550
+
551
+ plot_IMFs(signal, imfs)
552
+ plt.show()
@@ -4,3 +4,4 @@ Created on 2025/02/06 10:28:59
4
4
  @author: Whenxuan Wang
5
5
  @email: wwhenxuan@gmail.com
6
6
  """
7
+ from .hht import HHT
@@ -0,0 +1,105 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Created on 2025/02/06 10:30:01
4
+ @author: Whenxuan Wang
5
+ @email: wwhenxuan@gmail.com
6
+ Hilbert-transform for demodulation
7
+ """
8
+ import numpy as np
9
+ from pysdkit.utils import fft, ifft
10
+
11
+
12
+ def hilbert(signal: np.ndarray) -> np.ndarray:
13
+ """
14
+ Perform Hilbert transform along the last axis of input signal.
15
+
16
+ :param signal: The Hilbert transform is performed along last dimension.
17
+
18
+ :return: A complex tensor with the same shape of the input signal, representing its analytic signal.
19
+ """
20
+ signal = np.asarray(signal, dtype=np.float64)
21
+
22
+ # Get the length of input signal
23
+ N = signal.shape[-1]
24
+
25
+ # Perform a Fast Fourier Transform
26
+ Xf = fft(signal)
27
+
28
+ # Get the spectrum of the analytical signal
29
+ if N % 2 == 0:
30
+ Xf[..., 1 : N // 2] *= 2
31
+ Xf[..., N // 2 + 1 :] = 0
32
+ else:
33
+ Xf[..., 1 : (N + 1) // 2] *= 2
34
+ Xf[..., (N + 1) // 2 :] = 0
35
+ return ifft(Xf)
36
+
37
+
38
+ def get_envelope_frequency(signal: np.ndarray, fs: float, ret_analytic: bool = False):
39
+ """
40
+ Compute the envelope and instantaneous frequency function of the given signal using Hilbert transform.
41
+ The transformation is done along the last axis.
42
+
43
+ Parameters:
44
+ -------------
45
+ x : array_like
46
+ Signal data. The last dimension of `x` is considered the temporal dimension.
47
+ fs : float
48
+ Sampling frequency in Hz.
49
+ ret_analytic : bool, optional
50
+ Whether to return the analytic signal. (Default: False)
51
+
52
+ Returns:
53
+ -------------
54
+ (envelope, freq) if `ret_analytic` is False
55
+ (envelope, freq, analytic) if `ret_analytic` is True
56
+
57
+ envelope : ndarray
58
+ The envelope function with the same shape as `x`.
59
+ freq : ndarray
60
+ The instantaneous frequency function in Hz with the same shape as `x`.
61
+ analytic : ndarray
62
+ The analytic (complex) signal with the same shape as `x`.
63
+ :param signal: Signal data. The last dimension is considered the temporal dimension.
64
+ :param fs: Sampling frequency in Hz.
65
+ :param ret_analytic: Whether to return the analytic signal. (Default: False)
66
+
67
+ :return: (envelope, freq) if `ret_analytic` is False
68
+ (envelope, freq, analytic) if `ret_analytic` is True
69
+ - envelope : ndarray, the envelope function with the same shape as `x`.
70
+ freq : ndarray
71
+ The instantaneous frequency function in Hz with the same shape as `x`.
72
+ analytic : ndarray
73
+ The analytic (complex) signal with the same shape as `x`.
74
+ """
75
+ signal = np.asarray(signal, dtype=np.float64)
76
+ analytic = hilbert(signal) # Scipy's hilbert returns analytic signal
77
+
78
+ envelope = np.abs(analytic)
79
+
80
+ # Compute sub (discrete derivative with edge extension)
81
+ sub = np.empty_like(analytic)
82
+ diff = np.diff(analytic, axis=-1)
83
+ sub[..., :-1] = diff
84
+ # Handle last element (repeat last difference)
85
+ sub[..., -1] = (
86
+ analytic[..., -1] - analytic[..., -2] if analytic.shape[-1] >= 2 else 0.0
87
+ )
88
+
89
+ # Compute add (discrete sum with edge extension)
90
+ add = np.empty_like(analytic)
91
+ summed = analytic[..., 1:] + analytic[..., :-1]
92
+ add[..., :-1] = summed
93
+ # Handle last element (2 * last value)
94
+ add[..., -1] = 2 * analytic[..., -1]
95
+
96
+ # Calculate instantaneous frequency (handle division safely)
97
+ with np.errstate(divide="ignore", invalid="ignore"):
98
+ freq = 2 * fs * np.imag(sub / add)
99
+ freq[np.isinf(freq)] = 0 # Replace infs
100
+ freq /= 2 * np.pi # Convert to Hz
101
+
102
+ if ret_analytic:
103
+ return envelope, freq, analytic
104
+ else:
105
+ return envelope, freq