Python version of ASDFPixelSort.pde