Cleaned up source code, debuged: calculates now T/4 instead of T/8 out of zero crossings.

This commit is contained in:
Ludger Küperkoch 2015-03-30 14:18:19 +02:00
parent 0ad7e629ce
commit bebe3a3c45

View File

@ -43,10 +43,9 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None):
LPick = None
EPick = None
PickError = None
if Pick1 is not None:
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)
#some parameters needed:
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])
if len(zc) == 3:
break
#calculate maximum period of signal out of zero crossings
Ts = max(np.diff(zc))
#Ts/4 is assumed as time difference between most likely and earliest possible pick!
EPick = Pick1 - Ts/4
#calculate maximum period T0 of signal out of zero crossings
T0 = max(np.diff(zc)) #this is half wave length!
#T0/4 is assumed as time difference between most likely and earliest possible pick!
EPick = Pick1 - T0/2
#get symmetric pick error as mean from earliest and latest possible pick
#by weighting latest possible pick two times earliest possible pick
diffti_tl = LPick -Pick1
diffti_tl = LPick - Pick1
diffti_te = Pick1 - EPick
PickError = (diffti_te + 2 * diffti_tl) / 3
@ -120,10 +119,6 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None):
raw_input()
plt.close(iplot)
elif Pick1 == None:
print 'earllatepicker: No initial onset time given! Check input!'
return
return EPick, LPick, PickError
if __name__ == "__main__":