added fitting of straight line to integrated flux
added estimation of dof by counting crests and troughs
added checking of error bar estimates. replace diag with actual mean(flux) to be consistent with definition of error bars.
check correlation of say, major axis length and flux