Python code needed to generate the figures