[bugfix] updated EPick nan fix

This commit is contained in:
Marcel Paffrath 2015-09-22 13:41:19 +02:00
parent 844708bbac
commit 217db9bbdd

View File

@ -68,12 +68,14 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None):
# get earliest possible pick # get earliest possible pick
EPick = np.nan EPick = np.nan; count = 0
pis = isignal[:len(isignal) / 2] if not len(isignal) % 2 else \ pis = isignal
isignal[:len(isignal) / 2 + 1]
# if EPick stays NaN the signal window size will be doubled
while np.isnan(EPick): while np.isnan(EPick):
print("earllatepicker: Doubled signal window size because of NaN for " if count > 0:
"earliest pick.") print("earllatepicker: Doubled signal window size %s time(s) "
"because of NaN for earliest pick." %count)
isigDoubleWinStart = pis[-1] + 1 isigDoubleWinStart = pis[-1] + 1
isignalDoubleWin = np.arange(isigDoubleWinStart, isignalDoubleWin = np.arange(isigDoubleWinStart,
isigDoubleWinStart + len(pis)) isigDoubleWinStart + len(pis))
@ -82,6 +84,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None):
else: else:
print("Could not double signal window. Index out of bounds.") print("Could not double signal window. Index out of bounds.")
break break
count += 1
# determine all zero crossings in signal window (demeaned) # determine all zero crossings in signal window (demeaned)
zc = crossings_nonzero_all(x[pis] - x[pis].mean()) zc = crossings_nonzero_all(x[pis] - x[pis].mean())
# calculate mean half period T0 of signal as the average of the # calculate mean half period T0 of signal as the average of the