def find_peaks(signal):
    """
    Locate peaks based on derivative.

    Parameters
    ----------
    signal : list or array
        Signal.

    Returns
    ----------
    peaks : array
        An array containing the peak indices.

    Example
    ----------
    >>> signal = np.sin(np.arange(0, np.pi*10, 0.05))
    >>> peaks = nk.find_peaks(signal)
    >>> nk.plot_events_in_signal(signal, peaks)

    Notes
    ----------
    *Authors*

    - `Dominique Makowski <https://dominiquemakowski.github.io/>`_

    *Dependencies*

    - scipy
    - pandas
    """
    derivative = np.gradient(signal, 2)
    peaks = np.where(np.diff(np.sign(derivative)))[0]
    return(peaks)
def find_peaks ( signal ) : derivative = np . gradient ( signal , 2 ) peaks = np . where ( np . diff ( np . sign ( derivative ) ) ) [ 0 ] return ( peaks )
Locate peaks based on derivative.

    Parameters
    ----------
    signal : list or array
        Signal.

    Returns
    ----------
    peaks : array
        An array containing the peak indices.

    Example
    ----------
    >>> signal = np.sin(np.arange(0, np.pi*10, 0.05))
    >>> peaks = nk.find_peaks(signal)
    >>> nk.plot_events_in_signal(signal, peaks)

    Notes
    ----------
    *Authors*

    - `Dominique Makowski <https://dominiquemakowski.github.io/>`_

    *Dependencies*

    - scipy
    - pandas