Remove mean of signal isntead of linear fit for period detection.