def compute_interpeak(data, sample_rate):
    """
        Compute number of samples between signal peaks using the real part of FFT.

        :param data: 1-dimensional time series data.
        :type data: array
        :param sample_rate: Sample rate of accelerometer reading (Hz)
        :type sample_rate: float
        :return interpeak: Number of samples between peaks 
        :rtype interpeak: int

        :Examples:

        >>> import numpy as np
        >>> from mhealthx.signals import compute_interpeak
        >>> data = np.random.random(10000)
        >>> sample_rate = 100
        >>> interpeak = compute_interpeak(data, sample_rate)
    """

    # Real part of FFT:
    freqs = fftfreq(data.size, d=1.0/sample_rate)
    f_signal = rfft(data)

    # Maximum non-zero frequency:
    imax_freq = np.argsort(f_signal)[-2]
    freq = np.abs(freqs[imax_freq])

    # Inter-peak samples:
    interpeak = np.int(np.round(sample_rate / freq))

    return interpeak