obspy.realtime.rttrace.RtTrace.detrend
- RtTrace.detrend(type='simple', **options)
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.options – Collects keyword arguments which are passed to the selected detrend function. Does not need to be specified directly.
Note
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 instats.processing
of this trace.Supported Methods
'simple'
Subtracts a linear function defined by first/last sample of the trace (uses
obspy.signal.detrend.simple()
).'linear'
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()
).'polynomial'
Subtracts a polynomial of a given order. (uses
obspy.signal.detrend.polynomial()
).'spline'
Subtracts a spline of a given order with a given number of samples between spline nodes. (uses
obspy.signal.detrend.spline()
).
Example
Apply a third order spline detrend with 500 samples between nodes.
>>> from obspy import read >>> tr = read()[0] >>> tr.detrend("spline", order=3, dspline=500) ... <...Trace object at 0x...>