Skip to content
Snippets Groups Projects
Commit 5bf81efd authored by Florent Jaillet's avatar Florent Jaillet
Browse files

Removing FutureWarnings given by numpy 1.4 due to deprecated conversions in np.issubdtype()

parent ea92bd35
Branches
Tags
No related merge requests found
...@@ -104,8 +104,8 @@ def assert_sigreshape_pre(f, L=None, dim=None): ...@@ -104,8 +104,8 @@ def assert_sigreshape_pre(f, L=None, dim=None):
f = np.asarray(f) f = np.asarray(f)
# ----Check that f type is numeric # ----Check that f type is numeric
if (not np.issubdtype(f.dtype, np.float) and if (not np.issubdtype(f.dtype, np.floating) and
not np.issubdtype(f.dtype, np.complex) and not np.issubdtype(f.dtype, np.complexfloating) and
not np.issubdtype(f.dtype, np.integer)): not np.issubdtype(f.dtype, np.integer)):
raise TypeError("f data type should be numeric.") raise TypeError("f data type should be numeric.")
D = f.ndim D = f.ndim
......
...@@ -75,8 +75,8 @@ def comp_sigreshape_pre(f, do_ndim): ...@@ -75,8 +75,8 @@ def comp_sigreshape_pre(f, do_ndim):
""" """
if not isinstance(f, np.ndarray): if not isinstance(f, np.ndarray):
raise ValueError("f should be a numpy array.") raise ValueError("f should be a numpy array.")
elif f.size == 0 or (not np.issubdtype(f.dtype, np.float) and elif f.size == 0 or (not np.issubdtype(f.dtype, np.floating) and
not np.issubdtype(f.dtype, np.complex) and not np.issubdtype(f.dtype, np.complexfloating) and
not np.issubdtype(f.dtype, np.integer)): not np.issubdtype(f.dtype, np.integer)):
raise ValueError('The input must be non-empty numeric.') raise ValueError('The input must be non-empty numeric.')
......
...@@ -247,7 +247,7 @@ def comp_window(g, a, M, L=None): ...@@ -247,7 +247,7 @@ def comp_window(g, a, M, L=None):
g = fir2long(g, int(np.ceil(g.shape[0] / M) * M)) g = fir2long(g, int(np.ceil(g.shape[0] / M) * M))
# Information to be determined post creation. # 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] info['gl'] = g.shape[0]
if L is not None and info['gl'] < L: if L is not None and info['gl'] < L:
info['isfir'] = True info['isfir'] = True
......
...@@ -178,7 +178,7 @@ def dgtreal(f, g, a, M, L=None, pt='freqinv'): ...@@ -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] (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.') raise ValueError('The window must be real-valued.')
# verify pt # verify pt
......
...@@ -183,7 +183,7 @@ def gabdual(g, a, M, L=None): ...@@ -183,7 +183,7 @@ def gabdual(g, a, M, L=None):
gd = comp_gabdual_long(g, a, M)*scale gd = comp_gabdual_long(g, a, M)*scale
# post process result # 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. # If g is real then the output is known to be real.
gd = gd.real gd = gd.real
......
...@@ -191,7 +191,7 @@ def gabtight(g, a, M, L=None): ...@@ -191,7 +191,7 @@ def gabtight(g, a, M, L=None):
gt = comp_gabtight_long(g, a, M) * scale gt = comp_gabtight_long(g, a, M) * scale
# post process result # 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. # If g is real then the output is known to be real.
gt = gt.real gt = gt.real
......
...@@ -204,7 +204,7 @@ def idgtreal(coef, g, a, M, Ls=None, pt='freqinv'): ...@@ -204,7 +204,7 @@ def idgtreal(coef, g, a, M, Ls=None, pt='freqinv'):
if L < info['gl']: if L < info['gl']:
raise ValueError('Window is too long.') 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.') raise ValueError('The window must be real-valued.')
# verify pt # verify pt
......
...@@ -151,7 +151,7 @@ def normalize(f, norm='2', dim=None): ...@@ -151,7 +151,7 @@ def normalize(f, norm='2', dim=None):
fnorm[ii] = s0norm(f[:, ii]) fnorm[ii] = s0norm(f[:, ii])
f[:, ii] = f[:, ii] / fnorm[ii] f[:, ii] = f[:, ii] / fnorm[ii]
elif norm == 'wav': 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) fnorm[ii] = LA.norm(f[:, ii], np.inf)
f[:, ii] = 0.99 * f[:, ii] / fnorm[ii] f[:, ii] = 0.99 * f[:, ii] / fnorm[ii]
else: else:
......
...@@ -115,7 +115,7 @@ def _adapt_type(val): ...@@ -115,7 +115,7 @@ def _adapt_type(val):
""" """
res = val res = val
if isinstance(val, np.ndarray): 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 # convert the unicode numpy arrays to standard unicode strings
res = val.tolist() res = val.tolist()
# convert boolean values # convert boolean values
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment