def test_clean_graphs(fmt, conn_model, prune, norm): #test_CleanGraphs """ Test all combination of parameters for the CleanGraphs class """ base_dir = str(Path(__file__).parent/"examples") if fmt == 'npy': est_path = f"{base_dir}/miscellaneous/sub-0021001_rsn-Default_nodetype-parc_model-sps_template-MNI152_T1_thrtype-DENS_thr-0.19.npy" in_mat = np.load(est_path) else: est_path = f"{base_dir}/miscellaneous/002_rsn-Default_nodetype-parc_model-sps_thrtype-PROP_thr-0.94.txt" in_mat = np.genfromtxt(est_path) clean = netstats.CleanGraphs(0.5, conn_model, est_path, prune, norm) clean.normalize_graph() clean.print_summary() clean.create_length_matrix() clean.binarize_graph() clean.prune_graph() G = nx.from_numpy_array(in_mat) assert len(clean.G) >= 0 assert len(clean.G) <= len(G)
def test_clean_graphs(fmt, conn_model, prune, norm): """ Test all combination of parameters for the CleanGraphs class """ base_dir = str(Path(__file__).parent / "examples") if fmt == 'npy': est_path = f"{base_dir}/miscellaneous/0021001_rsn-Default_nodetype-parc_est-sps_thrtype-DENS_thr-0.19.npy" in_mat = np.load(est_path) else: est_path = f"{base_dir}/miscellaneous/002_rsn-Default_nodetype-parc_est-sps_thrtype-PROP_thr-0.94.txt" in_mat = np.genfromtxt(est_path) clean = netstats.CleanGraphs(0.5, conn_model, est_path, prune, norm) clean.normalize_graph() clean.print_summary() clean.create_length_matrix() clean.binarize_graph() # The docstring says prune should be a bool, but it is evaulated as an int. # there is also a bug (final_mat_path can't be returned), when prune == 0. clean.prune_graph() G = nx.from_numpy_array(in_mat) assert len(clean.G) >= 0 assert len(clean.G) <= len(G)