I found that the rotation can also be done using the numpy function flipud(), not sure if it is actually faster (I'm not that experienced with python/numpy) but for some this might be more logical to read instead of the 90 degrees rotation and the swapaxes.