[Bugfix]: Check for key S and be sure to get element weight for pick

dictionary.
This commit is contained in:
2020-07-29 12:14:42 +02:00
parent b7795ca562
commit e64135c7a8
2 changed files with 22 additions and 13 deletions
+7 -2
View File
@@ -316,8 +316,13 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None, linecolor='k'):
islope2 = np.where((t >= Pick) & (t <= Pick + t[imax2]))
# calculate slope as polynomal fit of order 1
xslope2 = np.arange(0, len(xfilt[islope2]), 1)
P2 = np.polyfit(xslope2, xfilt[islope2], 1)
datafit2 = np.polyval(P2, xslope2)
try:
P2 = np.polyfit(xslope2, xfilt[islope2], 1)
datafit2 = np.polyval(P2, xslope2)
except ValueError as e:
emsg = 'fmpicker: polyfit failed: {}'.format(e)
print(emsg)
return FM
# compare results
if P1 is not None and P2 is not None: