Spectrum reduce

Draft of code to spectrum reduction via intgration
rename energy to be more generic