Add mean energy calculation