added scipy detrend