Skip to content

Commit

Permalink
163 update missing type (#164)
Browse files Browse the repository at this point in the history
* feat: support numpy 2+

* fix: lints

* fix: support for Python3.8

* fix: type fix for numpy2
  • Loading branch information
laszukdawid authored Sep 8, 2024
1 parent ec9715e commit 2bd11be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
3 changes: 2 additions & 1 deletion PyEMD/EMD_matlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from scipy.interpolate import interp1d

from PyEMD.splines import akima
from PyEMD.utils import deduce_common_type


class EMD:
Expand Down Expand Up @@ -429,7 +430,7 @@ def stop_sifting(self, imf, envMax, envMin, mean, extNo):

@staticmethod
def _common_dtype(x, y):
dtype = np.find_common_type([x.dtype, y.dtype], [])
dtype = deduce_common_type([x.dtype, y.dtype], [])
if x.dtype != dtype:
x = x.astype(dtype)
if y.dtype != dtype:
Expand Down
15 changes: 3 additions & 12 deletions PyEMD/experimental/jitemd.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
from numba.types import float64, int64, unicode_type
from scipy.interpolate import Akima1DInterpolator, interp1d

from PyEMD.utils import deduce_common_type

FindExtremaOutput = Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]


Expand Down Expand Up @@ -758,17 +760,6 @@ def check_imf(
return False


# @nb.jit
def _common_dtype(x: np.ndarray, y: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
"""Casts inputs (x, y) into a common numpy DTYPE."""
dtype = np.find_common_type([x.dtype, y.dtype], [])
if x.dtype != dtype:
x = x.astype(dtype)
if y.dtype != dtype:
y = y.astype(dtype)
return x, y


@nb.jit
def _normalize_time(t: np.ndarray) -> np.ndarray:
"""
Expand Down Expand Up @@ -811,7 +802,7 @@ def emd(
# T = _normalize_time(T)

# Make sure same types are dealt
# S, T = _common_dtype(S, T)
# S, T = deduce_common_Types(S, T)
MAX_ITERATION = config["MAX_ITERATION"]
FIXE = config["FIXE"]
FIXE_H = config["FIXE_H"]
Expand Down

0 comments on commit 2bd11be

Please sign in to comment.