[Bugfix] Take into account that initial pick might be very close to start of CF.

This commit is contained in:
Ludger Küperkoch 2017-08-10 17:54:50 +02:00
parent 526cd4303e
commit b36f20ff59

View File

@ -390,7 +390,8 @@ class PragPicker(AutoPicker):
ipick1 = np.argmin(abs(self.Tcf - self.getpick1())) ipick1 = np.argmin(abs(self.Tcf - self.getpick1()))
cfpick1 = 2 * self.cf[ipick1] cfpick1 = 2 * self.cf[ipick1]
# check trend of CF, i.e. differences of CF and adjust aus regarding this trend # check trend of CF, i.e. differences of CF and adjust aus ("artificial uplift
# of picks") regarding this trend
# prominent trend: decrease aus # prominent trend: decrease aus
# flat: use given aus # flat: use given aus
cfdiff = np.diff(cfipick) cfdiff = np.diff(cfipick)
@ -416,6 +417,7 @@ class PragPicker(AutoPicker):
break break
# now we look to the left # now we look to the left
if len(self.cf) > ipick1 +1:
for i in range(ipick1, max([ipick1 - lpickwindow + 1, 2]), -1): for i in range(ipick1, max([ipick1 - lpickwindow + 1, 2]), -1):
if self.cf[i + 1] > self.cf[i] and self.cf[i - 1] >= self.cf[i]: if self.cf[i + 1] > self.cf[i] and self.cf[i - 1] >= self.cf[i]:
if cfsmooth[i - 1] * (1 + aus1) >= cfsmooth[i]: if cfsmooth[i - 1] * (1 + aus1) >= cfsmooth[i]:
@ -425,6 +427,10 @@ class PragPicker(AutoPicker):
flagpick_r = 1 flagpick_r = 1
cfpick_l = self.cf[i] cfpick_l = self.cf[i]
break break
else:
msg ='PragPicker: Initial onset too close to start of CF! \
Stop finalizing pick to the left.'
print(msg)
# now decide which pick: left or right? # now decide which pick: left or right?
if flagpick_l > 0 and flagpick_r > 0 and cfpick_l <= 3 * cfpick_r: if flagpick_l > 0 and flagpick_r > 0 and cfpick_l <= 3 * cfpick_r:
@ -437,7 +443,7 @@ class PragPicker(AutoPicker):
self.Pick = pick_l self.Pick = pick_l
pickflag = 1 pickflag = 1
else: else:
print('PragPicker: Could not find reliable onset!') print("PragPicker: Could not find reliable onset!")
self.Pick = None self.Pick = None
pickflag = 0 pickflag = 0
@ -463,6 +469,6 @@ class PragPicker(AutoPicker):
return return
else: else:
print('PragPicker: No initial onset time given! Check input!') print("PragPicker: No initial onset time given! Check input!")
self.Pick = None self.Pick = None
return return