pyhctsa.utils.detrend_linear¶
- pyhctsa.utils.detrend_linear(x)¶
Remove the least-squares line from a time series.
- Parameters:¶
- x : array-like¶
The time series (1-D).
- Returns:¶
float64 array of the same length:
xminus the ordinary-least-squares line fitted against the sample index, so the result has zero mean and no linear trend. A series of fewer than 3 samples is returned as zeros (a line passes through any two points).- Return type:¶
numpy.ndarray
Notes
Only the mean and the slope are removed: long memory, slow oscillations and level shifts stay in the series. This is the transform behind the
*_lindtfeatures (a feature configuration withpreprocess: detrend, which re-z-scores the residual); apply it to every series of a dataset to detrend the data before feature extraction.