[bugfix] determination of zero crossings breaks down if data is not demeaned in the signal window (explicitly demeaning data in the signal window when determining the zero crossings)
This commit is contained in:
parent
a95caa5efc
commit
864ef6c64d
@ -65,8 +65,8 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None):
|
|||||||
|
|
||||||
#get earliest possible pick
|
#get earliest possible pick
|
||||||
|
|
||||||
#determine all zero crossings in signal window
|
#determine all zero crossings in signal window (demeaned)
|
||||||
zc = crossings_nonzero_all(x[isignal])
|
zc = crossings_nonzero_all(x[isignal] - x[isignal].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
|
||||||
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!
|
#T0/4 is assumed as time difference between most likely and earliest possible pick!
|
||||||
@ -390,8 +390,8 @@ def wadaticheck(pickdic, dttolerance, iplot):
|
|||||||
|
|
||||||
: param: pickdic, dictionary containing picks and quality parameters
|
: param: pickdic, dictionary containing picks and quality parameters
|
||||||
: type: dictionary
|
: type: dictionary
|
||||||
|
|
||||||
: param: dttolerance, maximum adjusted deviation of S-P time from
|
: param: dttolerance, maximum adjusted deviation of S-P time from
|
||||||
S-P time regression
|
S-P time regression
|
||||||
: type: float
|
: type: float
|
||||||
|
|
||||||
@ -425,11 +425,11 @@ def wadaticheck(pickdic, dttolerance, iplot):
|
|||||||
print 'wadaticheck: Average Vp/Vs ratio before check:', vpvsr
|
print 'wadaticheck: Average Vp/Vs ratio before check:', vpvsr
|
||||||
|
|
||||||
if len(SPtimes) >= 3:
|
if len(SPtimes) >= 3:
|
||||||
# calculate slope
|
# calculate slope
|
||||||
p1 = np.polyfit(Ppicks, SPtimes, 1)
|
p1 = np.polyfit(Ppicks, SPtimes, 1)
|
||||||
wdfit = np.polyval(p1, Ppicks)
|
wdfit = np.polyval(p1, Ppicks)
|
||||||
wfitflag = 0
|
wfitflag = 0
|
||||||
|
|
||||||
checkedPpicks = []
|
checkedPpicks = []
|
||||||
checkedSpicks = []
|
checkedSpicks = []
|
||||||
checkedSPtimes = []
|
checkedSPtimes = []
|
||||||
@ -438,11 +438,11 @@ def wadaticheck(pickdic, dttolerance, iplot):
|
|||||||
for key in pickdic:
|
for key in pickdic:
|
||||||
if pickdic[key].has_key('SPt'):
|
if pickdic[key].has_key('SPt'):
|
||||||
ii = 0
|
ii = 0
|
||||||
wddiff = abs(pickdic[key]['SPt'] - wdfit[ii])
|
wddiff = abs(pickdic[key]['SPt'] - wdfit[ii])
|
||||||
ii += 1
|
ii += 1
|
||||||
# check, if deviation is larger than adjusted
|
# check, if deviation is larger than adjusted
|
||||||
if wddiff >= dttolerance:
|
if wddiff >= dttolerance:
|
||||||
# mark onset and downgrade S-weight to 9
|
# mark onset and downgrade S-weight to 9
|
||||||
# (not used anymore)
|
# (not used anymore)
|
||||||
marker = 'badWadatiCheck'
|
marker = 'badWadatiCheck'
|
||||||
pickdic[key]['S']['weight'] = 9
|
pickdic[key]['S']['weight'] = 9
|
||||||
@ -465,12 +465,12 @@ def wadaticheck(pickdic, dttolerance, iplot):
|
|||||||
cvpvsr = np.mean(checkedvpvs)
|
cvpvsr = np.mean(checkedvpvs)
|
||||||
print 'wadaticheck: Average Vp/Vs ratio after check:', cvpvsr
|
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)
|
||||||
|
|
||||||
checkedonsets = pickdic
|
checkedonsets = pickdic
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print 'wadaticheck: Not enough S-P times available for reliable regression!'
|
print 'wadaticheck: Not enough S-P times available for reliable regression!'
|
||||||
print 'Skip wadati check!'
|
print 'Skip wadati check!'
|
||||||
|
Loading…
Reference in New Issue
Block a user