コード例 #1
0
    def test_center_distance_matrix_inplace(self):
        dm_expected = f_matrix(e_matrix(self.small_mat))

        # make copy of matrix to test inplace centering
        matrix_copy = copy.deepcopy(self.small_mat)
        dm_centered = center_distance_matrix(matrix_copy, inplace=False)

        # ensure that matrix_copy was NOT modified inplace
        self.assertTrue(np.array_equal(matrix_copy, self.small_mat))

        # and ensure that the result of centering was correct
        npt.assert_almost_equal(dm_expected, dm_centered)

        # next, sort same matrix inplace
        matrix_copy2 = copy.deepcopy(self.small_mat)
        dm_centered_inp = center_distance_matrix(matrix_copy2, inplace=True)

        # and ensure that the result of inplace centering was correct
        npt.assert_almost_equal(dm_expected, dm_centered_inp)
コード例 #2
0
ファイル: test_util.py プロジェクト: pamgaea/scikit-bio
 def test_f_matrix(self):
     F = f_matrix(self.matrix2)
     expected_F = np.zeros((3, 3))
     # Note that `test_make_F_matrix` in cogent is wrong
     npt.assert_almost_equal(F, expected_F)
コード例 #3
0
ファイル: test_util.py プロジェクト: ElDeveloper/biolopy
 def test_f_matrix(self):
     F = f_matrix(self.matrix2)
     expected_F = np.zeros((3, 3))
     # Note that `test_make_F_matrix` in cogent is wrong
     npt.assert_almost_equal(F, expected_F)