def _buffer_update(npk1, spk1):
    """
    Computes threshold based on signal and noise values

    ----------
    Parameters
    ----------
    npk1 : int
        Actual value of NPK1 parameter defined in Pan-Tompkins real-time R peak detection algorithm
        (named noise peak).
    spk1 : float
        Actual value of SPK1 parameter defined in Pan-Tompkins real-time R peak detection algorithm
        (named signal peak).

    Returns
    -------
    out : float
        The updated threshold level.

    """
    threshold = npk1 + 0.25 * (spk1 - npk1)

    return threshold