import dascore
pa = dascore.get_example_patch()
# Subtract the best-fitting line from each channel.
out = pa.detrend("time")
# Or only the mean.
demeaned = pa.detrend("time", type="constant")detrend
detrend(
self ,
dim: str ,
type: Literal[‘linear’, ‘constant’] = linear,
)-> ‘Self’
Remove a constant or linear trend from the data along one dimension.
Parameters
| Parameter | Description |
|---|---|
| patch | The patch to detrend. |
| dim | Name of the dimension to detrend along. |
| type |
The trend to subtract: “linear” (the default) removes a least-squares line, “constant” removes the mean. |