# 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.

```
SRB on [5] with (('C', 5),)
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
r 1.660 [0.957,2.364] e-02 Average gate infidelity of the error map
A 0.859 [0.801,0.918] SPAM of the exponential decay A * p ** m
p 0.967 [0.953,0.981] Decay rate of the exponential decay A * p ** m
SRB on [5] with (('C', 5), ('C', 6))
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
r 1.995 [0.198,3.791] e-02 Average gate infidelity of the error map
A 0.860 [0.724,0.996] SPAM of the exponential decay A * p ** m
p 0.960 [0.924,0.996] Decay rate of the exponential decay A * p ** m
SRB on [5] with (('C', 5), ('C', 6), ('C', 7, 8))
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
r 0.171 [-821305.2,.. Average gate infidelity of the error map
A -6.161 [-61458438... e-01 SPAM of the exponential decay A * p ** m
p 0.659 [-1642610.1.. Decay rate of the exponential decay A * p ** m
SRB on [5, 6] with (('C', 5), ('C', 6))
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
r 0.137 [0.128,0.146] Average gate infidelity of the error map
A 1.177 [1.177,1.177] SPAM of the exponential decay A * p ** m
p 0.817 [0.805,0.830] Decay rate of the exponential decay A * p ** m
SRB on [5, 6] with (('C', 5), ('C', 6), ('C', 7, 8))
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
r 0.251 [-790345.4,.. Average gate infidelity of the error map
A -5.523 [-34898482... e-01 SPAM of the exponential decay A * p ** m
p 0.665 [-1053793.6.. Decay rate of the exponential decay A * p ** m
XRB on [5] with (('C', 5),)
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
ru 6.285 [5.170,7.401] e-03 Average gate infidelity of systematic coherent e..
inc 0.379 [0.205,0.552] Incoherence, 0 indicates entirely unitary noise ..
A 0.777 [0.609,0.946] SPAM of the exponential decay A * u ** m
u 0.975 [0.971,0.979] Decay rate of the exponential decay A * u ** m
XRB on [5] with (('C', 5), ('C', 6))
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
ru 6.171 [5.433,6.909] e-03 Average gate infidelity of systematic coherent e..
inc 0.309 [0.028,0.590] Incoherence, 0 indicates entirely unitary noise ..
A 0.760 [0.682,0.837] SPAM of the exponential decay A * u ** m
u 0.975 [0.973,0.978] Decay rate of the exponential decay A * u ** m
XRB on [5] with (('C', 5), ('C', 6), ('C', 7, 8))
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
ru 5.937 [4.915,6.958] e-03 Average gate infidelity of systematic coherent e..
inc 3.479 [-16743818... e-02 Incoherence, 0 indicates entirely unitary noise ..
A 0.399 [0.289,0.509] SPAM of the exponential decay A * u ** m
u 0.976 [0.972,0.980] Decay rate of the exponential decay A * u ** m
XRB on [5, 6] with (('C', 5), ('C', 6))
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
ru 4.747 [2.734,6.761] e-03 Average gate infidelity of systematic coherent e..
inc 3.466 [1.977,4.956] e-02 Incoherence, 0 indicates entirely unitary noise ..
A 0.217 [0.117,0.318] SPAM of the exponential decay A * u ** m
u 0.987 [0.982,0.993] Decay rate of the exponential decay A * u ** m
XRB on [5, 6] with (('C', 5), ('C', 6), ('C', 7, 8))
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
ru 3.726 [1.579,5.872] e-03 Average gate infidelity of systematic coherent e..
inc 1.483 [-4664226.5.. e-02 Incoherence, 0 indicates entirely unitary noise ..
A 0.132 [0.078,0.185] SPAM of the exponential decay A * u ** m
u 0.990 [0.984,0.996] Decay rate of the exponential decay A * u ** m
```