def test_gw_01(self): a = np.ones(shape=[4, 4]) + 3 * np.eye(4) a[0, 0] = 100 a[3, 3] = 25 a[0, 3] = 16 r = Utils.normalize_overlap_matrix(a) e = np.matrix([[1., 0.05, 0.05, 0.32], [0.05, 1., 0.25, 0.1], [0.05, 0.25, 1., 0.1], [0.02, 0.1, 0.1, 1.]]) np.testing.assert_array_almost_equal(r, e)
def test_bw_02(self): """Verify that an error is raised if the overlap matrix is not square.""" with self.assertRaisesRegex(AssertionError, 'square'): a = np.matrix(np.arange(1, 5)) Utils.normalize_overlap_matrix(a)
def test_bw_01(self): """Verify that an error is raised if there is a zero on the diagonal""" with self.assertRaisesRegex(AssertionError, 'diagonal'): a = np.reshape(np.arange(16), [4, 4]) Utils.normalize_overlap_matrix(a)