[add] for global seismology CF pick windows will now be calculated
relative to estimated tt from TauPy, metadata and source location (in XML file) needed [TO DO]: automatic export of XML (esp. source loc) before autopicking
This commit is contained in:
1 parent
60ebaa6528
commit
17a93cf62f
7 files changed
+169
-87
No files matched your search
@@ -9,7 +9,7 @@ Created on Wed Feb 26 12:31:25 2014
|
||||
import os
|
||||
import platform
|
||||
|
||||
from pylot.core.io.inputs import PylotParameter
|
||||
from pylot.core.util.utils import readDefaultFilterInformation
|
||||
from pylot.core.loc import hypo71
|
||||
from pylot.core.loc import hypodd
|
||||
from pylot.core.loc import hyposat
|
||||
@@ -17,23 +17,6 @@ from pylot.core.loc import nll
|
||||
from pylot.core.loc import velest
|
||||
|
||||
|
||||
def readDefaultFilterInformation(fname):
|
||||
pparam = PylotParameter(fname)
|
||||
return readFilterInformation(pparam)
|
||||
|
||||
|
||||
def readFilterInformation(pylot_parameter):
|
||||
p_filter = {'filtertype': pylot_parameter['filter_type'][0],
|
||||
'freq': [pylot_parameter['minfreq'][0], pylot_parameter['maxfreq'][0]],
|
||||
'order': int(pylot_parameter['filter_order'][0])}
|
||||
s_filter = {'filtertype': pylot_parameter['filter_type'][1],
|
||||
'freq': [pylot_parameter['minfreq'][1], pylot_parameter['maxfreq'][1]],
|
||||
'order': int(pylot_parameter['filter_order'][1])}
|
||||
filter_information = {'P': p_filter,
|
||||
'S': s_filter}
|
||||
return filter_information
|
||||
|
||||
|
||||
# determine system dependent path separator
|
||||
system_name = platform.system()
|
||||
if system_name in ["Linux", "Darwin"]:
|
||||
|
||||
@@ -10,8 +10,8 @@ import subprocess
|
||||
import numpy as np
|
||||
from obspy import UTCDateTime, read
|
||||
from pylot.core.io.inputs import PylotParameter
|
||||
from scipy.interpolate import splrep, splev
|
||||
|
||||
from scipy.interpolate import splrep, splev
|
||||
|
||||
def _pickle_method(m):
|
||||
if m.im_self is None:
|
||||
@@ -20,6 +20,23 @@ def _pickle_method(m):
|
||||
return getattr, (m.im_self, m.im_func.func_name)
|
||||
|
||||
|
||||
def readDefaultFilterInformation(fname):
|
||||
pparam = PylotParameter(fname)
|
||||
return readFilterInformation(pparam)
|
||||
|
||||
|
||||
def readFilterInformation(pylot_parameter):
|
||||
p_filter = {'filtertype': pylot_parameter['filter_type'][0],
|
||||
'freq': [pylot_parameter['minfreq'][0], pylot_parameter['maxfreq'][0]],
|
||||
'order': int(pylot_parameter['filter_order'][0])}
|
||||
s_filter = {'filtertype': pylot_parameter['filter_type'][1],
|
||||
'freq': [pylot_parameter['minfreq'][1], pylot_parameter['maxfreq'][1]],
|
||||
'order': int(pylot_parameter['filter_order'][1])}
|
||||
filter_information = {'P': p_filter,
|
||||
'S': s_filter}
|
||||
return filter_information
|
||||
|
||||
|
||||
def fit_curve(x, y):
|
||||
return splev, splrep(x, y)
|
||||
|
||||
@@ -551,6 +568,51 @@ def which(program, infile=None):
|
||||
return None
|
||||
|
||||
|
||||
def loopIdentifyPhase(phase):
|
||||
'''
|
||||
Loop through phase string and try to recognize its type (P or S wave).
|
||||
Global variable ALTSUFFIX gives alternative suffix for phases if they do not end with P, p or S, s.
|
||||
If ALTSUFFIX is not given, the function will cut the last letter of the phase string until string ends
|
||||
with P or S.
|
||||
:param phase: phase name (str)
|
||||
:return:
|
||||
'''
|
||||
from pylot.core.util.defaults import ALTSUFFIX
|
||||
|
||||
phase_copy = phase
|
||||
while not identifyPhase(phase_copy):
|
||||
identified = False
|
||||
for alt_suf in ALTSUFFIX:
|
||||
if phase_copy.endswith(alt_suf):
|
||||
phase_copy = phase_copy.split(alt_suf)[0]
|
||||
identified = True
|
||||
if not identified:
|
||||
phase_copy = phase_copy[:-1]
|
||||
if len(phase_copy) < 1:
|
||||
print('Warning: Could not identify phase {}!'.format(phase))
|
||||
return
|
||||
return phase_copy
|
||||
|
||||
|
||||
def identifyPhase(phase):
|
||||
'''
|
||||
Returns capital P or S if phase string is identified by last letter. Else returns False.
|
||||
:param phase: phase name (str)
|
||||
:return: 'P', 'S' or False
|
||||
'''
|
||||
# common phase suffix for P and S
|
||||
common_P = ['P', 'p']
|
||||
common_S = ['S', 's']
|
||||
if phase[-1] in common_P:
|
||||
return 'P'
|
||||
if phase[-1] in common_S:
|
||||
return 'S'
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ except:
|
||||
pg = None
|
||||
|
||||
from matplotlib.figure import Figure
|
||||
from pylot.core.util.utils import find_horizontals
|
||||
from pylot.core.util.utils import find_horizontals, identifyPhase, loopIdentifyPhase
|
||||
|
||||
try:
|
||||
from matplotlib.backends.backend_qt4agg import FigureCanvas
|
||||
@@ -46,7 +46,7 @@ from pylot.core.io.inputs import FilterOptions, PylotParameter
|
||||
from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin, \
|
||||
getResolutionWindow
|
||||
from pylot.core.pick.compare import Comparison
|
||||
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, ALTSUFFIX, \
|
||||
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, \
|
||||
SetChannelComponents
|
||||
from pylot.core.util.utils import prepTimeAxis, full_range, scaleWFData, \
|
||||
demeanTrace, isSorted, findComboBoxIndex, clims
|
||||
@@ -118,34 +118,6 @@ def createAction(parent, text, slot=None, shortcut=None, icon=None,
|
||||
return action
|
||||
|
||||
|
||||
def loopIdentifyPhase(phase):
|
||||
phase_copy = phase
|
||||
while not identifyPhase(phase_copy):
|
||||
identified = False
|
||||
for alt_suf in ALTSUFFIX:
|
||||
if phase_copy.endswith(alt_suf):
|
||||
phase_copy = phase_copy.split(alt_suf)[0]
|
||||
identified = True
|
||||
if not identified:
|
||||
phase_copy = phase_copy[:-1]
|
||||
if len(phase_copy) < 1:
|
||||
print('Warning: Could not identify phase {}!'.format(phase))
|
||||
return
|
||||
return phase_copy
|
||||
|
||||
|
||||
def identifyPhase(phase):
|
||||
# common phase suffix for P and S
|
||||
common_P = ['P', 'p']
|
||||
common_S = ['S', 's']
|
||||
if phase[-1] in common_P:
|
||||
return 'P'
|
||||
if phase[-1] in common_S:
|
||||
return 'S'
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
class ComparisonDialog(QDialog):
|
||||
def __init__(self, c, parent=None):
|
||||
self._data = c
|
||||
|
||||
Reference in new issue
Block a user