@@ -57,50 +57,50 @@ def compute_metrics(fs, outdir, atlas, verb=False):
57
57
# Number of non-zero edges (i.e. binary edge count)
58
58
print ("Computing: NNZ" )
59
59
nnz = OrderedDict ((subj , len (nx .edges (graphs [subj ]))) for subj in graphs )
60
- write (outdir , 'number_non_zeros' , nnz , atlas )
60
+ write (outdir , 'number_non_zeros' , nnz , atlas )
61
61
62
62
# Degree sequence
63
63
print ("Computing: Degree Seuqence" )
64
64
temp_deg = OrderedDict ((subj , np .array (nx .degree (graphs [subj ]).values ()))
65
- for subj in graphs )
65
+ for subj in graphs )
66
66
deg = density (temp_deg )
67
- write (outdir , 'degree_distribution' , deg , atlas )
67
+ write (outdir , 'degree_distribution' , deg , atlas )
68
68
69
69
# Edge Weights
70
70
print ("Computing: Edge Weight Sequence" )
71
- temp_ew = OrderedDict ((subj , [graphs [subj ].get_edge_data (e [0 ], e [1 ])['weight' ]
72
- for e in graphs [subj ].edges ()]) for subj in graphs )
71
+ temp_ew = OrderedDict ((s , [graphs [s ].get_edge_data (e [0 ], e [1 ])['weight' ]
72
+ for e in graphs [s ].edges ()]) for s in graphs )
73
73
ew = density (temp_ew )
74
- write (outdir , 'edge_weight_distribution' , ew , atlas )
74
+ write (outdir , 'edge_weight_distribution' , ew , atlas )
75
75
76
76
# Clustering Coefficients
77
77
print ("Computing: Clustering Coefficient Sequence" )
78
78
temp_cc = OrderedDict ((subj , nx .clustering (graphs [subj ]).values ())
79
- for subj in graphs )
79
+ for subj in graphs )
80
80
ccoefs = density (temp_cc )
81
- write (outdir , 'clustering_coefficients' , ccoefs , atlas )
81
+ write (outdir , 'clustering_coefficients' , ccoefs , atlas )
82
82
83
83
# Scan Statistic-1
84
84
print ("Computing: Scan Statistic-1 Sequence" )
85
85
temp_ss1 = scan_statistic (graphs , 1 )
86
86
ss1 = density (temp_ss1 )
87
- write (outdir , 'scan_statistic_1' , ss1 , atlas )
87
+ write (outdir , 'scan_statistic_1' , ss1 , atlas )
88
88
89
89
# Eigen Values
90
90
print ("Computing: Eigen Value Sequence" )
91
91
laplac = OrderedDict ((subj , nx .normalized_laplacian_matrix (graphs [subj ]))
92
- for subj in graphs )
92
+ for subj in graphs )
93
93
eigs = OrderedDict ((subj , np .sort (np .linalg .eigvals (laplac [subj ].A ))[::- 1 ])
94
- for subj in graphs )
95
- write (outdir , 'eigen_sequence' , eigs , atlas )
94
+ for subj in graphs )
95
+ write (outdir , 'eigen_sequence' , eigs , atlas )
96
96
97
97
# Betweenness Centrality
98
98
print ("Computing: Betweenness Centrality Sequence" )
99
99
nxbc = nx .algorithms .betweenness_centrality # For PEP8 line length...
100
100
temp_bc = OrderedDict ((subj , nxbc (graphs [subj ]).values ())
101
- for subj in graphs )
101
+ for subj in graphs )
102
102
centrality = density (temp_bc )
103
- write (outdir , 'betweenness_centrality' , centrality , atlas )
103
+ write (outdir , 'betweenness_centrality' , centrality , atlas )
104
104
105
105
outf = outdir + '/' + atlas + '_summary.png'
106
106
0 commit comments