Note
Click here to download the full example code
Comparing Infidelities with SRB and XRB¶
This example demonstrates how to estimate the process infidelities of specified systems using SRB, and how this quantity can be divided into coherent and stochastic infidelity by the addition of XRB circuits. While this example uses a simulator to execute the circuits, the same procedure can be followed for hardware applications.
import trueq as tq
# generate SRB circuits to simultaneously characterize a single qubit [0],
# a pair of qubits [1, 2], and another single qubit [3]
circuits = tq.make_srb([[0], [1, 2], [3]], [4, 32, 64], 30)
# generate XRB circuits using the same arguments as SRB and combine them
circuits += tq.make_xrb([[0], [1, 2], [3]], [4, 32, 64], 30)
# initialize a noisy simulator with stochastic Pauli and overrotation
sim = tq.Simulator().add_stochastic_pauli(px=0.02).add_overrotation(0.04)
# run the circuits on the simulator to populate their results
sim.run(circuits, n_shots=1000)
# print the fit summary
circuits.fit()
Notice that the fit()
output contains an estimate
of process infidelity for the specified systems from SRB, the stochastic
infidelity from XRB, and the unitary infidelity which would be absent if the
circuit collection did not contain both SRB and XRB circuits. We
can visualize the different process infidelities as follows.
# plot a comparison of process infidelities
circuits.plot.compare_rb()
![Comparison for Cliffords on [0, (1, 2), 3]](../../_images/sphx_glr_srb_xrb_001.png)
Total running time of the script: ( 0 minutes 5.161 seconds)