Improve code for calculating and plotting brain optimality metrics.