brainspace.null_models.moran.compute_mem

brainspace.null_models.moran.compute_mem(w, n_ring=1, spectrum='nonzero', tol=1e-10)[source]

Compute Moran eigenvectors map.

Parameters:
  • w (BSPolyData, ndarray or sparse matrix, shape = (n_vertices, n_vertices)) – Spatial weight matrix or surface. If surface, the weight matrix is built based on the inverse geodesic distance between each vertex and the vertices in its n_ring.
  • n_ring (int, optional) – Neighborhood size to build the weight matrix. Only used if user provides a surface mesh. Default is 1.
  • spectrum ({'all', 'nonzero'}, optional) – Eigenvalues/vectors to select. If ‘all’, recover all eigenvectors except the smallest one. Otherwise, select all except non-zero eigenvectors. Default is ‘nonzero’.
  • tol (float, optional) – Minimum value for an eigenvalue to be considered non-zero. Default is 1e-10.
Returns:

  • w (1D ndarray, shape (n_components,)) – Eigenvalues in descending order. With n_components = n_vertices - 1 if spectrum == 'all' and n_components = n_vertices - n_zero if spectrum == 'nonzero', and n_zero is number of zero eigenvalues.
  • mem (2D ndarray, shape (n_vertices, n_components)) – Eigenvectors of the weight matrix in same order.

References

  • Wagner H.H. and Dray S. (2015). Generating spatially constrained null models for irregularly spaced data using Moran spectral randomization methods. Methods in Ecology and Evolution, 6(10):1169-78.