import itertools


def get_correlation_channels(qubits, self_correlated, **kw):
    """
    Creates the correlations input parameter for the UHFQC_correlation_detector.
    :param qubits: list of QuDev_transmon instrances
    :param self_correlated: whether to do also measure self correlations
    :return: list of tuples with the channels to correlate; only looks at the
        acq_I_channel of each qubit!
    """
    if self_correlated:
        return list(itertools.combinations_with_replacement(
            [qb.acq_I_channel() for qb in qubits], r=2))
    else:
        return list(itertools.combinations(
            [qb.acq_I_channel() for qb in qubits], r=2))