[bugfix] pickDlg takes into account timeshift of trace.starttime for different components
[add] initial pick displayed in pickDlg
This commit is contained in:
@@ -14,7 +14,7 @@ import numpy as np
|
||||
from obspy.core import Stream, UTCDateTime
|
||||
|
||||
|
||||
def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealth_mode=False, fig=None):
|
||||
def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, verbosity=1, fig=None):
|
||||
'''
|
||||
Function to derive earliest and latest possible pick after Diehl & Kissling (2009)
|
||||
as reasonable uncertainties. Latest possible pick is based on noise level,
|
||||
@@ -40,10 +40,16 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealth_mode=False, fig=Non
|
||||
|
||||
assert isinstance(X, Stream), "%s is not a stream object" % str(X)
|
||||
|
||||
if verbosity == 2:
|
||||
print('earllatepicker:')
|
||||
print('nfac:', nfac)
|
||||
print('Init pick:', Pick1)
|
||||
print('TSNR (T_noise, T_gap, T_signal):', TSNR)
|
||||
|
||||
LPick = None
|
||||
EPick = None
|
||||
PickError = None
|
||||
if stealth_mode is False:
|
||||
if verbosity:
|
||||
print('earllatepicker: Get earliest and latest possible pick'
|
||||
' relative to most likely pick ...')
|
||||
|
||||
@@ -57,11 +63,18 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealth_mode=False, fig=Non
|
||||
x = x - np.mean(x[inoise])
|
||||
# calculate noise level
|
||||
nlevel = np.sqrt(np.mean(np.square(x[inoise]))) * nfac
|
||||
if verbosity == 2:
|
||||
print('x:', x)
|
||||
print('t:', t)
|
||||
print('x_inoise:', x[inoise])
|
||||
print('x_isignal:', x[isignal])
|
||||
print('nlevel:', nlevel)
|
||||
|
||||
# get time where signal exceeds nlevel
|
||||
ilup, = np.where(x[isignal] > nlevel)
|
||||
ildown, = np.where(x[isignal] < -nlevel)
|
||||
if not ilup.size and not ildown.size:
|
||||
if stealth_mode is False:
|
||||
if verbosity:
|
||||
print ("earllatepicker: Signal lower than noise level!\n"
|
||||
"Skip this trace!")
|
||||
return LPick, EPick, PickError
|
||||
@@ -78,7 +91,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealth_mode=False, fig=Non
|
||||
# if EPick stays NaN the signal window size will be doubled
|
||||
while np.isnan(EPick):
|
||||
if count > 0:
|
||||
if stealth_mode is False:
|
||||
if verbosity:
|
||||
print("\nearllatepicker: Doubled signal window size %s time(s) "
|
||||
"because of NaN for earliest pick." % count)
|
||||
isigDoubleWinStart = pis[-1] + 1
|
||||
@@ -87,7 +100,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealth_mode=False, fig=Non
|
||||
if (isigDoubleWinStart + len(pis)) < X[0].data.size:
|
||||
pis = np.concatenate((pis, isignalDoubleWin))
|
||||
else:
|
||||
if stealth_mode is False:
|
||||
if verbosity:
|
||||
print("Could not double signal window. Index out of bounds.")
|
||||
break
|
||||
count += 1
|
||||
|
||||
Reference in New Issue
Block a user