Trace.detrend(type='simple', **options)[source]

Remove a trend from the trace.

Parameters:type (str, optional) Method to use for detrending. Defaults to 'simple'. See the Supported Methods section below for further details.


This operation is performed in place on the actual data arrays. The raw data is not accessible anymore afterwards. To keep your original data, use copy() to create a copy of your trace object. This also makes an entry with information on the applied processing in stats.processing of this trace.

Supported Methods

Subtracts a linear function defined by first/last sample of the trace (uses obspy.signal.detrend.simple()).
Fitting a linear function to the trace with least squares and subtracting it (uses scipy.signal.detrend()).
'constant' or 'demean'
Mean of data is subtracted (uses scipy.signal.detrend()).
Subtracts a polynomial of a given order. (uses obspy.signal.detrend.polynomial()).
Subtracts a spline of a given order with a given number of samples between spline nodes. (uses obspy.signal.detrend.spline()).