Simplified AIC-picking algorithm: Onset is definetly the minimum in front of maximum of AIC-CF! Smoothing of AIC-CF no more necessary.
This commit is contained in:
parent
201c34a85b
commit
31273b384e
@ -23,7 +23,7 @@ class AutoPicking(object):
|
|||||||
Superclass of different, automated picking algorithms applied on a CF determined
|
Superclass of different, automated picking algorithms applied on a CF determined
|
||||||
using AIC, HOS, or AR prediction.
|
using AIC, HOS, or AR prediction.
|
||||||
'''
|
'''
|
||||||
def __init__(self, cf, Tslope, aerr, TSNR, PickWindow, peps, Tsmooth):
|
def __init__(self, cf, Tslope, aerr, TSNR, PickWindow, peps=None, Tsmooth=None):
|
||||||
'''
|
'''
|
||||||
:param: cf, characteristic function, on which the picking algorithm is applied
|
:param: cf, characteristic function, on which the picking algorithm is applied
|
||||||
:type: `~pylot.core.pick.CharFuns.CharacteristicFunction` object
|
:type: `~pylot.core.pick.CharFuns.CharacteristicFunction` object
|
||||||
@ -48,6 +48,9 @@ class AutoPicking(object):
|
|||||||
:type: float
|
:type: float
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
#assert isinstance(cf, CharFuns), "%s is not a CharacteristicFunction object" % str(cf)
|
||||||
|
#wie kann man hier isinstance benutzen?
|
||||||
|
|
||||||
self.cf = cf.getCF()
|
self.cf = cf.getCF()
|
||||||
self.Tcf = cf.getTimeArray()
|
self.Tcf = cf.getTimeArray()
|
||||||
self.dt = cf.getIncrement()
|
self.dt = cf.getIncrement()
|
||||||
@ -127,45 +130,23 @@ class AICPicker(AutoPicking):
|
|||||||
|
|
||||||
print 'Get onset (pick) from AIC-CF ...'
|
print 'Get onset (pick) from AIC-CF ...'
|
||||||
|
|
||||||
|
self.Pick = -1
|
||||||
#taper AIC-CF to get rid off side maxima
|
#taper AIC-CF to get rid off side maxima
|
||||||
tap = np.hanning(len(self.cf))
|
tap = np.hanning(len(self.cf))
|
||||||
aic = tap * self.cf + max(abs(self.cf))
|
aic = tap * self.cf + max(abs(self.cf))
|
||||||
#get maximum of CF as starting point
|
#get maximum of CF as starting point
|
||||||
icfmax = np.argmax(aic)
|
icfmax = np.argmax(aic)
|
||||||
|
|
||||||
#smooth CF
|
#find minimum in front of maximum
|
||||||
aicsmooth = np.zeros(len(aic))
|
|
||||||
ismooth = round(self.Tsmooth / self.dt)
|
|
||||||
if len(aic) < ismooth:
|
|
||||||
print 'AICPicker: Tsmooth larger than AIC function!'
|
|
||||||
self.Pick = -1
|
|
||||||
return self.Pick
|
|
||||||
else:
|
|
||||||
self.Pick = -1
|
|
||||||
for i in range(1, len(aic)):
|
|
||||||
if i > ismooth:
|
|
||||||
ii1 = i - ismooth
|
|
||||||
aicsmooth[i] = aicsmooth[i - 1] + (aic[i] - aic[ii1]) / ismooth
|
|
||||||
else:
|
|
||||||
aicsmooth[i] = np.mean(aic[0:i])
|
|
||||||
|
|
||||||
#find common, local minimum in front of maximum
|
|
||||||
#of smoothed and unsmoothed AIC-CF
|
|
||||||
lpickwindow = int(round(self.PickWindow / self.dt))
|
lpickwindow = int(round(self.PickWindow / self.dt))
|
||||||
for i in range(icfmax - 1, max([icfmax - lpickwindow, 2]), -1):
|
for i in range(icfmax - 1, max([icfmax - lpickwindow, 2]), -1):
|
||||||
if aic[i - 1] * (1 + self.peps) >= aic[i]:
|
if aic[i - 1] >= aic[i]:
|
||||||
if aicsmooth[i - 1] * (1 + self.peps) >= aicsmooth[i]:
|
self.Pick = self.Tcf[i]
|
||||||
self.Pick = self.Tcf[i]
|
break
|
||||||
break
|
if self.Pick == -1:
|
||||||
|
print 'AICPicker: Could not find minimum, picking window too short?'
|
||||||
|
|
||||||
#try again with larger peps if picking failed
|
return self.Pick
|
||||||
if self.Pick < 0:
|
|
||||||
peps2 = self.peps + 0.01
|
|
||||||
for i in range(icfmax - 1, max([icfmax - lpickwindow, 2]), -1):
|
|
||||||
if aic[i - 1] * (1 + peps2) >= aic[i]:
|
|
||||||
if aicsmooth[i - 1] * (1 + peps2) >= aicsmooth[i]:
|
|
||||||
self.Pick = self.Tcf[i]
|
|
||||||
break
|
|
||||||
|
|
||||||
class PragPicker(AutoPicking):
|
class PragPicker(AutoPicking):
|
||||||
'''
|
'''
|
||||||
|
Loading…
Reference in New Issue
Block a user