# Crosstalk Diagnostics¶

The quality of gates in a device may depend on whether the gates are occurring simultaneously or in isolation. This can be due to quantum or classical crosstalk. In this example we use make_crosstalk_diagnostics() to measure this discrepancy. See also CTD.

import trueq as tq

# create circuits for crosstalk diagnostics on qubits 5, 6, and 7 for single-qubit gates
circuits = tq.make_crosstalk_diagnostics([5, 6, 7], [4, 16, 32], 50)


Next, we initialize a simulator and populate the circuits with results. See Simulator for more details on writing custom simulators.

def cycle_crosstalk(cycle, state, _):
# this is a simple crosstalk simulator (not based on realistic device physics),
# where adjacent qubits add a fraction of their own gate to the other qubit
rotations = {5: 0.01, 6: 0.045, 7: 0.03}
for labels, gate in cycle:
for label in state.labels:
if abs(label - labels[0]) == 1:
# if qubit labels are 1 apart, multiply the other qubit by a small
# fraction of this qubit's gate
state.apply_matrix(labels, (gate ** rotations[labels[0]]).mat)
elif label == labels[0]:
# simulate the entire gate on this qubit, with a bit of overrotation
state.apply_matrix(labels, gate.mat)
state.apply_matrix(labels, tq.Gate.from_generators("Z", 9).mat)

sim.append_cycle_noise(cycle_crosstalk)
sim.run(circuits)


Show all of the decay curves.

circuits.plot.raw()


Compare the fitted results on a plot. We see that process infidelities (SRB) in the simultaneous case are higher because of the crosstalk noise added by our simulator. However, the stochastic infidelity (XRB) is the same for both simultaneous and isolated experiments. This is due to the shared stochastic noise model add_stochastic_pauli(pz=0.02).

circuits.plot.compare_rb()


Total running time of the script: ( 0 minutes 49.048 seconds)

Gallery generated by Sphinx-Gallery