def interface_r_cos(polarization, n_i, n_f, cosTh_i, cosTh_f):
    """
    reflection amplitude (from Fresnel equations)

    polarization is either "s" or "p" for polarization

    n_i, n_f are (complex) refractive index for incident and final

    th_i, th_f are (complex) propegation angle for incident and final
    (in radians, where 0=normal). "th" stands for "theta".
    """
    if polarization == 's':
        return ((n_i * cosTh_i - n_f * cosTh_f) /
                (n_i * cosTh_i + n_f * cosTh_f))
    elif polarization == 'p':
        return ((n_f * cosTh_i - n_i * cosTh_f) /
                (n_f * cosTh_i + n_i * cosTh_f))
    else:
        raise ValueError("Polarization must be 's' or 'p'")