0

I have histograms with a global maximum (always positive) and a local maximum (always negative). Example see here. I want to find the distance between the 2 maximas in python 2.7.

Same question but for C#: here.

For finding the global max: the solution of Guest helped me.

When I can find the local maxima I can calculate the distance to the global maxima. Can someone help?

Update: I found out how to smooth my histogram from the solution of Justin Peel: here

Now I have this function and I want to calculate the distance between the maxima.

Community
  • 1
  • 1
Oemer
  • 11
  • 2
  • 1
    What distance metric are you using; what doesn't work with your current approach? – msw Jul 21 '14 at 13:54
  • my current idea is to use a sliding window in order to calculate all local maxima. I think that this will solve the problem. – Oemer Jul 22 '14 at 03:05

1 Answers1

0

I solved the problem with a sliding window. It checks if the middle element of the windows is the max: if yes: append the solution to maxima-array. if not the window will shift one element to the right.

To avoid very small maxima, I put a condition that it should be at least a certain level.

Thank you.

Oemer
  • 11
  • 2