From 2b13b46ba0e9a957ac468c705a4e4596824730b5 Mon Sep 17 00:00:00 2001
From: Manuel Guenther <manuel.guenther@idiap.ch>
Date: Wed, 13 May 2015 18:04:50 +0200
Subject: [PATCH] replaced len(shape) with ndim

---
 bob/bio/gmm/algorithm/GMM.py     | 2 +-
 bob/bio/gmm/algorithm/ISV.py     | 2 +-
 bob/bio/gmm/algorithm/IVector.py | 2 +-
 setup.py                         | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/bob/bio/gmm/algorithm/GMM.py b/bob/bio/gmm/algorithm/GMM.py
index 1f664ba..81f1c34 100644
--- a/bob/bio/gmm/algorithm/GMM.py
+++ b/bob/bio/gmm/algorithm/GMM.py
@@ -87,7 +87,7 @@ class GMM (Algorithm):
 
   def _check_feature(self, feature):
     """Checks that the features are appropriate"""
-    if not isinstance(feature, numpy.ndarray) or len(feature.shape) != 2 or feature.dtype != numpy.float64:
+    if not isinstance(feature, numpy.ndarray) or feature.ndim != 2 or feature.dtype != numpy.float64:
       raise ValueError("The given feature is not appropriate")
     if self.ubm is not None and feature.shape[1] != self.ubm.shape[1]:
       raise ValueError("The given feature is expected to have %d elements, but it has %d" % (self.ubm.shape[1], feature.shape[1]))
diff --git a/bob/bio/gmm/algorithm/ISV.py b/bob/bio/gmm/algorithm/ISV.py
index e0cf0ea..c2fbe40 100644
--- a/bob/bio/gmm/algorithm/ISV.py
+++ b/bob/bio/gmm/algorithm/ISV.py
@@ -186,7 +186,7 @@ class ISV (GMM):
     assert isinstance(probe, (tuple, list))
     assert len(probe) == 2
     assert isinstance(probe[0], bob.learn.em.GMMStats)
-    assert isinstance(probe[1], numpy.ndarray) and len(probe[1].shape) == 1 and probe[1].dtype == numpy.float64
+    assert isinstance(probe[1], numpy.ndarray) and probe[1].ndim == 1 and probe[1].dtype == numpy.float64
 
 
   def score(self, model, probe):
diff --git a/bob/bio/gmm/algorithm/IVector.py b/bob/bio/gmm/algorithm/IVector.py
index 8f4c691..5cb62b7 100644
--- a/bob/bio/gmm/algorithm/IVector.py
+++ b/bob/bio/gmm/algorithm/IVector.py
@@ -57,7 +57,7 @@ class IVector (GMM):
 
   def _check_projected(self, feature):
     """Checks that the features are appropriate"""
-    if not isinstance(feature, numpy.ndarray) or len(feature.shape) != 1 or feature.dtype != numpy.float64:
+    if not isinstance(feature, numpy.ndarray) or feature.ndim != 1 or feature.dtype != numpy.float64:
       raise ValueError("The given feature is not appropriate")
     if self.whitener is not None and feature.shape[0] != self.whitener.shape[1]:
       raise ValueError("The given feature is expected to have %d elements, but it has %d" % (self.whitener.shape[1], feature.shape[0]))
diff --git a/setup.py b/setup.py
index 067e08d..9ec6e17 100644
--- a/setup.py
+++ b/setup.py
@@ -104,7 +104,7 @@ setup(
       'console_scripts' : [
         'verify_gmm.py      = bob.bio.gmm.script.verify_gmm:main',
         'verify_isv.py      = bob.bio.gmm.script.verify_isv:main',
-        'verify_ivector.py      = bob.bio.gmm.script.verify_ivector:main',
+        'verify_ivector.py  = bob.bio.gmm.script.verify_ivector:main',
       ],
 
       'bob.bio.database': [
-- 
GitLab