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