def main(*, num_qubits: int, depth: int, num_circuits: int, seed: int, routes: int):
    """Run the quantum volume algorithm with a preset configuration.

    See the calculate_quantum_volume documentation for more details.

    Args:
        num_qubits: Pass-through to calculate_quantum_volume.
        depth: Pass-through to calculate_quantum_volume
        num_circuits: Pass-through to calculate_quantum_volume
        seed: Pass-through to calculate_quantum_volume
        routes: Pass-through to calculate_quantum_volume as routing_attempts

    Returns: Pass-through from calculate_quantum_volume.
    """
    device = cirq_google.Sycamore
    # compiler = lambda circuit: cirq_google.optimized_for_xmon(circuit=circuit)
    compiler = lambda circuit: cirq.optimize_for_target_gateset(
        circuit, gateset=cirq.CZTargetGateset()
    )
    noisy = cirq.DensityMatrixSimulator(
        noise=cirq.ConstantQubitNoiseModel(qubit_noise_gate=cirq.DepolarizingChannel(p=0.005))
    )
    calculate_quantum_volume(
        num_qubits=num_qubits,
        depth=depth,
        num_circuits=num_circuits,
        random_state=seed,
        device_graph=routing.gridqubits_to_graph_device(device.metadata.qubit_set),
        samplers=[cirq.Simulator(), noisy],
        routing_attempts=routes,
        compiler=compiler,
    )
Run the quantum volume algorithm with a preset configuration.

    See the calculate_quantum_volume documentation for more details.

    Args:
        num_qubits: Pass-through to calculate_quantum_volume.
        depth: Pass-through to calculate_quantum_volume
        num_circuits: Pass-through to calculate_quantum_volume
        seed: Pass-through to calculate_quantum_volume
        routes: Pass-through to calculate_quantum_volume as routing_attempts

    Returns: Pass-through from calculate_quantum_volume.
    
examples/advanced/quantum_volume.py