How to find peaks & eliminate flat tops

rogernm001:
yes, In my code if you look closely I use an algorithm for finding peak points. Thats not my issue... the flat tops are my issue, where they repeat and print each repeated value as a peak point which is false.. every example I observe does not contain flat tops so of course results are successful.

No.... your algorithm is the issue, since it is the one that is generating these 'flat tops', right?

This means ----- you need some other kind of algorithm.

You probably need to provide a file (eg. text file) that contains the raw data ..... ie. value versus time. And plot these values versus time, so that you can look at the raw measurements. And then everyone can get an idea about what your algorithm has done to the raw data.