diff --git a/spectral/algorithms/algorithms.py b/spectral/algorithms/algorithms.py index ab14505..a7c6f6c 100644 --- a/spectral/algorithms/algorithms.py +++ b/spectral/algorithms/algorithms.py @@ -567,7 +567,7 @@ def principal_components(image): (L, V) = np.linalg.eig(stats.cov) # numpy says eigenvalues may not be sorted so we'll sort them, if needed. - if not np.alltrue(np.diff(L) <= 0): + if not np.all(np.diff(L) <= 0): ii = list(reversed(np.argsort(L))) L = L[ii] V = V[:, ii] @@ -1683,7 +1683,7 @@ def mnf(signal, noise): C = noise.sqrt_inv_cov.dot(signal.cov).dot(noise.sqrt_inv_cov) (L, V) = np.linalg.eig(C) # numpy says eigenvalues may not be sorted so we'll sort them, if needed. - if not np.alltrue(np.diff(L) <= 0): + if not np.all(np.diff(L) <= 0): ii = list(reversed(np.argsort(L))) L = L[ii] V = V[:, ii] diff --git a/spectral/tests/spatial.py b/spectral/tests/spatial.py index 882c136..6b58539 100644 --- a/spectral/tests/spatial.py +++ b/spectral/tests/spatial.py @@ -158,7 +158,7 @@ def test_map_classes_isomorphic(self): gt2 = gt + 1 d = map_class_ids(gt2, gt) result = map_classes(gt2, d) - assert (np.alltrue(result == gt)) + assert (np.all(result == gt)) def test_map_fails_allow_unmapped_false(self): '''map_classes should raise ValueError if image has unmapped value.''' @@ -180,7 +180,7 @@ def test_map_allow_unmapped_true(self): d = map_class_ids(gt2, gt) d.pop(1) result = map_classes(gt2, d, allow_unmapped=True) - assert (np.alltrue(result[gt2 == 1] == 1)) + assert (np.all(result[gt2 == 1] == 1)) def run(): diff --git a/spectral/tests/spymath.py b/spectral/tests/spymath.py index 3be5618..649542c 100644 --- a/spectral/tests/spymath.py +++ b/spectral/tests/spymath.py @@ -73,7 +73,7 @@ def setup(self): def test_evals_sorted(self): '''Eigenvalues should be sorted in descending order.''' - assert (np.alltrue(np.diff(self.pc.eigenvalues) <= 0)) + assert (np.all(np.diff(self.pc.eigenvalues) <= 0)) def test_evecs_orthonormal(self): '''Eigenvectors should be orthonormal.'''