[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 matplotlib.pyplot as plt
import numpy as np import numpy as np
from scipy.signal import argrelmax
from pylot.core.pick.charfuns import CharacteristicFunction from pylot.core.pick.charfuns import CharacteristicFunction
from pylot.core.pick.utils import getnoisewin, getsignalwin from pylot.core.pick.utils import getnoisewin, getsignalwin
@ -252,6 +253,10 @@ class AICPicker(AutoPicker):
if len(dataslope) < 1: if len(dataslope) < 1:
print('No data in slope window found!') print('No data in slope window found!')
return return
imaxs, = argrelmax(dataslope)
if imaxs.size:
imax = imaxs[0]
else:
imax = np.argmax(dataslope) imax = np.argmax(dataslope)
iislope = islope[0][0:imax + 1] iislope = islope[0][0:imax + 1]
if len(iislope) < 2: if len(iislope) < 2: