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)

SRB on [5] with (('C', 5),)

Name

Estimate

95% CI

Description

r

1.388

[0.964,1.812]

e-02

Average gate infidelity of the error map

A

0.846

[0.794,0.898]

SPAM of the exponential decay A * p ** m

p

0.972

[0.964,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

9.500

[8.985,10.0]

e-02

Average gate infidelity of the error map

A

1.635

[1.635,1.635]

SPAM of the exponential decay A * p ** m

p

0.810

[0.800,0.820]

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

3.577

[1.337,5.816]

e-02

Average gate infidelity of the error map

A

0.981

[0.784,1.179]

SPAM of the exponential decay A * p ** m

p

0.928

[0.884,0.973]

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

[0.133,0.162]

Average gate infidelity of the error map

A

1.238

[1.238,1.238]

SPAM of the exponential decay A * p ** m

p

0.803

[0.783,0.823]

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

[0.240,0.257]

Average gate infidelity of the error map

A

2.726

[2.726,2.726]

SPAM of the exponential decay A * p ** m

p

0.669

[0.658,0.681]

Decay rate of the exponential decay A * p ** m

XRB on [5] with (('C', 5),)

Name

Estimate

95% CI

Description

ru

6.229

[5.364,7.093]

e-03

Average gate infidelity of systematic coherent error, d * (1 - sqrt(u)) / (d - 1), so that it is bounded between 0 and r from SRB

inc

0.449

[0.298,0.599]

Incoherence, 0 indicates entirely unitary noise and 1 indicates entirely depolarizing noise

A

0.682

[0.536,0.828]

SPAM of the exponential decay A * u ** m

u

0.975

[0.972,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

5.911

[5.143,6.680]

e-03

Average gate infidelity of systematic coherent error, d * (1 - sqrt(u)) / (d - 1), so that it is bounded between 0 and r from SRB

inc

6.223

[5.346,7.099]

e-02

Incoherence, 0 indicates entirely unitary noise and 1 indicates entirely depolarizing noise

A

0.686

[0.617,0.756]

SPAM of the exponential decay A * u ** m

u

0.976

[0.973,0.980]

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

[7.227,8.688]

e-03

Average gate infidelity of systematic coherent error, d * (1 - sqrt(u)) / (d - 1), so that it is bounded between 0 and r from SRB

inc

0.222

[0.082,0.363]

Incoherence, 0 indicates entirely unitary noise and 1 indicates entirely depolarizing noise

A

0.693

[0.610,0.777]

SPAM of the exponential decay A * u ** m

u

0.968

[0.966,0.971]

Decay rate of the exponential decay A * u ** m

XRB on [5, 6] with (('C', 5), ('C', 6))

Name

Estimate

95% CI

Description

ru

5.183

[3.486,6.880]

e-03

Average gate infidelity of systematic coherent error, d * (1 - sqrt(u)) / (d - 1), so that it is bounded between 0 and r from SRB

inc

3.507

[2.307,4.707]

e-02

Incoherence, 0 indicates entirely unitary noise and 1 indicates entirely depolarizing noise

A

0.220

[0.156,0.285]

SPAM of the exponential decay A * u ** m

u

0.986

[0.982,0.991]

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

5.472

[3.702,7.241]

e-03

Average gate infidelity of systematic coherent error, d * (1 - sqrt(u)) / (d - 1), so that it is bounded between 0 and r from SRB

inc

2.205

[1.488,2.923]

e-02

Incoherence, 0 indicates entirely unitary noise and 1 indicates entirely depolarizing noise

A

0.201

[0.136,0.266]

SPAM of the exponential decay A * u ** m

u

0.985

[0.981,0.990]

Decay rate of the exponential decay A * u ** m