https://llego.dev/posts/numpy-reshape-flatten-transpose-arrays-python/