# Crosstalk Diagnostics¶

Our crosstalk diagnostics tool generates a circuit collection to measure the discrepancy between gate quality while applying gates simultaneously versus while applying gates in an isolated way to each individual system (qubit). This is done by running SRB simultaneously on the specified systems, as well as running it on each system in turn. Optionally, and true by default, this is also done with XRB to learn the discrepancy of the unitarity metric.

One can choose to do any combination of single-qubit twirling or two-qubit twirling
on the labels. For instance, setting labels as `[[4], [5,6]]`

indicates single-qubit
twirling on qubits `4`

and two-qubit twirling on qubits `(5,6)`

.

This protocol returns four parameters which characterize the noise acting on a system:

Unitarity (

`u`

)Incoherence (

`inc`

)Average gate infidelity of the error map (

`r`

)Average gate infidelity of the systematic coherent error (

`ru`

)

Note

When crosstalk diagnostics are run without XRB, no information about the incoherence of the system is returned.

## Example¶

```
#
# Make crosstalk diagnostics example.
# Copyright 2019 Quantum Benchmark Inc.
#
import trueq as tq
import trueq.assessments as tqa
# Generate a circuit collection to run cross-talk diagnostics in single qubit
# mode for qubits 5, 6, 7, and 8.
circuits = tqa.make_crosstalk_diagnostics([5, 6, 7, 8], [4, 100])
# If we think that simultaneous gates will make the gates at most 5 times worse,
# then we should tell it about this ratio to get appropriate sequence lengths.
circuits = tqa.make_crosstalk_diagnostics([5, 6, 7, 8], [4, 100], simul_ratio=0.2)
# Reduce the number of circuits to perform by excluding XRB circuits.
# This means we cannot learn about incoherence when analyzing data.
circuits = tqa.make_crosstalk_diagnostics([5, 6, 7, 8], [4, 100], include_xrb=False)
# We can also specify that some pairs of qubits undergo two-qubit gates.
circuits = tqa.make_crosstalk_diagnostics([5, [6, 7], 8], [4, 100], include_xrb=False)
# Using the subsets option, we can customize exactly which subsets of the full
# simultaneous twirl are performed in isolation. Here, the default value would
# have resulted in subsets [[5], [6], [7, 8]].
circuits = tqa.make_crosstalk_diagnostics(
[5, 6, [7, 8]], [4, 100], subsets=[[5], [5, 6]]
)
# Initialize a Simulator.
sim = tq.Simulator().add_stochastic_pauli(px=0.01, py=0.03)
# Run crosstalk diagnostic circuits on the simulator and produce a fit summary.
# Note that for brevity, we run only the last set of circuits.
sim.run(circuits)
circuits.fit([5, [5, 6]]).summarize()
```

The output of this code block is displayed below. Note that output from both XRB and SRB is included for all qubits in the specified labels, with and without running these routines on qubits other than those being characterized. The output from the protocols being run on qubits outside of those being characterized is not returned.

```
```