-----
    Brief
    -----
    Determination of the Power Spectral Density Function (Fourier Domain)

    -----------
    Description
    -----------
    The Power Spectral Density Function allows to perceive the behavior of a given signal in terms of its frequency.
    This procedure costs the time resolution of the signal but may be important to extract features in a different
    domain appart from the time domain.

    This function constructs the Power Spectral Density Function in the frequency domain.

    ----------
    Parameters
    ----------
    tachogram_time : list
        X Axis of tachogram.
    tachogram_data : list
        Y Axis of tachogram.

    Returns
    -------
    out : list, list
        Frequency and power axis.

def psd(tachogram_time, tachogram_data):
    """
    -----
    Brief
    -----
    Determination of the Power Spectral Density Function (Fourier Domain)

    -----------
    Description
    -----------
    The Power Spectral Density Function allows to perceive the behavior of a given signal in terms of its frequency.
    This procedure costs the time resolution of the signal but may be important to extract features in a different
    domain appart from the time domain.

    This function constructs the Power Spectral Density Function in the frequency domain.

    ----------
    Parameters
    ----------
    tachogram_time : list
        X Axis of tachogram.
    tachogram_data : list
        Y Axis of tachogram.

    Returns
    -------
    out : list, list
        Frequency and power axis.
    """

    init_time = tachogram_time[0]
    fin_time = tachogram_time[-1]
    tck = interpol.splrep(tachogram_time, tachogram_data)
    interpolation_rate = 4

    nn_time_even = numpy.linspace(init_time, fin_time, (fin_time - init_time) * interpolation_rate)
    nn_tachogram_even = interpol.splev(nn_time_even, tck)

    freq_axis, power_axis = scisignal.welch(nn_tachogram_even, interpolation_rate,
                                            window=scisignal.get_window("hanning",
                                                                        min(len(nn_tachogram_even),
                                                                            1000)),
                                            nperseg=min(len(nn_tachogram_even), 1000))

    freqs = [round(val, 3) for val in freq_axis if val < 0.5]
    power = [round(val, 4) for val, freq in zip(power_axis, freq_axis) if freq < 0.5]

    return freqs, power