From 407084d5c34009b52e00e40d73ab87da16e5f16c Mon Sep 17 00:00:00 2001 From: jack-parsons <jack.parsons.uk@icloud.com> Date: Thu, 25 Jul 2019 18:03:46 +0100 Subject: [PATCH] Fixing ssm module --- AmpScan/ssm.py | 10 +++++----- tests/__init__py.py | 2 -- tests/pca_tests/sample_stl_sphere_BIN.stl | 3 --- tests/pca_tests/stl_file_3.stl | 3 +++ 4 files changed, 8 insertions(+), 10 deletions(-) delete mode 100644 tests/pca_tests/sample_stl_sphere_BIN.stl create mode 100644 tests/pca_tests/stl_file_3.stl diff --git a/AmpScan/ssm.py b/AmpScan/ssm.py index ed64f69..514b6b1 100644 --- a/AmpScan/ssm.py +++ b/AmpScan/ssm.py @@ -22,8 +22,8 @@ class pca(object): >>> import os >>> p = pca() >>> p.importFolder(os.getcwd()+"\\tests\\pca_tests") - >>> p.setBaseline(os.getcwd()+stl_file_3.stl) - >stl_file_3.stlcwd()+"\\tests\\pca_tests\\") + >>> p.setBaseline(os.getcwd()+"\\tests\\stl_file_3.stl") + >>> p.register(save=os.getcwd()+"\\tests\\pca_tests\\") >>> p.pca() >>> sfs = [1, 2] >>> newS = p.newShape(sfs) @@ -132,11 +132,11 @@ class pca(object): to standard deviations about the mean """ - if isinstance(sfs, (list, tuple, np.ndarray)): + if not 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): + if len(sfs) != len(self.pc_stdevs): 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)) + 'principal components (expected {} but found {})'.format(len(self.pc_stdevs), len(sfs))) if scale == 'eigs': sf = (self.pca_U * sfs).sum(axis=1) elif scale == 'std': diff --git a/tests/__init__py.py b/tests/__init__py.py index 97d12f0..e69de29 100644 --- a/tests/__init__py.py +++ b/tests/__init__py.py @@ -1,2 +0,0 @@ - -from tests.util import get_path \ No newline at end of file diff --git a/tests/pca_tests/sample_stl_sphere_BIN.stl b/tests/pca_tests/sample_stl_sphere_BIN.stl deleted file mode 100644 index c9d4e3e..0000000 --- a/tests/pca_tests/sample_stl_sphere_BIN.stl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:23d4d80f3205706d0d53df58f592c99abcc0558a9c82cd59a89f43126b3e8313 -size 64084 diff --git a/tests/pca_tests/stl_file_3.stl b/tests/pca_tests/stl_file_3.stl new file mode 100644 index 0000000..c95508e --- /dev/null +++ b/tests/pca_tests/stl_file_3.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4d4d2f0165ec971f8311c9eaa03370b19c5f43a29490b9cf486ac2b6d7d0614 +size 64084 -- GitLab