From a90ef26344c9c1a8dfe3aef3d48f67f4bb5e1d23 Mon Sep 17 00:00:00 2001 From: Marcel Date: Mon, 1 Apr 2019 11:08:00 +0200 Subject: [PATCH] [add] paramter taup_phases --- pylot/core/io/default_parameters.py | 10 ++++++++-- pylot/core/pick/autopick.py | 14 +++++++++++--- pylot/core/util/widgets.py | 5 ++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/pylot/core/io/default_parameters.py b/pylot/core/io/default_parameters.py index 71ea2377..bb960669 100644 --- a/pylot/core/io/default_parameters.py +++ b/pylot/core/io/default_parameters.py @@ -510,9 +510,14 @@ defaults = {'rootpath': {'type': str, 'namestring': 'Use TauPy'}, 'taup_model': {'type': str, - 'tooltip': 'define TauPy model for traveltime estimation. Possible values: 1066a, 1066b, ak135, ak135f, herrin, iasp91, jb, prem, pwdk, sp6', + 'tooltip': 'Define TauPy model for traveltime estimation. Possible values: 1066a, 1066b, ak135, ak135f, herrin, iasp91, jb, prem, pwdk, sp6', 'value': 'iasp91', - 'namestring': 'TauPy model'} + 'namestring': 'TauPy model'}, + + 'taup_phases': {'type': str, + 'tooltip': 'Specify possible phases for TauPy (comma separated). See Obspy TauPy documentation for possible values.', + 'value': 'ttall', + 'namestring': 'TauPy phases'}, } settings_main = { @@ -551,6 +556,7 @@ settings_main = { 'sstop', 'use_taup', 'taup_model', + 'taup_phases', 'bpz1', 'bpz2', 'bph1', diff --git a/pylot/core/pick/autopick.py b/pylot/core/pick/autopick.py index 5477bbd6..d4c72ecc 100644 --- a/pylot/core/pick/autopick.py +++ b/pylot/core/pick/autopick.py @@ -196,6 +196,7 @@ def autopickstation(wfstream, pickparam, verbose=False, sstop = pickparam.get('sstop') use_taup = real_Bool(pickparam.get('use_taup')) taup_model = pickparam.get('taup_model') + taup_phases = pickparam.get('taup_phases') bph1 = pickparam.get('bph1') bph2 = pickparam.get('bph2') tsnrh = pickparam.get('tsnrh') @@ -302,12 +303,15 @@ def autopickstation(wfstream, pickparam, verbose=False, if station_coords and origin: source_origin = origin[0] model = TauPyModel(taup_model) + # for backward compatibility of older input files + taup_phases = 'ttall' if not taup_phases or taup_phases=='None' else taup_phases arrivals = model.get_travel_times_geo( source_origin.depth, source_origin.latitude, source_origin.longitude, station_coords['latitude'], - station_coords['longitude'] + station_coords['longitude'], + phase_list=[item.strip() for item in taup_phases.split(',')], ) phases = {'P': [], 'S': []} @@ -315,8 +319,12 @@ def autopickstation(wfstream, pickparam, verbose=False, phases[identifyPhaseID(arr.phase.name)].append(arr) # get first P and S onsets from arrivals list - arrP, estFirstP = min([(arr, arr.time) for arr in phases['P']], key=lambda t: t[1]) - arrS, estFirstS = min([(arr, arr.time) for arr in phases['S']], key=lambda t: t[1]) + estFirstP = 0 + estFirstS = 0 + if len(phases['P']) > 0: + arrP, estFirstP = min([(arr, arr.time) for arr in phases['P']], key=lambda t: t[1]) + if len(phases['S']) > 0: + arrS, estFirstS = min([(arr, arr.time) for arr in phases['S']], key=lambda t: t[1]) print('autopick: estimated first arrivals for P: {} s, S:{} s after event' ' origin time using TauPy'.format(estFirstP, estFirstS)) diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index e4d76ebc..0c386d77 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -4636,6 +4636,7 @@ class PhasesTab(PropTab): self.pickDefaultsButton = QtGui.QPushButton('Choose default phases...') PphasesLabel = QLabel("P Phases to pick") SphasesLabel = QLabel("S Phases to pick") + notes_label = QLabel('Note: Selected phases only apply on manual picking. ') settings = QSettings() Pphases = settings.value('p_phases') @@ -4651,8 +4652,10 @@ class PhasesTab(PropTab): layout.addWidget(self.PphasesEdit, 0, 1) layout.addWidget(self.SphasesEdit, 1, 1) + + layout.addWidget(self.pickDefaultsButton, 2, 0) + layout.addWidget(notes_label, 2, 1) self.main_layout.addLayout(layout) - self.main_layout.addWidget(self.pickDefaultsButton) self.setLayout(self.main_layout) self.connectSignals()