Compute Moran's Index for images or adjacency matrices
You can install moransi via pip:
pip install moransiTo install latest development version :
pip install git+https://github.com/GuignardLab/moransi.gitYou can use this code after installing it the following way:
from moransi import morans_i_image
image = ... # opening an image
kernel = ... # A kernel for the weights of the neighbouring pixels
morans_i_image(image, kernel) # Returns the Moran's indexfrom moransi import morans_i_adjacency_matrix
adjacency_matrix = ... # an adjacency matrix of size N by N.
# It is either binary or links weights
# adjacency_matrix[i, j] is >0 if there is an edge
# between i and j
metric = ... # An array of size N where metric[i] is the value of node `i`
morans_i_adjacency_matrix(image, metric) # Returns the Moran's indexContributions are very welcome.
Distributed under the terms of the MIT license, "moransi" is free and open source software
If you encounter any problems, please file an issue along with a detailed description.