derived from Darin Baumgartel's reference code.
Part of Darin Baumgartel's reference code. Adding efficiency & purity plot.