Corrected calculation of Vp/Vs ratio in wadaticheck, now determined from slope of trend as it should be.
This commit is contained in:
parent
a95caa5efc
commit
3330a3ae35
@ -409,7 +409,7 @@ def wadaticheck(pickdic, dttolerance, iplot):
|
|||||||
for key in pickdic:
|
for key in pickdic:
|
||||||
if pickdic[key]['P']['weight'] < 4 and pickdic[key]['S']['weight'] < 4:
|
if pickdic[key]['P']['weight'] < 4 and pickdic[key]['S']['weight'] < 4:
|
||||||
# calculate S-P time
|
# calculate S-P time
|
||||||
spt = UTCDateTime(pickdic[key]['S']['mpp']) - UTCDateTime(pickdic[key]['P']['mpp'])
|
spt = pickdic[key]['S']['mpp'] - pickdic[key]['P']['mpp']
|
||||||
# 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
|
||||||
@ -420,9 +420,6 @@ def wadaticheck(pickdic, dttolerance, iplot):
|
|||||||
SPtimes.append(spt)
|
SPtimes.append(spt)
|
||||||
vpvs.append(UTCPpick/UTCSpick)
|
vpvs.append(UTCPpick/UTCSpick)
|
||||||
|
|
||||||
# calculate average vp/vs ratio before check
|
|
||||||
vpvsr = np.mean(vpvs)
|
|
||||||
print 'wadaticheck: Average Vp/Vs ratio before check:', vpvsr
|
|
||||||
|
|
||||||
if len(SPtimes) >= 3:
|
if len(SPtimes) >= 3:
|
||||||
# calculate slope
|
# calculate slope
|
||||||
@ -430,6 +427,10 @@ def wadaticheck(pickdic, dttolerance, iplot):
|
|||||||
wdfit = np.polyval(p1, Ppicks)
|
wdfit = np.polyval(p1, Ppicks)
|
||||||
wfitflag = 0
|
wfitflag = 0
|
||||||
|
|
||||||
|
# calculate average vp/vs ratio before check
|
||||||
|
vpvsr = p1[0] + 1
|
||||||
|
print 'wadaticheck: Average Vp/Vs ratio before check:', vpvsr
|
||||||
|
|
||||||
checkedPpicks = []
|
checkedPpicks = []
|
||||||
checkedSpicks = []
|
checkedSpicks = []
|
||||||
checkedSPtimes = []
|
checkedSPtimes = []
|
||||||
@ -454,21 +455,21 @@ def wadaticheck(pickdic, dttolerance, iplot):
|
|||||||
checkedSpick = UTCDateTime(pickdic[key]['S']['mpp']) - \
|
checkedSpick = UTCDateTime(pickdic[key]['S']['mpp']) - \
|
||||||
UTCDateTime(1970,1,1,0,0,0)
|
UTCDateTime(1970,1,1,0,0,0)
|
||||||
checkedSpicks.append(checkedSpick)
|
checkedSpicks.append(checkedSpick)
|
||||||
checkedSPtime = UTCDateTime(pickdic[key]['S']['mpp']) - \
|
checkedSPtime = pickdic[key]['S']['mpp'] - pickdic[key]['P']['mpp']
|
||||||
UTCDateTime(pickdic[key]['P']['mpp'])
|
|
||||||
checkedSPtimes.append(checkedSPtime)
|
checkedSPtimes.append(checkedSPtime)
|
||||||
checkedvpvs.append(checkedPpick/checkedSpick)
|
checkedvpvs.append(checkedPpick/checkedSpick)
|
||||||
|
|
||||||
pickdic[key]['S']['marked'] = marker
|
pickdic[key]['S']['marked'] = marker
|
||||||
|
|
||||||
# calculate average vp/vs ratio after check
|
|
||||||
cvpvsr = np.mean(checkedvpvs)
|
|
||||||
print 'wadaticheck: Average Vp/Vs ratio after check:', cvpvsr
|
|
||||||
|
|
||||||
# calculate new slope
|
# calculate new slope
|
||||||
p2 = np.polyfit(checkedPpicks, checkedSPtimes, 1)
|
p2 = np.polyfit(checkedPpicks, checkedSPtimes, 1)
|
||||||
wdfit2 = np.polyval(p2, checkedPpicks)
|
wdfit2 = np.polyval(p2, checkedPpicks)
|
||||||
|
|
||||||
|
# calculate average vp/vs ratio after check
|
||||||
|
cvpvsr = p2[0] + 1
|
||||||
|
print 'wadaticheck: Average Vp/Vs ratio after check:', cvpvsr
|
||||||
|
|
||||||
checkedonsets = pickdic
|
checkedonsets = pickdic
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -478,7 +479,7 @@ def wadaticheck(pickdic, dttolerance, iplot):
|
|||||||
|
|
||||||
# plot results
|
# plot results
|
||||||
if iplot > 1:
|
if iplot > 1:
|
||||||
f = plt.figure(iplot)
|
plt.figure(iplot)
|
||||||
f1, = plt.plot(Ppicks, SPtimes, 'ro')
|
f1, = plt.plot(Ppicks, SPtimes, 'ro')
|
||||||
if wfitflag == 0:
|
if wfitflag == 0:
|
||||||
f2, = plt.plot(Ppicks, wdfit, 'k')
|
f2, = plt.plot(Ppicks, wdfit, 'k')
|
||||||
@ -492,6 +493,6 @@ def wadaticheck(pickdic, dttolerance, iplot):
|
|||||||
'Wadati 2'], loc='best')
|
'Wadati 2'], loc='best')
|
||||||
plt.show()
|
plt.show()
|
||||||
raw_input()
|
raw_input()
|
||||||
plt.close(f)
|
plt.close(iplot)
|
||||||
|
|
||||||
return checkedonsets
|
return checkedonsets
|
||||||
|
Loading…
Reference in New Issue
Block a user