Skip to content

Instantly share code, notes, and snippets.

@auxiliary
Created October 3, 2016 16:59
Show Gist options
  • Save auxiliary/4d8722ced851d70f507bca87db0499ec to your computer and use it in GitHub Desktop.
Save auxiliary/4d8722ced851d70f507bca87db0499ec to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import numpy as np
def getDegree(ref_id, grid_list):
results = np.zeros(grid_list[0].shape)
for i, grid in enumerate(grid_list):
results += (grid_list[ref_id] == grid)
return results / float(len(grid_list)) * 100
def test():
grids = []
for i in range(3):
grids.append(np.random.randint(0, 10, (3, 3, 3)))
for g in grids:
print g.flatten()
print getDegree(0, grids).flatten().astype("int")
if __name__ == '__main__':
test()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment