cirq.experiments.collect_grid_parallel_two_qubit_xeb_data

Collect data for a grid parallel two-qubit XEB experiment.

For each grid interaction layer in layers, num_circuits random circuits are generated. The circuits are generated using the function cirq.experiments.random_rotations_between_grid_interaction_layers_circuit, with two-qubit layer pattern consisting of only the corresponding grid interaction layer. Each random circuit is generated with a depth of max(cycles). The single-qubit gates used are those of the form cirq.PhasedXZGate(x_exponent=0.5, z_exponent=z, axis_phase_exponent=a) with z and a each ranging through the set of 8 values [0, 1/4, ..., 7/4]. The final single-qubit gate layer is omitted. Note that since the same set of interactions is applied in each two-qubit gate layer, a circuit does not entangle pairs of qubits other than the pairs present in the corresponding grid interaction layer.

Each circuit is used to generate additional circuits by truncating it at the cycle numbers specified by cycles. For instance, if cycles is [2, 4, 6], then the original circuit will consist of 6 cycles, and it will give rise to two additional circuits, one consisting of the first 2 cycles, and the other consisting of the first 4 cycles. The result is that the total number of generated circuits is len(layers) * num_circuits * len(cycles). Each of these circuits is sampled with the number of repetitions specified by repetitions. The trial results of the circuit executions are saved to filesystem as JSON files. The full-length circuits are also saved to filesystem as JSON files. The resulting directory structure looks like

{base_dir}
└── {data_collection_id}
    ├── circuits
    │   ├── {layer0}
    │   │   ├── circuit-0.json
    │   │   ├── ...
    │   ├── ...
    ├── data
    │   ├── {layer0}
    │   │   ├── circuit-0
    │   │   │   ├── depth-{depth0}.json
    │   │   │   ├── ...
    │   │   ├── ...
    │   ├── ...
    └── metadata.json

The circuits directory contains the circuits and the data directory contains the trial results. Both directories are split into subdirectories corresponding to the grid interaction layers. In circuits, these subdirectories contain the circuits as JSON files. In data, instead of having one file for each circuit, there is a directory for each circuit containing trial results for each cycle number, or depth. metadata.json saves the arguments passed to this function, other than sampler, data_collection_id, and base_dir. If data_collection_id is not specified, it is set to the current date and time. base_dir defaults to ~/cirq-results/grid-parallel-xeb.

sampler The quantum computer or simulator to use to run circuits.
qubits The qubits to use.
two_qubit_gate The two-qubit gate to use.
num_circuits The number of random circuits to generate.
repetitions The number of repetitions to sample.
cycles The cycle numbers at which to truncate the generated circuits.
layers The grid interaction layers to use.
seed A seed for the pseudorandom number generator, used to generate the random circuits.
data_collection_id The data collection ID to use. This determines the name of the directory in which data is saved to filesystem.
num_workers The maximum number of threads to use to run circuits concurrently.
base_dir The base directory in which to save data to filesystem.

Side effects:

Saves data to filesystem in the directory structure described above.