amepproject / amep

The Active Matter Evaluation Package (AMEP) - a Python library for the analysis of particle-based and continuum simulation data of soft and active matter systems
https://amepproject.de/
GNU General Public License v3.0
12 stars 2 forks source link

BUG: utils.detect2peaks does not detect maxima at the borders correctly #87

Closed kay-ro closed 1 week ago

kay-ro commented 2 weeks ago

Description:

when the supplied dataset has a maximum at the border (left in the example), this maximum is not correctly detected.

Code for reproduction:

from scipy import signal
x=np.linspace(-1,1,10000)
avydata=x**2
height=.1
distance=1
width=1
first, second, y,x=amep.utils.detect2peaks(x, avydata, width=0, nav=1)
ind, other = signal.find_peaks(avydata, height=height, distance=distance, width=width)

Error message:

none - the correct peaks are not detected when they are global maxima at the boundary.

Python and AMEP versions:

amep 1.0.3

Additional information:

No response

How did you install AMEP?

None