[hotfix] earllatepicker recursively modifies isignal to obtain zero-crossing also for low frequency onsets

This commit is contained in:
Sebastian Wehling-Benatelli 2015-09-22 12:29:42 +02:00
parent dedf6eff00
commit 844708bbac

View File

@ -69,24 +69,25 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None):
# get earliest possible pick
EPick = np.nan
pis = isignal[:len(isignal) / 2] if not len(isignal) % 2 else \
isignal[:len(isignal) / 2 + 1]
while np.isnan(EPick):
print("earllatepicker: Doubled signal window size because of NaN for "
"earliest pick.")
isigDoubleWinStart = pis[-1] + 1
isignalDoubleWin = np.arange(isigDoubleWinStart,
isigDoubleWinStart + len(pis))
if (isigDoubleWinStart + len(pis)) < X[0].data.size:
pis = np.concatenate((pis, isignalDoubleWin))
else:
print("Could not double signal window. Index out of bounds.")
break
# determine all zero crossings in signal window (demeaned)
zc = crossings_nonzero_all(x[isignal] - x[isignal].mean())
zc = crossings_nonzero_all(x[pis] - x[pis].mean())
# calculate mean half period T0 of signal as the average of the
T0 = np.mean(np.diff(zc)) * X[0].stats.delta # this is half wave length!
T0 = np.mean(np.diff(zc)) * X[0].stats.delta # this is half wave length
# T0/4 is assumed as time difference between most likely and earliest possible pick!
EPick = Pick1 - T0 / 2
if np.isnan(EPick):
print "earllatepicker: Doubled signal window size because of NaN for earliest pick."
isigDoubleWinStart = isignal[-1] + 1
isignalDoubleWin = np.arange(isigDoubleWinStart, isigDoubleWinStart + len(isignal))
if (isigDoubleWinStart + len(isignal)) < X[0].data.size:
isignal = np.concatenate((isignal, isignalDoubleWin))
else:
isignalDoubleWin = np.arange(isigDoubleWinStart, X[0].data.size)
isignal = np.concatenate((isignal, isignalDoubleWin))
print "Could not double signal window. Index out of bounds."
break
# get symmetric pick error as mean from earliest and latest possible pick