full_matrix = np.concatenate( [np.abs(corr_cls_coef), np.abs(corr_pln_coef)], axis=0) threshold = np.median(full_matrix[np.nonzero(full_matrix)]) + \ np.std(full_matrix[np.nonzero(full_matrix)]) data_cls_bin = np.abs(corr_cls_coef) > threshold data_pln_bin = np.abs(corr_pln_coef) > threshold deg_cls_tmp = np.asarray( [bct.degrees_und(g) for g in data_cls_bin]) deg_pln_tmp = np.asarray( [bct.degrees_und(g) for g in data_pln_bin]) trans_cls_tmp = np.asarray( [bct.transitivity_bu(g) for g in data_cls_bin]) trans_pln_tmp = np.asarray( [bct.transitivity_bu(g) for g in data_pln_bin]) cp_cls_tmp = np.asarray( [bct.distance.charpath(g)[0] for g in data_cls_bin]) cp_pln_tmp = np.asarray( [bct.distance.charpath(g)[0] for g in data_pln_bin]) # Add measure to results list deg_cls.append(deg_cls_tmp) deg_pln.append(deg_pln_tmp) trans_cls.append(trans_cls_tmp) trans_pln.append(trans_pln_tmp) cp_cls.append(cp_cls_tmp) cp_pln.append(cp_pln_tmp)
def test_transitivity_bu(): x = bct.binarize(load_sample(thres=.17), copy=False) t = bct.transitivity_bu(x) assert np.allclose(t, 0.42763107)
[np.abs(corr_cls_coef), np.abs(corr_pln_coef)], axis=0) threshold = np.median(full_matrix[np.nonzero(full_matrix)]) + \ np.std(full_matrix[np.nonzero(full_matrix)]) data_cls_bin = np.abs(corr_cls_coef) > threshold data_pln_bin = np.abs(corr_pln_coef) > threshold deg_cls_tmp = np.asarray( [bct.degrees_und(g) for g in data_cls_bin]) deg_pln_tmp = np.asarray( [bct.degrees_und(g) for g in data_pln_bin]) trans_cls_tmp = np.asarray( [bct.transitivity_bu(g) for g in data_cls_bin]) trans_pln_tmp = np.asarray( [bct.transitivity_bu(g) for g in data_pln_bin]) cp_cls_tmp = np.asarray( [bct.distance.charpath(g)[0] for g in data_cls_bin]) cp_pln_tmp = np.asarray( [bct.distance.charpath(g)[0] for g in data_pln_bin]) # Add measure to results list deg_cls.append(deg_cls_tmp) deg_pln.append(deg_pln_tmp) trans_cls.append(trans_cls_tmp) trans_pln.append(trans_pln_tmp) cp_cls.append(cp_cls_tmp) cp_pln.append(cp_pln_tmp)