[add] an exception if unable to find minimum in AIC cf
This commit is contained in:
parent
8f721da643
commit
16a8170e49
@ -201,6 +201,9 @@ class AICPicker(AutoPicker):
|
|||||||
if diffcf[i - 1] >= diffcf[i]:
|
if diffcf[i - 1] >= diffcf[i]:
|
||||||
self.Pick = self.Tcf[i]
|
self.Pick = self.Tcf[i]
|
||||||
break
|
break
|
||||||
|
if self.Pick is None:
|
||||||
|
raise ValueError
|
||||||
|
|
||||||
|
|
||||||
def calcPick(self):
|
def calcPick(self):
|
||||||
"""
|
"""
|
||||||
@ -221,8 +224,12 @@ class AICPicker(AutoPicker):
|
|||||||
self.prepareCF()
|
self.prepareCF()
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return
|
return
|
||||||
|
try:
|
||||||
|
self.findMinimum()
|
||||||
|
except ValueError:
|
||||||
|
print('Could not determine pick on AIC CF')
|
||||||
|
return
|
||||||
|
|
||||||
self.findMinimum()
|
|
||||||
|
|
||||||
# quality assessment using SNR and slope from CF
|
# quality assessment using SNR and slope from CF
|
||||||
if self.Pick is not None:
|
if self.Pick is not None:
|
||||||
|
@ -1281,13 +1281,12 @@ def smooth_cf(cf, t_smooth, delta):
|
|||||||
|
|
||||||
if len(cf) < ismooth:
|
if len(cf) < ismooth:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
for i in range(1, len(cf)):
|
||||||
for i, val in enumerate(cf):
|
if i > ismooth:
|
||||||
if i <= ismooth:
|
|
||||||
cf_smooth[i] = np.mean(cf[0:i+1])
|
|
||||||
elif i > ismooth:
|
|
||||||
ii1 = i - ismooth
|
ii1 = i - ismooth
|
||||||
cf_smooth[i] = cf_smooth[i - 1] + (cf[i] - cf[ii1]) / ismooth
|
cf_smooth[i] = cf_smooth[i - 1] + (cf[i] - cf[ii1]) / ismooth
|
||||||
|
else:
|
||||||
|
cf_smooth[i] = np.mean(cf[1: i])
|
||||||
offset = abs(min(cf) - min(cf_smooth))
|
offset = abs(min(cf) - min(cf_smooth))
|
||||||
cf_smooth -= offset # remove offset from smoothed function
|
cf_smooth -= offset # remove offset from smoothed function
|
||||||
return cf_smooth
|
return cf_smooth
|
||||||
|
Loading…
Reference in New Issue
Block a user