// The test is inspired from scipy docstring of detrend function
def test_clean_detrending():
randgen = np.random.RandomState(0)
npoints = 1e3
noise = randgen.randn(npoints)
x = 2 * np.linspace(0, 1, npoints) + noise
x_detrended = signals.clean([x], standardize=False, detrend=True,
low_pass=None)[0]
x_undetrended = signals.clean([x], standardize=False, low_pass=None)[0]
assert_false((x_undetrended - noise).max() < 0.06)
After Change
// This test is inspired from scipy docstring of detrend function
def test_clean_detrending():
point_number = 1000
signals, noises, _ = generate_signals(feature_number=1,
length=point_number)
trend = np.atleast_2d(np.linspace(0, 2., point_number)).T
x = signals + trend