Ejemplo n.º 1
0
    def test_is_diagonal_matrix_false(self):
        matrix = zeros([5, 5], dtype='4float64')
        for i in range(5):
            matrix[i][i] = (1.0, 0.0, 1.0, 1.0)
        matrix[0][3] = (1.0, 0.0, 1.0, 1.0)
        matrix[3][0] = (1.0, 0.0, 1.0, 1.0)

        self.assertFalse(is_diagonal_matrix(matrix))
Ejemplo n.º 2
0
    def test_is_diagonal_matrix_false(self):
        matrix = zeros([5, 5], dtype='4float64')
        for i in range(5):
            matrix[i][i] = (1.0, 0.0, 1.0, 1.0)
        matrix[0][3] = (1.0, 0.0, 1.0, 1.0)
        matrix[3][0] = (1.0, 0.0, 1.0, 1.0)

        self.assertFalse(is_diagonal_matrix(matrix))
Ejemplo n.º 3
0
def subpopulation_model_test(dist_mat, category, output_dir):
    """ Tests the subpopulation model in the profiles distance matrix
    Inputs:
        dist_mat: profiles distance matrix
        category: category used for generate the distance matrix
        output_dir: output directory
    """
    # Write the test result
    output_fp = join(output_dir, 'subpopulation_model_test.txt')
    outf = open(output_fp, 'w')
    outf.write("Subpopulation model results:\n")
    outf.write("\tCategory used: %s\n" % category)
    outf.write("\tSubpopulation model test passed: ")
    # The subpopulation model is followed if the similarity matrix is
    # a diagonal matrix
    if is_diagonal_matrix(dist_mat):
        outf.write("Yes\n")
    else:
        outf.write("No\n")
    outf.close()
Ejemplo n.º 4
0
def subpopulation_model_test(dist_mat, category, output_dir):
    """ Tests the subpopulation model in the profiles distance matrix
    Inputs:
        dist_mat: profiles distance matrix
        category: category used for generate the distance matrix
        output_dir: output directory
    """
    # Write the test result
    output_fp = join(output_dir, 'subpopulation_model_test.txt')
    outf = open(output_fp, 'w')
    outf.write("Subpopulation model results:\n")
    outf.write("\tCategory used: %s\n" % category)
    outf.write("\tSubpopulation model test passed: ")
    # The subpopulation model is followed if the similarity matrix is
    # a diagonal matrix
    if is_diagonal_matrix(dist_mat):
        outf.write("Yes\n")
    else:
        outf.write("No\n")
    outf.close()
Ejemplo n.º 5
0
    def test_is_diagonal_matrix_true(self):
        matrix = zeros([5, 5], dtype='4float64')
        for i in range(5):
            matrix[i][i] = (1.0, 0.0, 0.0, 0.0)

        self.assertTrue(is_diagonal_matrix(matrix))
Ejemplo n.º 6
0
    def test_is_diagonal_matrix_true(self):
        matrix = zeros([5, 5], dtype='4float64')
        for i in range(5):
            matrix[i][i] = (1.0, 0.0, 0.0, 0.0)

        self.assertTrue(is_diagonal_matrix(matrix))