brainconn.utils.matrix.autofix

autofix(W, copy=True)[source]

Fix a bunch of common problems. More specifically, remove Inf and NaN, ensure exact binariness and symmetry (i.e. remove floating point instability), and zero diagonal.

Parameters:
  • W (numpy.ndarray) – weighted connectivity matrix
  • copy (bool) – if True, returns a copy of the matrix. Otherwise, modifies the matrix in place. Default value=True.
Returns:

W – connectivity matrix with fixes applied

Return type:

numpy.ndarray