update energyerror
added includeinvalid flag, added plotPull