[Bugfix] Take into account that initial pick might be very close to start of CF.
This commit is contained in:
parent
526cd4303e
commit
b36f20ff59
@ -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,15 +417,20 @@ class PragPicker(AutoPicker):
|
|||||||
break
|
break
|
||||||
|
|
||||||
# now we look to the left
|
# now we look to the left
|
||||||
for i in range(ipick1, max([ipick1 - lpickwindow + 1, 2]), -1):
|
if len(self.cf) > ipick1 +1:
|
||||||
if self.cf[i + 1] > self.cf[i] and self.cf[i - 1] >= self.cf[i]:
|
for i in range(ipick1, max([ipick1 - lpickwindow + 1, 2]), -1):
|
||||||
if cfsmooth[i - 1] * (1 + aus1) >= cfsmooth[i]:
|
if self.cf[i + 1] > self.cf[i] and self.cf[i - 1] >= self.cf[i]:
|
||||||
if cfpick1 >= self.cf[i]:
|
if cfsmooth[i - 1] * (1 + aus1) >= cfsmooth[i]:
|
||||||
pick_l = self.Tcf[i]
|
if cfpick1 >= self.cf[i]:
|
||||||
self.Pick = pick_l
|
pick_l = self.Tcf[i]
|
||||||
flagpick_r = 1
|
self.Pick = pick_l
|
||||||
cfpick_l = self.cf[i]
|
flagpick_r = 1
|
||||||
break
|
cfpick_l = self.cf[i]
|
||||||
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user