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

---
 bob/bio/base/algorithm/LDA.py | 2 +-
 bob/bio/base/algorithm/PCA.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bob/bio/base/algorithm/LDA.py b/bob/bio/base/algorithm/LDA.py
index 37b047bb..83bcc4c7 100644
--- a/bob/bio/base/algorithm/LDA.py
+++ b/bob/bio/base/algorithm/LDA.py
@@ -56,7 +56,7 @@ class LDA (Algorithm):
 
   def _check_feature(self, feature, projected=False):
     """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")
     index = 1 if projected else 0
     if self.machine is not None and feature.shape[0] != self.machine.shape[index]:
diff --git a/bob/bio/base/algorithm/PCA.py b/bob/bio/base/algorithm/PCA.py
index edac8883..708216e9 100644
--- a/bob/bio/base/algorithm/PCA.py
+++ b/bob/bio/base/algorithm/PCA.py
@@ -48,7 +48,7 @@ class PCA (Algorithm):
 
   def _check_feature(self, feature, projected=False):
     """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")
     index = 1 if projected else 0
     if self.machine is not None and feature.shape[0] != self.machine.shape[index]:
-- 
GitLab