def sample_all_circuits(
    sampler: cirq.Sampler, circuits: Sequence[cirq.Circuit], repetitions: int
) -> Sequence[dict[str, np.ndarray]]:
    """Calls sampler.run_batch on the given circuits and estimates the state probabilities.

    Args:
        sampler: A cirq sampler.
        circuits: A sequence of circuits.
        repetitions: An integer, the number of sampling repetitions.

    Returns:
        For each circuit, a dictionary mapping measurement keys to the estimated probabilities.
    """
    sampling_results = []
    for (result,) in sampler.run_batch(programs=circuits, repetitions=repetitions):
        record = {}
        for key in result.data.keys():
            values = result.data[key]
            sampled_probs = np.bincount(values, minlength=4) / len(values)
            record[key] = sampled_probs
        sampling_results.append(record)
    return sampling_results
Calls sampler.run_batch on the given circuits and estimates the state probabilities.

    Args:
        sampler: A cirq sampler.
        circuits: A sequence of circuits.
        repetitions: An integer, the number of sampling repetitions.

    Returns:
        For each circuit, a dictionary mapping measurement keys to the estimated probabilities.
    
cirq-core/cirq/experiments/benchmarking/parallel_xeb.py