[bugfix] calculate slope up to first local maximum only

before it was calculated to global maximum in slope window
This commit is contained in:
Darius Arnold 2017-09-07 16:47:42 +02:00
parent 8a600e1bfa
commit 49adc5418f

View File

@ -23,6 +23,7 @@ import warnings
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import argrelmax
from pylot.core.pick.charfuns import CharacteristicFunction
from pylot.core.pick.utils import getnoisewin, getsignalwin
@ -252,8 +253,12 @@ class AICPicker(AutoPicker):
if len(dataslope) < 1:
print('No data in slope window found!')
return
imaxs, = argrelmax(dataslope)
if imaxs.size:
imax = imaxs[0]
else:
imax = np.argmax(dataslope)
iislope = islope[0][0:imax+1]
iislope = islope[0][0:imax + 1]
if len(iislope) < 2:
# calculate slope from initial onset to maximum of AIC function
print("AICPicker: Not enough data samples left for slope calculation!")