You can use
look at the following example (for red channel):
numpy.argsort
to sort by mean values,look at the following example (for red channel):
r_inds = np.argsort(np.array(r_submatrices).reshape(-1, len(r_submatrices)).mean(axis=0))[::-1] np.array(r_submatrices)[r_inds] # sorted array