def update_transmittivity_reflectivity(
    swt, smr, smt, lyr, rdif_a, tdif_a, rdif_b, tdif_b
):
    """updates transmissivity and reflectivity values after iterations.

    Args:
        swt: sum of gaussian weights (for integrating over angle)
        smr: accumulator for rdif gaussian integration
        smt: accumulator for tdif gaussian integration
        lyr: integer representign index of current layer (0 == top)
        rdif_a: reflectance to diffuse energy w polarization state == perpendicular
        rdif_b: reflectance to diffuse energy w polarization state == parallel
        tdif_a: transmittance to diffuse energy w polarization state == perpendicular
        tdif_b: transmittance to diffuse energy w polarization state == parallel

    Returns:
        rdif_a: updated reflectance to diffuse energy w polarization state == perpendicular
        rdif_b: updated reflectance to diffuse energy w polarization state == parallel
        tdif_a: updated transmittance to diffuse energy w polarization state == perpendicular
        tdif_b: updated transmittance to diffuse energy w polarization state == parallel
    """
    rdif_a[:, lyr] = smr / swt
    tdif_a[:, lyr] = smt / swt

    # homogeneous layer
    rdif_b[:, lyr] = rdif_a[:, lyr]
    tdif_b[:, lyr] = tdif_a[:, lyr]

    return rdif_a, tdif_a, rdif_b, tdif_b