I am currently using PeakDetect for a project, but I'm not sure how the sharpness parameter works. I can qualitatively tell what it's doing, but is there a more analytical/mathematical way to define sharpness?


We can see from my reimplementation of FindPeaks here that the sharpness parameter is a threshold that discards all peaks for which the negative of the second derivative is smaller than that threshold.

I implemented it like this:

findPeaks1[data_, sigma_, s_] := Module[{sharpness},
  sharpness = ListConvolve[{1, -2, 1}, data];
  Unitize[findPeaks1[data, sigma] + 1 - Unitize[sharpness, s]]

You can see here the exact definition, how the second derivative is computed and how the threshold is applied.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.