Cleaned up source code, debuged: calculates now T/4 instead of T/8 out of zero crossings.
This commit is contained in:
parent
0ad7e629ce
commit
bebe3a3c45
@ -43,10 +43,9 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None):
|
|||||||
LPick = None
|
LPick = None
|
||||||
EPick = None
|
EPick = None
|
||||||
PickError = None
|
PickError = None
|
||||||
if Pick1 is not None:
|
|
||||||
print 'earllatepicker: Get earliest and latest possible pick relative to most likely pick ...'
|
print 'earllatepicker: Get earliest and latest possible pick relative to most likely pick ...'
|
||||||
|
|
||||||
x =X[0].data
|
x = X[0].data
|
||||||
t = np.arange(0, X[0].stats.npts / X[0].stats.sampling_rate, X[0].stats.delta)
|
t = np.arange(0, X[0].stats.npts / X[0].stats.sampling_rate, X[0].stats.delta)
|
||||||
#some parameters needed:
|
#some parameters needed:
|
||||||
tnoise = TSNR[0] #noise window length for calculating noise level
|
tnoise = TSNR[0] #noise window length for calculating noise level
|
||||||
@ -85,14 +84,14 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None):
|
|||||||
zc.append(t[isignal][i])
|
zc.append(t[isignal][i])
|
||||||
if len(zc) == 3:
|
if len(zc) == 3:
|
||||||
break
|
break
|
||||||
#calculate maximum period of signal out of zero crossings
|
#calculate maximum period T0 of signal out of zero crossings
|
||||||
Ts = max(np.diff(zc))
|
T0 = max(np.diff(zc)) #this is half wave length!
|
||||||
#Ts/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!
|
||||||
EPick = Pick1 - Ts/4
|
EPick = Pick1 - T0/2
|
||||||
|
|
||||||
#get symmetric pick error as mean from earliest and latest possible pick
|
#get symmetric pick error as mean from earliest and latest possible pick
|
||||||
#by weighting latest possible pick two times earliest possible pick
|
#by weighting latest possible pick two times earliest possible pick
|
||||||
diffti_tl = LPick -Pick1
|
diffti_tl = LPick - Pick1
|
||||||
diffti_te = Pick1 - EPick
|
diffti_te = Pick1 - EPick
|
||||||
PickError = (diffti_te + 2 * diffti_tl) / 3
|
PickError = (diffti_te + 2 * diffti_tl) / 3
|
||||||
|
|
||||||
@ -120,10 +119,6 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None):
|
|||||||
raw_input()
|
raw_input()
|
||||||
plt.close(iplot)
|
plt.close(iplot)
|
||||||
|
|
||||||
elif Pick1 == None:
|
|
||||||
print 'earllatepicker: No initial onset time given! Check input!'
|
|
||||||
return
|
|
||||||
|
|
||||||
return EPick, LPick, PickError
|
return EPick, LPick, PickError
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user