Skip to content

Commit

Permalink
lint: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
laszukdawid committed Sep 11, 2024
1 parent bdf7c0b commit 9ca0bae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion PyEMD/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_deduce_common_types(self):
self.assertEqual(deduce_common_type(np.int32, np.int16), np.int32)
self.assertEqual(deduce_common_type(np.int32, np.int32), np.int32)
self.assertEqual(deduce_common_type(np.float32, np.float64), np.float64)

def test_unify_types(self):
x = np.array([1, 2, 3], dtype=np.int16)
y = np.array([1.1, 2.2, 3.3], dtype=np.float32)
Expand Down
3 changes: 2 additions & 1 deletion PyEMD/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ def deduce_common_type(xtype: np.dtype, ytype: np.dtype) -> np.dtype:
dtype = np.promote_types(xtype, ytype)
return dtype


def unify_types(x: np.ndarray, y: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
dtype = deduce_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
return x, y

0 comments on commit 9ca0bae

Please sign in to comment.