diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..abf86eb --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: generic +python: + -"3.6" +script: + - pytest diff --git a/maxima.py b/maxima.py index ed03ef6..a9b7659 100755 --- a/maxima.py +++ b/maxima.py @@ -14,8 +14,13 @@ def find_maxima(x): """ idx = [] + max = (len(x)-1) for i in range(len(x)): # `i` is a local maximum if the signal decreases before and after it - if x[i-1] < x[i] and x[i+1] < x[i]: + if i ==0 and x[i+1] <= x[i]: + idx.append(i) + elif i ==max and x[i-1] <= x[i]: + idx.append(i) + elif 0 test_vec[1] + else: + for k in range(1,out[0]): + assert test_vec[k]>=test_vec[k-1] + if len(out)>3 : + up=False + for i,j in zip(out[1:-2],out[2:-1]): + for k in range(i,j): + if test_vec[k] >test_vec[k-1]: + up = True + if test_vec[k] < test_vec[k-1]: + assert not up