python code used to create animation and figures