From fc9bc7b2b2cf15d3d845d178b3904b30700a742f Mon Sep 17 00:00:00 2001
From: lodenthal <lodenthal@uni-bielefeld.de>
Date: Mon, 8 Jan 2018 22:44:50 +0300
Subject: [PATCH] changes some little things in database init like typeerror to
 valueerror and so on

---
 navipy/database/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/navipy/database/__init__.py b/navipy/database/__init__.py
index 5f4141a..2580911 100644
--- a/navipy/database/__init__.py
+++ b/navipy/database/__init__.py
@@ -376,7 +376,7 @@ database
             if rowid is np.nan:
                 raise ValueError('rowid must not be nan')
         if (posorient is None) and (rowid is None):
-                Exception('posorient and rowid can not be both None')
+                raise Exception('posorient and rowid can not be both None')
         if posorient is not None:
                 rowid = self.get_posid(posorient)
         # Read images
@@ -466,6 +466,8 @@ database
         return toreturn
 
     def denormalise_image(self, image, cmaxminrange):
+        if not isinstance(image,np.ndarray):
+            raise TypeError('image must be np.array')
         if len(image.shape) != 3:
             raise Exception('image should be 3D array')
         if image.shape[2] != len(self.channels):
@@ -473,7 +475,7 @@ database
                              number of channels {}'.format(
                 len(self.channels)))
         if not isinstance(cmaxminrange, pd.Series):
-            raise Exception('cmaxminrange should be a pandas Series')
+            raise TypeError('cmaxminrange should be a pandas Series')
         if cmaxminrange.empty:
             raise Exception('cmaxminrange must not be empty')
         for chan_n in self.channels:
-- 
GitLab