Detect valleys

Issue #17 invalid
Former user created an issue

Just wondering if its possible to detect valleys instead of/in addition to peaks in a signal using peakutils.indexes()?

If not currently possible, what change would have to be made to allow for that functionality?

Comments (4)

  1. Lucas Hermann Negri repo owner

    You can detect the valleys by calling indexes(-data), like:

    import peakutils as pu
    import numpy as np
    
    data = np.array([5, 5, 5, 4, 3, 2, 1, 2, 3, 4, 5, 5, 4, 3, 4, 5])
    indexes = pu.indexes(-data)
    
  2. Simon Ho

    thanks, but this method doesn't allow for the detection of both peaks and valleys simultaneously. I could detect valleys, then detect peaks, resulting in 2 arrays, but I think they would be pretty difficult to combine together

  3. Lucas Hermann Negri repo owner

    You can join the two arrays and sort them, if you want. I will mark this as 'not an issue', unless you have a specific case that justifies a separate function. Thanks.

  4. Log in to comment