PySDKit 0.4.21__tar.gz → 0.4.22__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 (141) hide show
  1. {pysdkit-0.4.21 → pysdkit-0.4.22}/PKG-INFO +3 -5
  2. {pysdkit-0.4.21 → pysdkit-0.4.22}/PySDKit.egg-info/PKG-INFO +3 -5
  3. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/__init__.py +1 -1
  4. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd/efd.py +3 -3
  5. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd/emd.py +2 -2
  6. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd/hht/hht.py +5 -5
  7. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd/memd.py +6 -8
  8. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd/remd.py +14 -8
  9. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd/tvf_emd.py +3 -3
  10. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd2d/emd2d.py +0 -1
  11. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_esmd/esmd.py +0 -1
  12. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_ewt/ewt.py +6 -6
  13. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_faemd/extrema.py +4 -5
  14. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_faemd/faemd.py +2 -3
  15. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_hvd/hvd.py +3 -3
  16. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_jmd/jmd.py +6 -4
  17. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_lmd/rlmd.py +14 -10
  18. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vmd/base.py +3 -3
  19. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vmd/mvmd.py +2 -3
  20. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vmd/svmd.py +2 -2
  21. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vmd/vmd_c.py +2 -2
  22. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vmd/vme.py +2 -2
  23. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vmd2d/cvmd2d.py +14 -6
  24. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vmd2d/vmd2d.py +3 -3
  25. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vncmd/incmd.py +3 -3
  26. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/data/_image.py +2 -2
  27. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/data/_test_univariate.py +14 -4
  28. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/entropy/_permutation_entropy.py +0 -1
  29. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/plot/_fourier_spectra.py +2 -2
  30. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/models/test_knn.py +2 -6
  31. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/models/test_pca.py +2 -6
  32. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/test_ewt.py +3 -9
  33. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/test_faemd.py +4 -12
  34. pysdkit-0.4.22/pysdkit/tests/test_faemd2d.py +11 -0
  35. pysdkit-0.4.22/pysdkit/tests/test_faemd3d.py +11 -0
  36. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/test_moving_decomp.py +2 -6
  37. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/test_vmd2d.py +4 -12
  38. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/utils/_function.py +2 -3
  39. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/utils/_kernel_matrix.py +4 -5
  40. {pysdkit-0.4.21 → pysdkit-0.4.22}/setup.py +3 -5
  41. pysdkit-0.4.21/pysdkit/tests/test_faemd2d.py +0 -10
  42. pysdkit-0.4.21/pysdkit/tests/test_faemd3d.py +0 -10
  43. {pysdkit-0.4.21 → pysdkit-0.4.22}/LICENSE +0 -0
  44. {pysdkit-0.4.21 → pysdkit-0.4.22}/PySDKit.egg-info/SOURCES.txt +0 -0
  45. {pysdkit-0.4.21 → pysdkit-0.4.22}/PySDKit.egg-info/dependency_links.txt +0 -0
  46. {pysdkit-0.4.21 → pysdkit-0.4.22}/PySDKit.egg-info/requires.txt +0 -0
  47. {pysdkit-0.4.21 → pysdkit-0.4.22}/PySDKit.egg-info/top_level.txt +0 -0
  48. {pysdkit-0.4.21 → pysdkit-0.4.22}/README.md +0 -0
  49. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd/__init__.py +0 -0
  50. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd/_find_extrema.py +0 -0
  51. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd/_prepare_points.py +0 -0
  52. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd/_splines.py +0 -0
  53. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd/ceemdan.py +0 -0
  54. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd/eemd.py +0 -0
  55. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd/hht/__init__.py +0 -0
  56. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd/hht/frequency.py +0 -0
  57. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd2d/__init__.py +0 -0
  58. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd2d/bemd.py +0 -0
  59. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_emd2d/bmemd.py +0 -0
  60. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_esmd/__init__.py +0 -0
  61. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_ewt/__init__.py +0 -0
  62. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_ewt/ewt2d.py +0 -0
  63. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_faemd/__init__.py +0 -0
  64. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_faemd/faemd2d.py +0 -0
  65. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_faemd/faemd3d.py +0 -0
  66. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_faemd/filter.py +0 -0
  67. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_fmd/__init__.py +0 -0
  68. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_fmd/fmd.py +0 -0
  69. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_fmd/nfmd.py +0 -0
  70. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_hvd/__init__.py +0 -0
  71. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_ifd/__init__.py +0 -0
  72. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_itd/__init__.py +0 -0
  73. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_itd/itd.py +0 -0
  74. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_jmd/__init__.py +0 -0
  75. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_jmd/mjmd.py +0 -0
  76. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_lmd/__init__.py +0 -0
  77. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_lmd/lmd.py +0 -0
  78. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_osd/__init__.py +0 -0
  79. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_ssa/__init__.py +0 -0
  80. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_ssa/ssa.py +0 -0
  81. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vmd/__init__.py +0 -0
  82. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vmd/acmd.py +0 -0
  83. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vmd/avmd.py +0 -0
  84. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vmd/ba_acmd.py +0 -0
  85. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vmd/vmd_f.py +0 -0
  86. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vmd2d/__init__.py +0 -0
  87. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vncmd/__init__.py +0 -0
  88. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vncmd/avncmd.py +0 -0
  89. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vncmd/mncmd.py +0 -0
  90. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/_vncmd/vncmd.py +0 -0
  91. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/data/__init__.py +0 -0
  92. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/data/_add_noise.py +0 -0
  93. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/data/_cube.py +0 -0
  94. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/data/_generator.py +0 -0
  95. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/data/_models.py +0 -0
  96. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/data/_time_series.py +0 -0
  97. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/data/texture.txt +0 -0
  98. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/entropy/__init__.py +0 -0
  99. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/entropy/_approxiamte_entropy.py +0 -0
  100. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/entropy/_sample_entropy.py +0 -0
  101. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/models/__init__.py +0 -0
  102. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/models/_base.py +0 -0
  103. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/models/_kmeans.py +0 -0
  104. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/models/_knn.py +0 -0
  105. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/models/_pca.py +0 -0
  106. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/plot/__init__.py +0 -0
  107. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/plot/_functions.py +0 -0
  108. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/plot/_plot_images.py +0 -0
  109. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/plot/_plot_imfs.py +0 -0
  110. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/plot/_plot_signal.py +0 -0
  111. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/__init__.py +0 -0
  112. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/data/__init__.py +0 -0
  113. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/data/test_generator_cube.py +0 -0
  114. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/data/test_generator_image.py +0 -0
  115. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/data/test_generator_signal.py +0 -0
  116. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/data/test_generator_univariate_signal.py +0 -0
  117. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/models/__init__.py +0 -0
  118. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/test_all.py +0 -0
  119. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/test_ceemdan.py +0 -0
  120. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/test_emd.py +0 -0
  121. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/test_lmd.py +0 -0
  122. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/test_rlmd.py +0 -0
  123. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/test_stl.py +0 -0
  124. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tests/test_vmd.py +0 -0
  125. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tsa/__init__.py +0 -0
  126. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tsa/_dtw.py +0 -0
  127. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tsa/_moving_decomp.py +0 -0
  128. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tsa/_mstl.py +0 -0
  129. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/tsa/_stl.py +0 -0
  130. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/utils/__init__.py +0 -0
  131. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/utils/_cite.py +0 -0
  132. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/utils/_correlation.py +0 -0
  133. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/utils/_diagnalization.py +0 -0
  134. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/utils/_differ.py +0 -0
  135. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/utils/_fft.py +0 -0
  136. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/utils/_hilbert.py +0 -0
  137. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/utils/_instantaneous.py +0 -0
  138. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/utils/_mirror.py +0 -0
  139. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/utils/_process.py +0 -0
  140. {pysdkit-0.4.21 → pysdkit-0.4.22}/pysdkit/utils/_smooth1d.py +0 -0
  141. {pysdkit-0.4.21 → pysdkit-0.4.22}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PySDKit
3
- Version: 0.4.21
3
+ Version: 0.4.22
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, changewam, josefinez, Yuan Feng
@@ -11,13 +11,11 @@ Classifier: Intended Audience :: Science/Research
11
11
  Classifier: Topic :: Scientific/Engineering :: Mathematics
12
12
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
13
13
  Classifier: License :: OSI Approved :: MIT License
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.6
16
- Classifier: Programming Language :: Python :: 3.7
17
14
  Classifier: Programming Language :: Python :: 3.8
18
15
  Classifier: Programming Language :: Python :: 3.9
19
16
  Classifier: Programming Language :: Python :: 3.10
20
- Requires-Python: >=3.6
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Requires-Python: >=3.8
21
19
  Description-Content-Type: text/markdown
22
20
  License-File: LICENSE
23
21
  Requires-Dist: numpy>=1.24.3
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PySDKit
3
- Version: 0.4.21
3
+ Version: 0.4.22
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, changewam, josefinez, Yuan Feng
@@ -11,13 +11,11 @@ Classifier: Intended Audience :: Science/Research
11
11
  Classifier: Topic :: Scientific/Engineering :: Mathematics
12
12
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
13
13
  Classifier: License :: OSI Approved :: MIT License
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.6
16
- Classifier: Programming Language :: Python :: 3.7
17
14
  Classifier: Programming Language :: Python :: 3.8
18
15
  Classifier: Programming Language :: Python :: 3.9
19
16
  Classifier: Programming Language :: Python :: 3.10
20
- Requires-Python: >=3.6
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Requires-Python: >=3.8
21
19
  Description-Content-Type: text/markdown
22
20
  License-File: LICENSE
23
21
  Requires-Dist: numpy>=1.24.3
@@ -2,7 +2,7 @@
2
2
  A Python library for signal decomposition algorithms.
3
3
  """
4
4
 
5
- __version__ = "0.4.21"
5
+ __version__ = "0.4.22"
6
6
 
7
7
  # Empirical Mode Decomposition
8
8
  from ._emd import EMD
@@ -6,7 +6,7 @@ Created on 2025/04/16 22:51:55
6
6
  """
7
7
  import numpy as np
8
8
 
9
- from typing import Optional, Tuple
9
+ from typing import Optional, Tuple, Union
10
10
 
11
11
  from pysdkit.utils import fft, ifft, fmirror
12
12
 
@@ -33,7 +33,7 @@ class EFD(object):
33
33
 
34
34
  def __call__(
35
35
  self, signal: np.ndarray, return_all: Optional[bool] = False
36
- ) -> np.ndarray | Tuple[np.ndarray, float]:
36
+ ) -> Union[np.ndarray, Tuple[np.ndarray, float]]:
37
37
  """allow instances to be called like functions"""
38
38
  return self.fit_transform(signal=signal, return_all=return_all)
39
39
 
@@ -43,7 +43,7 @@ class EFD(object):
43
43
 
44
44
  def fit_transform(
45
45
  self, signal: np.ndarray, return_all: Optional[bool] = False
46
- ) -> np.ndarray | Tuple[np.ndarray, float]:
46
+ ) -> Union[np.ndarray, Tuple[np.ndarray, float]]:
47
47
  """
48
48
  Signal decomposition using EFD algorithm
49
49
 
@@ -9,7 +9,7 @@ Code taken from https://github.com/laszukdawid/PyEMD/blob/master/PyEMD/EMD.py
9
9
  import numpy as np
10
10
  from numpy import ndarray
11
11
  from scipy.interpolate import interp1d
12
- from typing import Optional, Tuple
12
+ from typing import Optional, Tuple, Union
13
13
 
14
14
  from pysdkit._emd import akima, cubic, pchip, cubic_hermite, cubic_spline_3pts
15
15
  from pysdkit._emd import find_extrema_parabol, find_extrema_simple
@@ -231,7 +231,7 @@ class EMD(object):
231
231
 
232
232
  def extract_max_min_spline(
233
233
  self, time: np.ndarray, signal: np.ndarray
234
- ) -> list[int] | tuple[ndarray, ndarray, ndarray, ndarray]:
234
+ ) -> Union[list[int], tuple[ndarray, ndarray, ndarray, ndarray]]:
235
235
  """
236
236
  Extracts top and bottom envelopes based on the signal,
237
237
  which are constructed based on maxima and minima, respectively.
@@ -7,7 +7,7 @@ Created on 2025/02/06 10:29:05
7
7
  import numpy as np
8
8
  from matplotlib import pyplot as plt
9
9
 
10
- from typing import Optional, Tuple, Any
10
+ from typing import Optional, Tuple, Any, Union
11
11
 
12
12
  from pysdkit.plot import plot_IMFs, plot_HilbertSpectrum
13
13
  from pysdkit.utils import (
@@ -47,7 +47,7 @@ class HHT(object):
47
47
  signal: np.ndarray,
48
48
  fs: Optional[float] = None,
49
49
  return_all: Optional[bool] = False,
50
- ) -> np.ndarray | Tuple[np.ndarray, np.ndarray, np.ndarray]:
50
+ ) -> Union[np.ndarray, Tuple[np.ndarray, np.ndarray, np.ndarray]]:
51
51
  """
52
52
  Perform Hilbert-Huang transform on the signal `x`, and return the amplitude and
53
53
  instantaneous frequency function of each intrinsic mode.
@@ -64,7 +64,7 @@ class HHT(object):
64
64
  """Get the full name and abbreviation of the algorithm"""
65
65
  return "Hilbert-Huang Transform (HHT)"
66
66
 
67
- def _get_emd(self) -> EMD | REMD | EEMD | CEEMDAN:
67
+ def _get_emd(self) -> Union[EMD, REMD, EEMD, CEEMDAN]:
68
68
  """选择对应的经验模态分解算法"""
69
69
  if self.algorithm == "EMD":
70
70
  return EMD(max_imfs=self.max_imfs)
@@ -107,7 +107,7 @@ class HHT(object):
107
107
  signal: np.ndarray,
108
108
  fs: Optional[float] = None,
109
109
  return_all: Optional[bool] = False,
110
- ) -> np.ndarray | Tuple[np.ndarray, np.ndarray, np.ndarray]:
110
+ ) -> Union[np.ndarray, Tuple[np.ndarray, np.ndarray, np.ndarray]]:
111
111
  """
112
112
  Perform Hilbert-Huang transform on the signal `x`, and return the amplitude and
113
113
  instantaneous frequency function of each intrinsic mode.
@@ -207,7 +207,7 @@ class HHT(object):
207
207
  freq_lim: Optional[tuple[float, float]] = None,
208
208
  freq_res: Optional[float] = None,
209
209
  time_scale: int = 1,
210
- ) -> tuple[list[Any] | Any, list[Any]] | list[Any] | Any:
210
+ ) -> Union[tuple[Union[list[Any], Any], list[Any]], list[Any], Any]:
211
211
  """
212
212
  Obtaining and visualizing the Hilbert spectrum.
213
213
 
@@ -12,7 +12,7 @@ from sys import exit
12
12
 
13
13
  from numpy import ndarray, dtype
14
14
  from scipy.interpolate import CubicSpline
15
- from typing import Optional, Tuple, Any
15
+ from typing import Optional, Tuple, Any, Union
16
16
 
17
17
 
18
18
  class MEMD(object):
@@ -121,7 +121,6 @@ class MEMD(object):
121
121
  dir_vec = np.zeros(shape=(N_dim, 1))
122
122
 
123
123
  for it in range(0, self.n_dir):
124
-
125
124
  if N_dim != 3:
126
125
  # Multivariate signal (for N_dim ~=3) with hammersley sequence
127
126
  # Linear normalisation of hammersley sequence in the range of -1.00 - 1.00
@@ -495,7 +494,6 @@ def nth_prime(n: int) -> list:
495
494
 
496
495
  # Iterate through natural numbers starting from 3
497
496
  for i in range(3, 104745): # 104745 is an arbitrary upper limit for demonstration
498
-
499
497
  # Check if the current number is prime
500
498
  if is_prime(i):
501
499
  # Append the prime number to the list
@@ -670,16 +668,16 @@ def boundary_conditions(
670
668
  x: np.ndarray,
671
669
  z: np.ndarray,
672
670
  nbsym: int,
673
- ) -> (
674
- Tuple[None, None, None, None, int]
675
- | Tuple[
671
+ ) -> Union[
672
+ Tuple[None, None, None, None, int],
673
+ Tuple[
676
674
  ndarray[Any, dtype[Any]],
677
675
  ndarray[Any, dtype[Any]],
678
676
  ndarray[Any, dtype[Any]],
679
677
  ndarray[Any, dtype[Any]],
680
678
  int,
681
- ]
682
- ):
679
+ ],
680
+ ]:
683
681
  """
684
682
  Handle boundary conditions for signal processing by extending the signal symmetrically.
685
683
 
@@ -124,13 +124,21 @@ class REMD(object):
124
124
  """
125
125
  # Get the position of the extreme point by calling the function to find the extreme point
126
126
  if self.extrema_detection == "parabol":
127
- local_max_pos, local_max_val, local_min_pos, local_min_val, indzer = (
128
- find_extrema_parabol(time=time, signal=signal)
129
- )
127
+ (
128
+ local_max_pos,
129
+ local_max_val,
130
+ local_min_pos,
131
+ local_min_val,
132
+ indzer,
133
+ ) = find_extrema_parabol(time=time, signal=signal)
130
134
  elif self.extrema_detection == "simple":
131
- local_max_pos, local_max_val, local_min_pos, local_min_val, indzer = (
132
- find_extrema_simple(time=time, signal=signal)
133
- )
135
+ (
136
+ local_max_pos,
137
+ local_max_val,
138
+ local_min_pos,
139
+ local_min_val,
140
+ indzer,
141
+ ) = find_extrema_simple(time=time, signal=signal)
134
142
  else:
135
143
  raise ValueError("`find_extrema` must be 'parabol' or 'simple'")
136
144
 
@@ -241,7 +249,6 @@ class REMD(object):
241
249
 
242
250
  # in case symmetrized parts do not extend enough
243
251
  if tl_min[0] > time[0] or tl_max[0] > time[0]:
244
-
245
252
  if lsym == indmax[0]:
246
253
  lmax = np.fliplr(indmax[: min(end_max, nbsym)])
247
254
 
@@ -254,7 +261,6 @@ class REMD(object):
254
261
  lsym = 0
255
262
 
256
263
  if tr_min[-1] < time[xlen] or tr_max[-1] < time[xlen]:
257
-
258
264
  if rsym == indmax[-1]:
259
265
  rmax = np.fliplr(indmax[max(end_max - nbsym + 1, 0) :])
260
266
 
@@ -14,7 +14,7 @@ from scipy.sparse.linalg import spsolve
14
14
  from pysdkit.utils import inst_freq_local
15
15
  from pysdkit.utils import divide2exp
16
16
 
17
- from typing import Optional, Tuple, Dict, Any, Iterable
17
+ from typing import Optional, Tuple, Dict, Any, Iterable, Union
18
18
 
19
19
  warnings.filterwarnings("ignore")
20
20
 
@@ -145,7 +145,7 @@ class TVF_EMD(object):
145
145
  bis_freq: np.ndarray,
146
146
  ind_remove_pad: np.ndarray,
147
147
  num_padding: int,
148
- ) -> None | int | float | complex | ndarray | Iterable:
148
+ ) -> Union[None, int, float, complex, ndarray, Iterable]:
149
149
  """Remove unstable parts or 'noise' from the signal based on the extrema points of the input signal and certain rules, and smooth the signal through interpolation"""
150
150
  org_bis_freq = bis_freq.copy()
151
151
  flag_intermitt = 0
@@ -528,7 +528,7 @@ def check_knots(
528
528
  return x, y, knots
529
529
 
530
530
 
531
- def spline_base(breaks: np.ndarray, n: int) -> Dict[str, int | Any | Any]:
531
+ def spline_base(breaks: np.ndarray, n: int) -> Dict[str, Union[int, Any, Any]]:
532
532
  """
533
533
  Generates B-spline base of order `n` for knots `breaks`
534
534
  This function comes from https://github.com/stfbnc/pytvfemd/tree/master
@@ -300,7 +300,6 @@ class EMD2D(object):
300
300
 
301
301
  # Make sure there are enough extreme points
302
302
  if len(min_peaks[0]) > 4 and len(max_peaks[0]) > 4:
303
-
304
303
  # Record the last input data
305
304
  imf_old = imf.copy()
306
305
 
@@ -8,6 +8,5 @@ import numpy as np
8
8
 
9
9
 
10
10
  class ESMD(object):
11
-
12
11
  def __init__(self):
13
12
  pass
@@ -13,7 +13,7 @@ Original Code from: https://github.com/vrcarva/ewtpy
13
13
  """
14
14
  import numpy as np
15
15
  from scipy.ndimage.filters import gaussian_filter
16
- from typing import Optional, Tuple
16
+ from typing import Optional, Tuple, Union
17
17
 
18
18
 
19
19
  class EWT(object):
@@ -60,7 +60,7 @@ class EWT(object):
60
60
  signal: np.ndarray,
61
61
  N: Optional[int] = None,
62
62
  return_all: Optional[bool] = False,
63
- ) -> Tuple[np.ndarray, np.ndarray, np.ndarray] | np.ndarray:
63
+ ) -> Union[Tuple[np.ndarray, np.ndarray, np.ndarray], np.ndarray]:
64
64
  """allow instances to be called like functions"""
65
65
  return self.fit_transform(signal=signal, N=N, return_all=return_all)
66
66
 
@@ -80,7 +80,7 @@ class EWT(object):
80
80
  signal: np.ndarray,
81
81
  N: Optional[int] = None,
82
82
  return_all: Optional[bool] = False,
83
- ) -> Tuple[np.ndarray, np.ndarray, np.ndarray] | np.ndarray:
83
+ ) -> Union[Tuple[np.ndarray, np.ndarray, np.ndarray], np.ndarray]:
84
84
  """
85
85
  Perform Empirical Wavelet Transform on the input signal.
86
86
 
@@ -251,9 +251,9 @@ def EWT_Boundaries_Detect(
251
251
 
252
252
  elif reg == "gaussian":
253
253
  regFilter = np.zeros(lengthFilter)
254
- regFilter[regFilter.size // 2] = (
255
- 1 # Ensure center is set for Gaussian filtering
256
- )
254
+ regFilter[
255
+ regFilter.size // 2
256
+ ] = 1 # Ensure center is set for Gaussian filtering
257
257
  presig = np.convolve(
258
258
  ff, gaussian_filter(regFilter, sigmaFilter), mode="same"
259
259
  ) # Gaussian filter
@@ -7,15 +7,14 @@ Created on 2025/02/24 13:20:36
7
7
  """
8
8
  import numpy as np
9
9
 
10
- from typing import Tuple
10
+ from typing import Tuple, Union
11
11
 
12
12
 
13
13
  def extrema(
14
14
  x: np.ndarray,
15
- ) -> (
16
- Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]
17
- | Tuple[None, None, None, None]
18
- ):
15
+ ) -> Union[
16
+ Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray], Tuple[None, None, None, None]
17
+ ]:
19
18
  """
20
19
  Gets the global extrema points from a time series
21
20
 
@@ -60,7 +60,7 @@ class FAEMD(object):
60
60
  signal: np.ndarray,
61
61
  return_all: bool = False,
62
62
  max_imfs: Optional[int] = None,
63
- ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray] | np.ndarray:
63
+ ) -> Union[Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray], np.ndarray]:
64
64
  """allow instances to be called like functions"""
65
65
  return self.fit_transform(
66
66
  signal=signal, return_all=return_all, max_imfs=max_imfs
@@ -195,7 +195,7 @@ class FAEMD(object):
195
195
  signal: np.ndarray,
196
196
  return_all: bool = False,
197
197
  max_imfs: Optional[int] = None,
198
- ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray] | np.ndarray:
198
+ ) -> Union[Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray], np.ndarray]:
199
199
  """
200
200
  Execute the signal decomposition algorithm
201
201
 
@@ -234,7 +234,6 @@ class FAEMD(object):
234
234
 
235
235
  # 开始进行信号的迭代分解
236
236
  while imf < max_imfs - 1:
237
-
238
237
  # Initialising intermediary IMFs
239
238
  H = Residue.copy()
240
239
 
@@ -6,7 +6,7 @@ Created on 2025/02/06 00:19:23
6
6
  """
7
7
  import numpy as np
8
8
 
9
- from typing import Optional, Tuple
9
+ from typing import Optional, Tuple, Union
10
10
 
11
11
  from pysdkit.utils import differ
12
12
  from pysdkit.utils import fft, ifft
@@ -57,7 +57,7 @@ class HVD(object):
57
57
 
58
58
  def __call__(
59
59
  self, signal: np.ndarray, return_all: Optional[bool] = False
60
- ) -> Tuple[np.ndarray, np.ndarray] | np.ndarray:
60
+ ) -> Union[Tuple[np.ndarray, np.ndarray], np.ndarray]:
61
61
  """allow instances to be called like functions"""
62
62
  return self.fit_transform(signal, return_all)
63
63
 
@@ -112,7 +112,7 @@ class HVD(object):
112
112
 
113
113
  def fit_transform(
114
114
  self, signal: np.ndarray, return_all: Optional[bool] = False
115
- ) -> Tuple[np.ndarray, np.ndarray] | np.ndarray:
115
+ ) -> Union[Tuple[np.ndarray, np.ndarray], np.ndarray]:
116
116
  """Start executing the Hilbert Vibration Decomposition algorithm."""
117
117
 
118
118
  # Mirror the input signal to improve decomposition at the endpoints
@@ -8,7 +8,7 @@ import numpy as np
8
8
  from numpy import linalg
9
9
  import scipy.sparse as sp
10
10
 
11
- from typing import Optional, Tuple
11
+ from typing import Optional, Tuple, Union
12
12
 
13
13
  from pysdkit.utils import fft, fftshift, ifft, ifftshift
14
14
 
@@ -69,7 +69,7 @@ class JMD(object):
69
69
 
70
70
  def __call__(
71
71
  self, signal: np.ndarray, return_all: bool = True
72
- ) -> Tuple[np.ndarray, np.ndarray, np.ndarray] | np.ndarray:
72
+ ) -> Union[Tuple[np.ndarray, np.ndarray, np.ndarray], np.ndarray]:
73
73
  """allow instances to be called like functions"""
74
74
  return self.fit_transform(signal=signal, return_all=return_all)
75
75
 
@@ -77,7 +77,9 @@ class JMD(object):
77
77
  """Get the full name and abbreviation of the algorithm"""
78
78
  return "Jump Plus AM-FM Mode Decomposition (JMD)"
79
79
 
80
- def jump_step(self, freqs: np.ndarray, T: int) -> Tuple[
80
+ def jump_step(
81
+ self, freqs: np.ndarray, T: int
82
+ ) -> Tuple[
81
83
  float,
82
84
  np.ndarray,
83
85
  np.ndarray,
@@ -194,7 +196,7 @@ class JMD(object):
194
196
 
195
197
  def fit_transform(
196
198
  self, signal: np.ndarray, return_all: Optional[bool] = False
197
- ) -> Tuple[np.ndarray, np.ndarray, np.ndarray] | np.ndarray:
199
+ ) -> Union[Tuple[np.ndarray, np.ndarray, np.ndarray], np.ndarray]:
198
200
  """
199
201
  Signal decomposition using Jump Plus AM-FM Mode Decomposition algorithm
200
202
 
@@ -6,7 +6,7 @@ Created on 2025/01/31 23:33:43
6
6
  """
7
7
  import numpy as np
8
8
 
9
- from typing import Optional, Tuple
9
+ from typing import Optional, Union, Tuple
10
10
 
11
11
 
12
12
  class RLMD(object):
@@ -86,7 +86,12 @@ class RLMD(object):
86
86
  def _initial_inputs(
87
87
  self, signal: np.ndarray
88
88
  ) -> Tuple[
89
- np.ndarray | float, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray
89
+ Union[np.ndarray, float],
90
+ np.ndarray,
91
+ np.ndarray,
92
+ np.ndarray,
93
+ np.ndarray,
94
+ np.ndarray,
90
95
  ]:
91
96
  """"""
92
97
  # get the length of inputs signal
@@ -108,7 +113,7 @@ class RLMD(object):
108
113
 
109
114
  return signal_energy, ams, fms, pfs, iterNum, fvs
110
115
 
111
- def _stop_lmd(self, signal: np.ndarray, signal_energy: np.ndarray | float) -> bool:
116
+ def _stop_lmd(self, signal: np.ndarray, signal_energy: Union[np.ndarray, float]) -> bool:
112
117
  """
113
118
  Stopping criterion of LMD algorithm.
114
119
  Check if there are enough (3) extrema to continue the decomposition
@@ -135,7 +140,7 @@ class RLMD(object):
135
140
 
136
141
  def _lmd_mean_amp(
137
142
  self, x: np.ndarray
138
- ) -> Tuple[np.ndarray, np.ndarray, np.ndarray | int]:
143
+ ) -> Tuple[np.ndarray, np.ndarray, Union[np.ndarray, int]]:
139
144
  """
140
145
  Compute mean function and amplitude function of x in LMD
141
146
 
@@ -232,7 +237,7 @@ class RLMD(object):
232
237
 
233
238
  def _get_best_span(
234
239
  self, ind_extr: np.ndarray, x: np.ndarray
235
- ) -> Tuple[np.ndarray | int, int]:
240
+ ) -> Tuple[Union[np.ndarray, int], int]:
236
241
  """
237
242
  Moving average span selection.
238
243
  Return the best span of moving average
@@ -315,7 +320,7 @@ class RLMD(object):
315
320
 
316
321
  def fit_transform(
317
322
  self, signal: np.ndarray, return_all: Optional[bool] = False
318
- ) -> np.ndarray | Tuple[np.ndarray, np.ndarray, np.ndarray]:
323
+ ) -> Union[np.ndarray, Tuple[np.ndarray, np.ndarray, np.ndarray]]:
319
324
  """
320
325
  This funcion perform the local mean decompose (LMD) on the input signal, and return the product function (pfs),
321
326
  and their corresponding instantaneous amplititde(ams) and frequency modulation signal(fms).
@@ -338,7 +343,6 @@ class RLMD(object):
338
343
  while i < self.max_imfs and not self._stop_lmd(
339
344
  signal=xs, signal_energy=signal_energy
340
345
  ):
341
-
342
346
  # initialize variables used in PF sifting loop
343
347
  a_i = np.ones(nx)
344
348
  s_j = np.zeros(shape=(self.max_iter, nx))
@@ -492,7 +496,7 @@ def extr(x: np.ndarray) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
492
496
 
493
497
 
494
498
  def extend(
495
- x: np.ndarray, indmin: np.ndarray, indmax: np.ndarray, extd_r: np.ndarray | float
499
+ x: np.ndarray, indmin: np.ndarray, indmax: np.ndarray, extd_r: Union[np.ndarray, float]
496
500
  ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
497
501
  """
498
502
  Python implementation of the MATLAB `extend` routine from the EMD toolbox.
@@ -664,7 +668,7 @@ def rms(
664
668
  *,
665
669
  keepdims: bool = False,
666
670
  omitnan: bool = False,
667
- ) -> np.ndarray | float:
671
+ ) -> Union[np.ndarray, float]:
668
672
  """
669
673
  The Python version of rms function in Matlab.
670
674
 
@@ -690,7 +694,7 @@ def kurtosis(
690
694
  axis: Optional[int] = 0,
691
695
  bias: Optional[bool] = False,
692
696
  nan_policy: Optional[str] = "propagate",
693
- ) -> np.ndarray | float:
697
+ ) -> Union[np.ndarray, float]:
694
698
  """
695
699
  Reproduce MATLAB kurtosis(x) behavior (global formula, flag=0)
696
700
 
@@ -73,9 +73,9 @@ class Base(object):
73
73
  fMirr[:, 0 : T // 2] = np.flip(
74
74
  ts[:, 0 : T // 2], axis=1
75
75
  ) # Mirror the first T//2 elements at the beginning
76
- fMirr[:, T // 2 : 3 * T // 2] = (
77
- ts # Include the original time series in the middle
78
- )
76
+ fMirr[
77
+ :, T // 2 : 3 * T // 2
78
+ ] = ts # Include the original time series in the middle
79
79
  fMirr[:, 3 * T // 2 : 2 * T] = np.flip(
80
80
  ts[:, T // 2 :], axis=1
81
81
  ) # Mirror the last T//2 elements at the end
@@ -5,7 +5,7 @@ Created on 2024/6/1 18:44
5
5
  @email: wwhenxuan@gmail.com
6
6
  """
7
7
  import numpy as np
8
- from typing import Optional, Tuple
8
+ from typing import Optional, Tuple, Union
9
9
  from .base import Base
10
10
 
11
11
 
@@ -101,7 +101,7 @@ class MVMD(Base):
101
101
 
102
102
  def fit_transform(
103
103
  self, signal: np.ndarray, return_all: bool = False
104
- ) -> Tuple[np.ndarray, np.ndarray, np.ndarray] | np.ndarray:
104
+ ) -> Union[Tuple[np.ndarray, np.ndarray, np.ndarray], np.ndarray]:
105
105
  """
106
106
  Multivariate signal decomposition using MVMD algorithm
107
107
 
@@ -179,7 +179,6 @@ class MVMD(Base):
179
179
  ) / np.sum(np.square(np.abs(u_hat_plus[n, T // 2 : T, k - 1, :])))
180
180
 
181
181
  for k in range(2, self.K + 1):
182
-
183
182
  # update mode accumulator
184
183
  sum_uk = (
185
184
  u_hat_plus[n, :, k - 2, :] + sum_uk - u_hat_plus[n - 1, :, k - 1, :]
@@ -211,7 +211,8 @@ class SVMD(Base):
211
211
  # update u_L
212
212
  u_hat_L[n + 1, :] = (
213
213
  f_hat_onesided
214
- + ((Alpha**2) * (omega_freqs - omega_L[n]) ** 4) * u_hat_L[n, :]
214
+ + ((Alpha**2) * (omega_freqs - omega_L[n]) ** 4)
215
+ * u_hat_L[n, :]
215
216
  + lambda_vector[n, :] / 2
216
217
  ) / (
217
218
  1
@@ -304,7 +305,6 @@ class SVMD(Base):
304
305
  if self.init_omega > 0:
305
306
  ii = 0
306
307
  while ii < 1 and n2 < 300:
307
-
308
308
  omega_L = np.sort(
309
309
  np.exp(
310
310
  np.log(fs) + (np.log(0.5) - np.log(fs)) * self.rng.rand()
@@ -5,7 +5,7 @@ Created on Sat Mar 4 11:59:21 2024
5
5
  @email: wwhenxuan@gmail.com
6
6
  """
7
7
  import numpy as np
8
- from typing import Optional, List, Tuple
8
+ from typing import Optional, List, Tuple, Union
9
9
 
10
10
  from .base import Base
11
11
  from pysdkit.plot import plot_IMFs
@@ -149,7 +149,7 @@ class VMD(Base):
149
149
 
150
150
  def fit_transform(
151
151
  self, signal: np.ndarray, return_all: bool = False
152
- ) -> Tuple[np.ndarray, np.ndarray, np.ndarray] | np.ndarray:
152
+ ) -> Union[Tuple[np.ndarray, np.ndarray, np.ndarray], np.ndarray]:
153
153
  """
154
154
  Signal decomposition using VMD algorithm
155
155
 
@@ -6,7 +6,7 @@ Created on 2025/04/02 22:44:18
6
6
  """
7
7
  import numpy as np
8
8
 
9
- from typing import Optional, Tuple
9
+ from typing import Optional, Union, Tuple
10
10
 
11
11
  from pysdkit.utils import fft, fftshift, ifft, ifftshift
12
12
 
@@ -63,7 +63,7 @@ class VME(object):
63
63
 
64
64
  def fit_transform(
65
65
  self, signal: np.ndarray, return_all: Optional[bool] = False
66
- ) -> np.ndarray | Tuple[np.ndarray, np.ndarray, np.ndarray]:
66
+ ) -> Union[np.ndarray, Tuple[np.ndarray, np.ndarray, np.ndarray]]:
67
67
  """
68
68
  Signal decomposition using VME algorithm
69
69