def correct_rates(rates, opt_qes, combs):
    """Applies optimal qes to rates.

    Should be closer to fitted_rates afterwards.

    Parameters
    ----------
    rates: numpy array of rates of all PMT combinations
    opt_qes: numpy array of optimal qe values for all PMTs
    combs: pmt combinations used to correct

    Returns
    -------
    corrected_rates: numpy array of corrected rates for all PMT combinations
    """

    corrected_rates = np.array([
        rate / opt_qes[comb[0]] / opt_qes[comb[1]]
        for rate, comb in zip(rates, combs)
    ])
    return corrected_rates