inflection detection when finding peak