def sort_polys(polys):
    amin = polys.argmin(1)
    xind = np.arange(len(polys))
    return np.array([polys[xind, amin], polys[xind, (amin+1)%3], polys[xind, (amin+2)%3]]).T
dataset/ETHPy150Open gallantlab/pycortex/cortex/polyutils.py/sort_polys/original