analysis code revised to make prelim pie plots