From 6522affff859fca7ac6b9b477f819851376bd441 Mon Sep 17 00:00:00 2001
From: jack-parsons <jack.parsons.uk@icloud.com>
Date: Thu, 25 Jul 2019 13:12:52 +0100
Subject: [PATCH] Fixing newShape type and length check

---
 AmpScan/ssm.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/AmpScan/ssm.py b/AmpScan/ssm.py
index b1b685b..1813327 100644
--- a/AmpScan/ssm.py
+++ b/AmpScan/ssm.py
@@ -132,8 +132,9 @@ class pca(object):
             to standard deviations about the mean
 
         """
-        sfs = np.array(sfs)
-        if not sfs.shape == self.pc_stdevs.shape:
+        if isinstance(sfs, (list, tuple, np.ndarray)):
+            raise TypeError('sfs is invalid type (expected array-like, found: {}'.format(type(sfs)))
+        if len(sfs) != len(self.pc_stdevs.shape):
             raise ValueError('sfs must be of the same length as the number of '
                              'principal components (expected {} but found {})'.format(self.pc_stdevs.shape, sfs.shape))
         if scale == 'eigs':
-- 
GitLab