From 5bf81efdf6b3cfee2c7668a822f0db0d7cb149a0 Mon Sep 17 00:00:00 2001
From: Florent Jaillet <florent.jaillet@lis-lab.fr>
Date: Thu, 15 Mar 2018 09:02:54 +0100
Subject: [PATCH] Removing FutureWarnings given by numpy 1.4 due to deprecated
 conversions in np.issubdtype()

---
 ltfatpy/comp/assert_sigreshape_pre.py  | 4 ++--
 ltfatpy/comp/comp_sigreshape_pre.py    | 4 ++--
 ltfatpy/comp/comp_window.py            | 2 +-
 ltfatpy/gabor/dgtreal.py               | 2 +-
 ltfatpy/gabor/gabdual.py               | 2 +-
 ltfatpy/gabor/gabtight.py              | 2 +-
 ltfatpy/gabor/idgtreal.py              | 2 +-
 ltfatpy/sigproc/normalize.py           | 2 +-
 ltfatpy/tests/datasets/read_ref_mat.py | 2 +-
 9 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/ltfatpy/comp/assert_sigreshape_pre.py b/ltfatpy/comp/assert_sigreshape_pre.py
index 1383c39..2cb2aa7 100644
--- a/ltfatpy/comp/assert_sigreshape_pre.py
+++ b/ltfatpy/comp/assert_sigreshape_pre.py
@@ -104,8 +104,8 @@ def assert_sigreshape_pre(f, L=None, dim=None):
         f = np.asarray(f)
 
 # ----Check that f type is numeric
-    if (not np.issubdtype(f.dtype, np.float) and
-       not np.issubdtype(f.dtype, np.complex) and
+    if (not np.issubdtype(f.dtype, np.floating) and
+       not np.issubdtype(f.dtype, np.complexfloating) and
        not np.issubdtype(f.dtype, np.integer)):
         raise TypeError("f data type should be numeric.")
     D = f.ndim
diff --git a/ltfatpy/comp/comp_sigreshape_pre.py b/ltfatpy/comp/comp_sigreshape_pre.py
index 39569a1..9d6a58e 100644
--- a/ltfatpy/comp/comp_sigreshape_pre.py
+++ b/ltfatpy/comp/comp_sigreshape_pre.py
@@ -75,8 +75,8 @@ def comp_sigreshape_pre(f, do_ndim):
     """
     if not isinstance(f, np.ndarray):
         raise ValueError("f should be a numpy array.")
-    elif f.size == 0 or (not np.issubdtype(f.dtype, np.float) and
-                         not np.issubdtype(f.dtype, np.complex) and
+    elif f.size == 0 or (not np.issubdtype(f.dtype, np.floating) and
+                         not np.issubdtype(f.dtype, np.complexfloating) and
                          not np.issubdtype(f.dtype, np.integer)):
         raise ValueError('The input must be non-empty numeric.')
 
diff --git a/ltfatpy/comp/comp_window.py b/ltfatpy/comp/comp_window.py
index e2b5f7f..51474d1 100644
--- a/ltfatpy/comp/comp_window.py
+++ b/ltfatpy/comp/comp_window.py
@@ -247,7 +247,7 @@ def comp_window(g, a, M, L=None):
             g = fir2long(g, int(np.ceil(g.shape[0] / M) * M))
 
         # Information to be determined post creation.
-        info['wasreal'] = np.issubdtype(g.dtype, np.float)
+        info['wasreal'] = np.issubdtype(g.dtype, np.floating)
         info['gl'] = g.shape[0]
         if L is not None and info['gl'] < L:
             info['isfir'] = True
diff --git a/ltfatpy/gabor/dgtreal.py b/ltfatpy/gabor/dgtreal.py
index ea02954..a395f06 100644
--- a/ltfatpy/gabor/dgtreal.py
+++ b/ltfatpy/gabor/dgtreal.py
@@ -178,7 +178,7 @@ def dgtreal(f, g, a, M, L=None, pt='freqinv'):
     """
     (f, gnum, _, Ls) = gabpars_from_windowsignal(f, g, a, M, L)[0:4]
 
-    if not np.issubdtype(gnum.dtype, np.float):
+    if not np.issubdtype(gnum.dtype, np.floating):
         raise ValueError('The window must be real-valued.')
 
     # verify pt
diff --git a/ltfatpy/gabor/gabdual.py b/ltfatpy/gabor/gabdual.py
index b38183c..6df3284 100644
--- a/ltfatpy/gabor/gabdual.py
+++ b/ltfatpy/gabor/gabdual.py
@@ -183,7 +183,7 @@ def gabdual(g, a, M, L=None):
         gd = comp_gabdual_long(g, a, M)*scale
 
     # post process result
-    if np.issubdtype(g.dtype, np.float):
+    if np.issubdtype(g.dtype, np.floating):
         # If g is real then the output is known to be real.
         gd = gd.real
 
diff --git a/ltfatpy/gabor/gabtight.py b/ltfatpy/gabor/gabtight.py
index b89f683..595ed66 100644
--- a/ltfatpy/gabor/gabtight.py
+++ b/ltfatpy/gabor/gabtight.py
@@ -191,7 +191,7 @@ def gabtight(g, a, M, L=None):
         gt = comp_gabtight_long(g, a, M) * scale
 
     # post process result
-    if np.issubdtype(g.dtype, np.float):
+    if np.issubdtype(g.dtype, np.floating):
         # If g is real then the output is known to be real.
         gt = gt.real
 
diff --git a/ltfatpy/gabor/idgtreal.py b/ltfatpy/gabor/idgtreal.py
index 6076ad8..bca3308 100644
--- a/ltfatpy/gabor/idgtreal.py
+++ b/ltfatpy/gabor/idgtreal.py
@@ -204,7 +204,7 @@ def idgtreal(coef, g, a, M, Ls=None, pt='freqinv'):
     if L < info['gl']:
         raise ValueError('Window is too long.')
 
-    if not np.issubdtype(g.dtype, np.float):
+    if not np.issubdtype(g.dtype, np.floating):
         raise ValueError('The window must be real-valued.')
 
     # verify pt
diff --git a/ltfatpy/sigproc/normalize.py b/ltfatpy/sigproc/normalize.py
index c5b16a4..e7df720 100644
--- a/ltfatpy/sigproc/normalize.py
+++ b/ltfatpy/sigproc/normalize.py
@@ -151,7 +151,7 @@ def normalize(f, norm='2', dim=None):
             fnorm[ii] = s0norm(f[:, ii])
             f[:, ii] = f[:, ii] / fnorm[ii]
         elif norm == 'wav':
-            if np.issubdtype(f.dtype, np.float):
+            if np.issubdtype(f.dtype, np.floating):
                 fnorm[ii] = LA.norm(f[:, ii], np.inf)
                 f[:, ii] = 0.99 * f[:, ii] / fnorm[ii]
             else:
diff --git a/ltfatpy/tests/datasets/read_ref_mat.py b/ltfatpy/tests/datasets/read_ref_mat.py
index c033a46..8557663 100644
--- a/ltfatpy/tests/datasets/read_ref_mat.py
+++ b/ltfatpy/tests/datasets/read_ref_mat.py
@@ -115,7 +115,7 @@ def _adapt_type(val):
     """
     res = val
     if isinstance(val, np.ndarray):
-        if np.issubdtype(val.dtype, np.unicode):
+        if np.issubdtype(val.dtype, np.unicode_):
             # convert the unicode numpy arrays to standard unicode strings
             res = val.tolist()
             # convert boolean values
-- 
GitLab