Code for figs 1-2 of Brooks et al.