Skip to content

Trigger Processor Job

The TriggerProcessor monitors a single seismic channel (typically the vertical component, EHZ) to detect earthquake events in real-time. It uses the industry-standard STA/LTA (Short-Term Average / Long-Term Average) algorithm to distinguish between background noise and impulsive seismic arrivals.

The algorithm calculates the ratio between the average signal amplitude in a moving short-term window and a moving long-term window.

  • STA (Short-Term Average): Captures the immediate “energy” of the seismic wave (e.g., 0.5 seconds).
  • LTA (Long-Term Average): Captures the “background” noise level (e.g., 10 seconds).
  • Ratio:

To prevent the system from rapidly flickering “ON” and “OFF” during a shaky earthquake, we use Dual Thresholds:

  1. Trigger ON: When the Ratio crosses thr_on (e.g., 3.5), the earthquake_event is set.
  2. Stay ON: Even if the ratio drops to 2.0, the event remains active.
  3. Trigger OFF: Only when the ratio falls below thr_off (e.g., 1.5) is the event cleared.

These parameters are defined in the jobs_settings.trigger section of your config.yml.

ParameterDefaultDescription
sta_sec0.5Sensitivity to sharp onsets (seconds).
lta_sec10.0Background noise averaging window (seconds).
thr_on3.5Ratio required to declare an earthquake.
thr_off1.5Ratio required to end the event.
trigger_channelEHZThe physical channel monitored for triggers.

The processor uses a thread-safe deque (Rolling Buffer) to maintain exactly enough data for stable LTA calculation without consuming excessive memory.

  • Type: collections.deque(maxlen=2000)
  • Size: . For a 10s LTA at 100Hz, this is 2000 samples (~16 KB).
  • Processing: The recursive_sta_lta function from ObsPy is called every time a new packet arrives (100 times per second).
Trigger Logic Snippet
# Compute characteristic function
cft = recursive_sta_lta(data_arr, nsta, nlta)
current_ratio = cft[-1]
if current_ratio > thr_on and not last_trigger:
earthquake_event.set() # Alert other threads!