forked from QuakeMigrate/QuakeMigrate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrigger.py
66 lines (53 loc) · 2.12 KB
/
trigger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# -*- coding: utf-8 -*-
"""
This script demonstrates how to run the trigger stage of QuakeMigrate.
For more details, please see the manual and read the docs.
"""
# Stop numpy using all available threads (these environment variables must be
# set before numpy is imported for the first time).
import os
os.environ.update(OMP_NUM_THREADS="1",
OPENBLAS_NUM_THREADS="1",
NUMEXPR_NUM_THREADS="1",
MKL_NUM_THREADS="1")
from quakemigrate.io import read_lut
from quakemigrate.signal import Trigger
# --- i/o paths ---
lut_file = "/path/to/lut_file"
run_path = "/path/to/output"
run_name = "name_of_run"
# --- Set time period over which to run trigger ---
starttime = "2018-001T00:00:00.0"
endtime = "2018-002T00:00:00.00"
# --- Load the LUT ---
lut = read_lut(lut_file=lut_file)
# --- Create new Trigger ---
trig = Trigger(lut, run_path=run_path, run_name=run_name, log=True,
loglevel="info")
# --- Set trigger parameters ---
# For a complete list of parameters and guidance on how to choose them, please
# see the manual and read the docs.
trig.marginal_window = 1.
trig.min_event_interval = 2.
trig.normalise_coalescence = True
# --- Static threshold ---
trig.threshold_method = "static"
trig.static_threshold = 1.75
# --- Dynamic (Median Absolute Deviation) threshold ---
# trig.threshold_method = "dynamic"
# trig.mad_window_length = 7200.
# trig.mad_multiplier = 8.
# --- Toggle plotting options ---
trig.plot_trigger_summary = True
# It is possible to supply xy files to enhance and give context to the
# trigger summary map plots. See the volcano-tectonic example from Iceland
# for details.
# trig.xy_files = "/path/to/xy_csv"
# trig.plot_all_stns = False
# --- Run trigger ---
# NOTE: It is possible to specify an optional spatial filter to restrict the
# triggered events to a geographic region. Only candidate events that fall
# within this geographic area will be retained. This is useful for removing
# clear artefacts; for example at the very edges of the grid. See the
# volcano-tectonic example from Iceland for details.
trig.trigger(starttime, endtime, interactive_plot=False)