obspy.core.trace.Trace.filter
- Trace.filter(type, *args, **options)[source]
Filter the data of the current trace.
- Parameters:
type (str) – String that specifies which filter is applied (e.g.
"bandpass"
). See the Supported Filter section below for further details.args – Only filter frequency/frequencies can be specified as argument(s). Alternatively filter frequencies can be specified as keyword arguments.
options – Keyword arguments for the respective filter that will be passed on. (e.g.
freqmin=1.0
,freqmax=20.0
for"bandpass"
)
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 Filter
'bandpass'
Butterworth-Bandpass (uses
obspy.signal.filter.bandpass()
).'bandstop'
Butterworth-Bandstop (uses
obspy.signal.filter.bandstop()
).'lowpass'
Butterworth-Lowpass (uses
obspy.signal.filter.lowpass()
).'highpass'
Butterworth-Highpass (uses
obspy.signal.filter.highpass()
).'lowpass_cheby_2'
Cheby2-Lowpass (uses
obspy.signal.filter.lowpass_cheby_2()
).'lowpass_fir'
(experimental)FIR-Lowpass (uses
obspy.signal.filter.lowpass_fir()
).'remez_fir'
(experimental)Minimax optimal bandpass using Remez algorithm (uses
obspy.signal.filter.remez_fir()
).
Example
>>> from obspy import read >>> st = read() >>> tr = st[0] >>> tr.filter("highpass", freq=1.0) <...Trace object at 0x...> >>> tr2 = st[1] >>> tr2.filter("lowpass", 1.0) <...Trace object at 0x...> >>> tr.plot()
(Source code, png)