def test_create_tics_array(): n_traj = 100 max_traj_length = 100 n_states = 10 n_tics = 5 test_kmeans_mdl = fake_kmeans(n_states, n_tics) tica_data = {} test_assignments = {} for i in range(n_traj): test_assignments[str(i)] = np.random.randint(n_states, size=max_traj_length) tica_data[str(i)] = np.random.normal(size=(max_traj_length, n_tics)) key_mapping, tics_array = create_tics_array(test_assignments, test_kmeans_mdl, tica_data) assert tics_array.shape == (n_traj, max_traj_length, n_tics) for i in range(10): temp_num = np.random.randint(n_traj) assert (tics_array[temp_num] == tica_data[key_mapping[temp_num]]).all() return
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
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