Bugfix: Empty polyfit-object is avoided.
This commit is contained in:
parent
1b17842f63
commit
2601ec2865
@ -223,9 +223,15 @@ class AICPicker(AutoPicker):
|
|||||||
# find maximum within slope determination window
|
# find maximum within slope determination window
|
||||||
# 'cause slope should be calculated up to first local minimum only!
|
# 'cause slope should be calculated up to first local minimum only!
|
||||||
imax = np.argmax(self.Data[0].data[islope])
|
imax = np.argmax(self.Data[0].data[islope])
|
||||||
|
iislope = islope[0][0:imax]
|
||||||
|
if len(iislope) <= 2:
|
||||||
|
# calculate slope from initial onset to maximum of AIC function
|
||||||
|
print("AICPicker: Not enough data samples left for slope calculation!")
|
||||||
|
print("Calculating slope from initial onset to maximum of AIC function ...")
|
||||||
|
imax = np.argmax(aicsmooth[islope])
|
||||||
if imax == 0:
|
if imax == 0:
|
||||||
print('AICPicker: Maximum for slope determination right at the beginning of the window!')
|
print("AICPicker: Maximum for slope determination right at the beginning of the window!")
|
||||||
print('Choose longer slope determination window!')
|
print("Choose longer slope determination window!")
|
||||||
if self.iplot > 1:
|
if self.iplot > 1:
|
||||||
if not self.fig:
|
if not self.fig:
|
||||||
fig = plt.figure() #self.iplot) ### WHY? MP MP
|
fig = plt.figure() #self.iplot) ### WHY? MP MP
|
||||||
@ -240,11 +246,6 @@ class AICPicker(AutoPicker):
|
|||||||
ax.set_yticks([])
|
ax.set_yticks([])
|
||||||
ax.set_title(self.Data[0].stats.station)
|
ax.set_title(self.Data[0].stats.station)
|
||||||
return
|
return
|
||||||
|
|
||||||
iislope = islope[0][0:imax]
|
|
||||||
if len(iislope) <= 3:
|
|
||||||
# calculate slope from initial onset to maximum of AIC function
|
|
||||||
imax = np.argmax(aicsmooth[islope])
|
|
||||||
iislope = islope[0][0:imax]
|
iislope = islope[0][0:imax]
|
||||||
dataslope = self.Data[0].data[iislope]
|
dataslope = self.Data[0].data[iislope]
|
||||||
# calculate slope as polynomal fit of order 1
|
# calculate slope as polynomal fit of order 1
|
||||||
|
Loading…
Reference in New Issue
Block a user