# 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 2020 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 3.174 [-12.5,18.9] e-02 Average gate infidelity of the error map
A 0.941 [-0.322,2.2.. SPAM of the exponential decay A * p ** m
p 0.937 [0.622,1.251] Decay rate of the exponential decay A * p ** m
SRB on [5] with (('C', 5), ('C', 6))
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
r 1.298 [0.908,1.688] e-02 Average gate infidelity of the error map
A 0.852 [0.799,0.904] SPAM of the exponential decay A * p ** m
p 0.974 [0.966,0.982] 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 2.954 [1.895,4.014] e-02 Average gate infidelity of the error map
A 0.953 [0.854,1.051] SPAM of the exponential decay A * p ** m
p 0.941 [0.920,0.962] Decay rate of the exponential decay A * p ** m
SRB on [5, 6] with (('C', 5), ('C', 6))
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
r 3.585 [-3.675,10.8] e-02 Average gate infidelity of the error map
A 0.715 [0.420,1.010] SPAM of the exponential decay A * p ** m
p 0.952 [0.855,1.049] 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 5.099 [1.619,8.578] e-02 Average gate infidelity of the error map
A 0.721 [0.568,0.874] SPAM of the exponential decay A * p ** m
p 0.932 [0.886,0.978] Decay rate of the exponential decay A * p ** m
XRB on [5] with (('C', 5),)
--------------------------------------------------------------------------------
Name Estimate 95% CI Description
ru 6.081 [5.270,6.891] e-03 Average gate infidelity of systematic coherent e..
inc 0.192 [-0.757,1.1.. Incoherence, 0 indicates entirely unitary noise ..
A 0.734 [0.573,0.896] SPAM of the exponential decay A * u ** m
u 0.976 [0.973,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.789 [5.929,7.648] e-03 Average gate infidelity of systematic coherent e..
inc 0.523 [0.352,0.693] Incoherence, 0 indicates entirely unitary noise ..
A 0.772 [0.695,0.849] SPAM of the exponential decay A * u ** m
u 0.973 [0.970,0.976] 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 7.591 [7.017,8.165] e-03 Average gate infidelity of systematic coherent e..
inc 0.257 [0.163,0.351] Incoherence, 0 indicates entirely unitary noise ..
A 0.716 [0.652,0.781] SPAM of the exponential decay A * u ** m
u 0.970 [0.968,0.972] 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.281 [1.936,6.626] e-03 Average gate infidelity of systematic coherent e..
inc 0.119 [-0.131,0.3.. Incoherence, 0 indicates entirely unitary noise ..
A 0.131 [0.056,0.207] SPAM of the exponential decay A * u ** m
u 0.989 [0.982,0.995] 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 4.576 [2.507,6.645] e-03 Average gate infidelity of systematic coherent e..
inc 8.974 [1.628,16.3] e-02 Incoherence, 0 indicates entirely unitary noise ..
A 0.153 [0.089,0.216] SPAM of the exponential decay A * u ** m
u 0.988 [0.982,0.993] Decay rate of the exponential decay A * u ** m
```