Is this a typo in your phase_align function and maybe why your first method is more reliable? # subtract off mean r1 -= r1.mean() r1 -= r2.mean() <-----------------