# 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
from trueq.simulation.noise_source import NoiseSource

# 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 define a CrossTalk noise source as a subclass of NoiseSource

class CrossTalk(NoiseSource):
# 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
def __init__(self, rotation_profile, match=None):
self.rotation_profile = rotation_profile
super().__init__(match=match)

def apply(self, cycle_wrapper, state, circuit_cache):
for labels, gate in self.match.iter_gates(cycle_wrapper, noise_only=False):
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 ** self.rotation_profile[labels[0]]).mat
)
elif label == labels[0]:
# simulate the entire gate on this qubit
state.apply_matrix(labels, gate.mat)

cycle_crosstalk = CrossTalk(rotation_profile={5: 0.01, 6: 0.045, 7: 0.03})
sim.append_noise_source(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 31.858 seconds)

Gallery generated by Sphinx-Gallery