Code creating figure 5 and 6 in the writeup