def frame_error_rate_calculation(n_suc, n_tot):
    """
    Calculates the frame error rate given a success rate from the decoding stage. If no frame was successfully decoded,
    the protocol is aborted.
    :param n_suc: The number of frames that was successfully decoded.
    :param n_tot: The total number of frames.
    :return The success and frame error rates.
    """

    p_EC = n_suc / n_tot
    FER = 1 - p_EC
    if FER == 1.0:
        raise RuntimeWarning("There was no frame that was successfully decoded. A secret key cannot be formed.")
    return p_EC, FER