def eq_gf_limit(gf, p_n2, p_he, a_n2, b_n2, a_he, b_he):
    """
    Calculate ascent ceiling limit of a tissue compartment using Buhlmann
    equation extended with gradient factors by Erik Baker.

    The returned value is absolute pressure of depth of the ascent ceiling.

    :param gf: Gradient factor value.
    :param p_n2: Current tissue pressure for nitrogen.
    :param p_he: Current tissue pressure for helium.
    :param a_n2: Nitrox Buhlmann coefficient A.
    :param b_n2: Nitrox Buhlmann coefficient B.
    :param a_he: Helium Buhlmann coefficient A.
    :param b_he: Helium Buhlmann coefficient B.
    """
    p = p_n2 + p_he
    a = (a_n2 * p_n2 + a_he * p_he) / p
    b = (b_n2 * p_n2 + b_he * p_he) / p
    return (p - a * gf) / (gf / b + 1.0 - gf)