obspy.core.trace.Trace.trigger

Trace.trigger(type, **options)[source]

Run a triggering algorithm on the data of the current trace.

Parameters:
  • type – String that specifies which trigger is applied (e.g. 'recstalta'). See the Supported Trigger section below for further details.

  • options – Necessary keyword arguments for the respective trigger that will be passed on. (e.g. sta=3, lta=10) Arguments sta and lta (seconds) will be mapped to nsta and nlta (samples) by multiplying with sampling rate of trace. (e.g. sta=3, lta=10 would call the trigger with 3 and 10 seconds average, respectively)

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 in stats.processing of this trace.

Supported Trigger

'classicstalta'

Computes the classic STA/LTA characteristic function (uses obspy.signal.trigger.classic_sta_lta()).

'recstalta'

Recursive STA/LTA (uses obspy.signal.trigger.recursive_sta_lta()).

'recstaltapy'

Recursive STA/LTA written in Python (uses obspy.signal.trigger.recursive_sta_lta_py()).

'delayedstalta'

Delayed STA/LTA. (uses obspy.signal.trigger.delayed_sta_lta()).

'carlstatrig'

Computes the carl_sta_trig characteristic function (uses obspy.signal.trigger.carl_sta_trig()).

'energyratio'

Computes the energy ratio characteristic function (uses obspy.signal.trigger.energy_ratio()).

'modifiedenergyratio'

Computes the modified energy ratio characteristic function (uses obspy.signal.trigger.modified_energy_ratio()).

'zdetect'

Z-detector (uses obspy.signal.trigger.z_detect()).

Example

>>> from obspy import read
>>> st = read()
>>> tr = st[0]
>>> tr.filter("highpass", freq=1.0)  
<...Trace object at 0x...>
>>> tr.plot()  
>>> tr.trigger("recstalta", sta=1, lta=4)  
<...Trace object at 0x...>
>>> tr.plot()  

(Source code)

../../_images/obspy-core-trace-Trace-trigger-1_00.png

(png)

../../_images/obspy-core-trace-Trace-trigger-1_01.png

(png)