map = np.abs(maps[i]) > np.abs(maps[i]).max() * 0.95
for j in indices:
ref_map = components[j].ravel() != 0
if np.all(map.ravel() == ref_map):
indices.remove(j)
break
else:
assert False, "Non matching component"
if __name__ == "__main__":
After Change
K = np.corrcoef(components, maps.reshape(4, 400))[4:, :4]
// K should be a permutation matrix, hence its coefficients
// should all be close to 0 1 or -1
K_abs = np.abs(K)
assert_true(np.sum(K_abs > .9) == 4)
K_abs[K_abs > .9] -= 1
assert_array_almost_equal(K_abs, 0, 1)