def test_create_assignment_matrix():
    assignments = {}
    assignments["traj1"] = [0, 1, 2]
    assignments["traj2"] = [2, 1, 2]
    assignments["traj3"] = [2, 1, 0, 3]

    key_mapping, assignment_matrix = create_assignment_matrix(assignments)

    assert assignment_matrix.shape == (3, 4)
    assert (assignment_matrix[1][0:3] == assignments[key_mapping[1]][:3]).all()

    return
Example #2
0
def test_create_assignment_matrix():
    assignments = {}
    assignments["traj1"] = [0, 1, 2]
    assignments["traj2"] = [2, 1, 2]
    assignments["traj3"] = [2, 1, 0, 3]

    key_mapping, assignment_matrix = create_assignment_matrix(assignments)

    assert assignment_matrix.shape == (3, 4)
    assert (assignment_matrix[1][0:3] == assignments[key_mapping[1]][:3]).all()

    return
Example #3
0
def _load_protein_matrices(yaml_file, protein_name):
    """
    Helper routine to load matrices for a protein
    :param yaml_file: yaml file to work with
    :param protein_name: name of the protein
    :return:
     prj :The protein Series
     prt : The protein project
     key_mapping: mapping of the assigment matrix 0-axis to traj names
     assignment_matrix: Massive matrix of
     tics_mapping: mapping of the tics_array matrix 0-axis to traj names
     tics_array: Multi dimensional array where the 0th axis is equal to the
     number of trajectors, the 1st axis is equal to largest traj and the
     3rd dimension is equal to the number of tics in the mdl.
    """
    prj = ProteinSeries(yaml_file)
    prt = Protein(prj, protein_name)

    key_mapping, assignment_matrix  = create_assignment_matrix(prt.fixed_assignments)
    tics_mapping , tics_array  = create_tics_array(prt.fixed_assignments, prt.kmeans_mdl,
                                        prt.tica_data)

    return prj, prt, key_mapping, assignment_matrix, tics_mapping, tics_array
Example #4
0
def _load_protein_matrices(yaml_file, protein_name):
    """
    Helper routine to load matrices for a protein
    :param yaml_file: yaml file to work with
    :param protein_name: name of the protein
    :return:
     prj :The protein Series
     prt : The protein project
     key_mapping: mapping of the assigment matrix 0-axis to traj names
     assignment_matrix: Massive matrix of
     tics_mapping: mapping of the tics_array matrix 0-axis to traj names
     tics_array: Multi dimensional array where the 0th axis is equal to the
     number of trajectors, the 1st axis is equal to largest traj and the
     3rd dimension is equal to the number of tics in the mdl.
    """
    prj = ProteinSeries(yaml_file)
    prt = Protein(prj, protein_name)

    key_mapping, assignment_matrix = create_assignment_matrix(
        prt.fixed_assignments)
    tics_mapping, tics_array = create_tics_array(prt.fixed_assignments,
                                                 prt.kmeans_mdl, prt.tica_data)

    return prj, prt, key_mapping, assignment_matrix, tics_mapping, tics_array