scipy 1.8.0 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
detrend(data, axis=-1, type='linear', bp=0, overwrite_data=False)

Parameters

data : array_like

The input data.

axis : int, optional

The axis along which to detrend the data. By default this is the last axis (-1).

type : {'linear', 'constant'}, optional

The type of detrending. If type == 'linear' (default), the result of a linear least-squares fit to data is subtracted from data . If type == 'constant' , only the mean of data is subtracted.

bp : array_like of ints, optional

A sequence of break points. If given, an individual linear fit is performed for each part of data between two break points. Break points are specified as indices into data . This parameter only has an effect when type == 'linear' .

overwrite_data : bool, optional

If True, perform in place detrending and avoid a copy. Default is False

Returns

ret : ndarray

The detrended input data.

Remove linear trend along axis from data.

Examples

>>> from scipy import signal
... from numpy.random import default_rng
... rng = default_rng()
... npoints = 1000
... noise = rng.standard_normal(npoints)
... x = 3 + 2*np.linspace(0, 1, npoints) + noise
... (signal.detrend(x) - noise).max() 0.06 # random
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.signal._spectral_py.welch scipy.signal._spectral_py._spectral_helper scipy.signal._spectral_py.coherence scipy.signal._spectral_py.stft scipy.signal._spectral_py.csd scipy.signal._spectral_py.periodogram scipy.signal._spectral_py.spectrogram scipy.signal._signaltools.detrend

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/signal/_signaltools.py#3409
type: <class 'function'>
Commit: