Modified earllatepicker: Mean is removed from trace calculated from noise + signal window.

This commit is contained in:
Ludger Küperkoch 2015-06-22 12:39:29 +02:00
parent 635ac1686b
commit aba3997b20

View File

@ -53,6 +53,9 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None):
inoise = getnoisewin(t, Pick1, TSNR[0], TSNR[1])
# get signal window
isignal = getsignalwin(t, Pick1, TSNR[2])
# remove mean
meanwin = np.hstack((inoise, isignal))
x = x - np.mean(x[meanwin])
# calculate noise level
nlevel = np.sqrt(np.mean(np.square(x[inoise]))) * nfac
# get time where signal exceeds nlevel
@ -417,18 +420,12 @@ def wadaticheck(pickdic, dttolerance, iplot):
# add S-P time to dictionary
pickdic[key]['SPt'] = spt
# add P onsets and corresponding S-P times to list
UTCPpick = UTCDateTime(pickdic[key]['P']['mpp']) - UTCDateTime(1970,
1, 1,
0, 0,
0)
UTCSpick = UTCDateTime(pickdic[key]['S']['mpp']) - UTCDateTime(1970,
1, 1,
0, 0,
0)
Ppicks.append(UTCPpick)
Spicks.append(UTCSpick)
UTCPpick = UTCDateTime(pickdic[key]['P']['mpp'])
UTCSpick = UTCDateTime(pickdic[key]['S']['mpp'])
Ppicks.append(UTCPpick.timestamp)
Spicks.append(UTCSpick.timestamp)
SPtimes.append(spt)
vpvs.append(UTCPpick / UTCSpick)
if len(SPtimes) >= 3:
# calculate slope
@ -457,16 +454,12 @@ def wadaticheck(pickdic, dttolerance, iplot):
pickdic[key]['S']['weight'] = 9
else:
marker = 'goodWadatiCheck'
checkedPpick = UTCDateTime(pickdic[key]['P']['mpp']) - \
UTCDateTime(1970, 1, 1, 0, 0, 0)
checkedPpicks.append(checkedPpick)
checkedSpick = UTCDateTime(pickdic[key]['S']['mpp']) - \
UTCDateTime(1970, 1, 1, 0, 0, 0)
checkedSpicks.append(checkedSpick)
checkedSPtime = pickdic[key]['S']['mpp'] - \
pickdic[key]['P']['mpp']
checkedPpick = UTCDateTime(pickdic[key]['P']['mpp'])
checkedPpicks.append(checkedPpick.timestamp)
checkedSpick = UTCDateTime(pickdic[key]['S']['mpp'])
checkedSpicks.append(checkedSpick.timestamp)
checkedSPtime = pickdic[key]['S']['mpp'] - pickdic[key]['P']['mpp']
checkedSPtimes.append(checkedSPtime)
checkedvpvs.append(checkedPpick / checkedSpick)
pickdic[key]['S']['marked'] = marker
@ -496,11 +489,9 @@ def wadaticheck(pickdic, dttolerance, iplot):
f4, = plt.plot(checkedPpicks, wdfit2, 'g')
plt.ylabel('S-P Times [s]')
plt.xlabel('P Times [s]')
plt.title(
'Wadati-Diagram, %d S-P Times, Vp/Vs(old)=%5.2f, Vp/Vs(checked)=%5.2f' \
plt.title('Wadati-Diagram, %d S-P Times, Vp/Vs(raw)=%5.2f, Vp/Vs(checked)=%5.2f' \
% (len(SPtimes), vpvsr, cvpvsr))
plt.legend([f1, f2, f3, f4],
['Skipped S-Picks', 'Wadati 1', 'Reliable S-Picks', \
plt.legend([f1, f2, f3, f4], ['Skipped S-Picks', 'Wadati 1', 'Reliable S-Picks', \
'Wadati 2'], loc='best')
plt.show()
raw_input()