spectrochempy.detrend
- detrend(dataset, order='linear', breakpoints=None, **kwargs)[source]
- Remove polynomial trend along a dimension from dataset. - Depending on the - orderparameter,- detrendremoves the best-fit polynomial line (in the least squares sense) from the data and returns the remaining data.- Parameters:
- dataset ( - NDDataset) – The input data.
- order (non-negative - intor- stramong [‘constant’, ‘linear’, ‘quadratic’, ‘cubic’], optional, default:’linear’) – The order of the polynomial trend.- If - order=0or- 'constant', the mean of data is subtracted to remove a shift trend.
- If - order=1or- 'linear'(default), the best straight-fit line is subtracted from data to remove a linear trend (drift).
- If order=2 or - order=quadratic, the best fitted nth-degree polynomial line is subtracted from data to remove a quadratic polynomial trend.
- order=ncan also be used to remove any nth-degree polynomial trend.
 
- breakpoints (array_like, optional) – Breakpoints to define piecewise segments of the data, specified as a vector containing coordinate values or indices indicating the location of the breakpoints. Breakpoints are useful when you want to compute separate trends for different segments of the data. 
 
- Returns:
- NDDataset– The detrended dataset.
 - See also - Baseline
- Manual baseline correction processor. 
- get_baseline
- Compute a baseline using the - Baselineclass.
- basc
- Make a baseline correction using the - Baselineclass.
- asls
- Perform an Asymmetric Least Squares Smoothing baseline correction. 
- snip
- Perform a Simple Non-Iterative Peak (SNIP) detection algorithm. 
- rubberband
- Perform a Rubberband baseline correction. 
- autosub
- Perform an automatic subtraction of reference. 
 
Examples using spectrochempy.detrend
 
Using plot_multiple to plot several datasets on the same figure