Download this file as Jupyter notebook: keys.ipynb.

# Keys: Storing and Filtering Metadata

True-Q™ uses objects called Keys to store metadata. Each Circuit and Estimate owns a key which can store multiple name/value pairs in a dictionary-like format. Keys are used by all built-in circuit generation methods, such as SRB, to disambiguate the circuits that they generate from independent circuits that might happen to be in the same circuit collection. These metadata are what allow the main fitter, fit(), to keep track of all protocol types, cycles of interest, twirling groups, measurement bases, and so on, to provide separate estimates in each relevant context.

Keys can be constructed manually by providing the constructor keyname/value pairs.

[2]:

import trueq as tq
import matplotlib.pyplot as plt
import numpy as np

tq.Key(name="my_name", phi=27.7, shapes=("circle", "square"))

[2]:

Key(name='my_name', phi=27.7, shapes=('circle', 'square'))


In the following example, we combine some basic diagnostic protocols, SRB and IRB, in the same circuit collection, and display all resulting circuit keys in the fancy table format provided by KeySet.

[3]:

# create a single circuit collection with simultaneous RB, and simultaneous interleaved
# randomized benchmarking on two different cycles. for demonstration purposes, we have
# lowered the number of randomizations per sequence length below what a typical
# experiment would use
circuits = tq.make_srb(range(5), [4, 12], n_circuits=4)

cycle_h = tq.Cycle({range(5): tq.Gate.h})
circuits += tq.make_irb(cycle_h, [4, 10], n_circuits=3)

cycle_x = tq.Cycle({range(5): tq.Gate.x})
circuits += tq.make_irb(cycle_x, [2, 10], n_circuits=3)

circuits.keys()

[3]:

True-Q formatting will not be loaded without trusting this notebook or rerunning the affected cells. Notebooks can be marked as trusted by clicking "File -> Trust Notebook".
 KeySet List of all the keys in the KeySet protocol The characterization protocol used to generate a circuit. cycles twirl The twirling group used to generate a circuit. n_random_cycles The number of independent random cycles in the circuit. compiled_pauli The n-qubit Pauli operator that was compiled into the circuit immediately before measurement. measurement_basis An n-qubit Pauli operator describing the change-of-basis gates added prior to measurement. Key Key: compiled_pauli: XZXXY cycles: (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) measurement_basis: ZZZZZ n_random_cycles: 4 protocol: IRB twirl: Cliffords on [0, 1, 2, 3, 4] IRB (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) Cliffords on [0, 1, 2, 3, 4] 4 XZXXY ZZZZZ Key Key: compiled_pauli: YYYYZ cycles: (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) measurement_basis: ZZZZZ n_random_cycles: 4 protocol: IRB twirl: Cliffords on [0, 1, 2, 3, 4] IRB (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) Cliffords on [0, 1, 2, 3, 4] 4 YYYYZ ZZZZZ Key Key: compiled_pauli: IYXIZ cycles: (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) measurement_basis: ZZZZZ n_random_cycles: 4 protocol: IRB twirl: Cliffords on [0, 1, 2, 3, 4] IRB (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) Cliffords on [0, 1, 2, 3, 4] 4 IYXIZ ZZZZZ Key Key: compiled_pauli: XZXXZ cycles: (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) measurement_basis: ZZZZZ n_random_cycles: 10 protocol: IRB twirl: Cliffords on [0, 1, 2, 3, 4] IRB (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) Cliffords on [0, 1, 2, 3, 4] 10 XZXXZ ZZZZZ Key Key: compiled_pauli: IXYIX cycles: (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) measurement_basis: ZZZZZ n_random_cycles: 10 protocol: IRB twirl: Cliffords on [0, 1, 2, 3, 4] IRB (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) Cliffords on [0, 1, 2, 3, 4] 10 IXYIX ZZZZZ Key Key: compiled_pauli: YZYXY cycles: (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) measurement_basis: ZZZZZ n_random_cycles: 10 protocol: IRB twirl: Cliffords on [0, 1, 2, 3, 4] IRB (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) Cliffords on [0, 1, 2, 3, 4] 10 YZYXY ZZZZZ Key Key: compiled_pauli: YIZXZ cycles: (Cycle((0,): Gate.x, (1,): Gate.x, (2,): Gate.x, (3,): Gate.x, (4,): Gate.x),) measurement_basis: ZZZZZ n_random_cycles: 2 protocol: IRB twirl: Cliffords on [0, 1, 2, 3, 4] IRB (Cycle((0,): Gate.x, (1,): Gate.x, (2,): Gate.x, (3,): Gate.x, (4,): Gate.x),) Cliffords on [0, 1, 2, 3, 4] 2 YIZXZ ZZZZZ Key Key: compiled_pauli: IYZZZ cycles: (Cycle((0,): Gate.x, (1,): Gate.x, (2,): Gate.x, (3,): Gate.x, (4,): Gate.x),) measurement_basis: ZZZZZ n_random_cycles: 2 protocol: IRB twirl: Cliffords on [0, 1, 2, 3, 4] IRB (Cycle((0,): Gate.x, (1,): Gate.x, (2,): Gate.x, (3,): Gate.x, (4,): Gate.x),) Cliffords on [0, 1, 2, 3, 4] 2 IYZZZ ZZZZZ Key Key: compiled_pauli: IXYXY cycles: (Cycle((0,): Gate.x, (1,): Gate.x, (2,): Gate.x, (3,): Gate.x, (4,): Gate.x),) measurement_basis: ZZZZZ n_random_cycles: 2 protocol: IRB twirl: Cliffords on [0, 1, 2, 3, 4] IRB (Cycle((0,): Gate.x, (1,): Gate.x, (2,): Gate.x, (3,): Gate.x, (4,): Gate.x),) Cliffords on [0, 1, 2, 3, 4] 2 IXYXY ZZZZZ Key Key: compiled_pauli: IYZII cycles: (Cycle((0,): Gate.x, (1,): Gate.x, (2,): Gate.x, (3,): Gate.x, (4,): Gate.x),) measurement_basis: ZZZZZ n_random_cycles: 10 protocol: IRB twirl: Cliffords on [0, 1, 2, 3, 4] IRB (Cycle((0,): Gate.x, (1,): Gate.x, (2,): Gate.x, (3,): Gate.x, (4,): Gate.x),) Cliffords on [0, 1, 2, 3, 4] 10 IYZII ZZZZZ Key Key: compiled_pauli: YXZIZ cycles: (Cycle((0,): Gate.x, (1,): Gate.x, (2,): Gate.x, (3,): Gate.x, (4,): Gate.x),) measurement_basis: ZZZZZ n_random_cycles: 10 protocol: IRB twirl: Cliffords on [0, 1, 2, 3, 4] IRB (Cycle((0,): Gate.x, (1,): Gate.x, (2,): Gate.x, (3,): Gate.x, (4,): Gate.x),) Cliffords on [0, 1, 2, 3, 4] 10 YXZIZ ZZZZZ Key Key: compiled_pauli: XZXZI cycles: (Cycle((0,): Gate.x, (1,): Gate.x, (2,): Gate.x, (3,): Gate.x, (4,): Gate.x),) measurement_basis: ZZZZZ n_random_cycles: 10 protocol: IRB twirl: Cliffords on [0, 1, 2, 3, 4] IRB (Cycle((0,): Gate.x, (1,): Gate.x, (2,): Gate.x, (3,): Gate.x, (4,): Gate.x),) Cliffords on [0, 1, 2, 3, 4] 10 XZXZI ZZZZZ Key Key: compiled_pauli: IIXXX measurement_basis: ZZZZZ n_random_cycles: 4 protocol: SRB twirl: Cliffords on [0, 1, 2, 3, 4] SRB Cliffords on [0, 1, 2, 3, 4] 4 IIXXX ZZZZZ Key Key: compiled_pauli: ZZYZX measurement_basis: ZZZZZ n_random_cycles: 4 protocol: SRB twirl: Cliffords on [0, 1, 2, 3, 4] SRB Cliffords on [0, 1, 2, 3, 4] 4 ZZYZX ZZZZZ Key Key: compiled_pauli: XYIXZ measurement_basis: ZZZZZ n_random_cycles: 4 protocol: SRB twirl: Cliffords on [0, 1, 2, 3, 4] SRB Cliffords on [0, 1, 2, 3, 4] 4 XYIXZ ZZZZZ Key Key: compiled_pauli: IZZYY measurement_basis: ZZZZZ n_random_cycles: 4 protocol: SRB twirl: Cliffords on [0, 1, 2, 3, 4] SRB Cliffords on [0, 1, 2, 3, 4] 4 IZZYY ZZZZZ Key Key: compiled_pauli: ZYZYZ measurement_basis: ZZZZZ n_random_cycles: 12 protocol: SRB twirl: Cliffords on [0, 1, 2, 3, 4] SRB Cliffords on [0, 1, 2, 3, 4] 12 ZYZYZ ZZZZZ Key Key: compiled_pauli: IIXYZ measurement_basis: ZZZZZ n_random_cycles: 12 protocol: SRB twirl: Cliffords on [0, 1, 2, 3, 4] SRB Cliffords on [0, 1, 2, 3, 4] 12 IIXYZ ZZZZZ Key Key: compiled_pauli: YZYYX measurement_basis: ZZZZZ n_random_cycles: 12 protocol: SRB twirl: Cliffords on [0, 1, 2, 3, 4] SRB Cliffords on [0, 1, 2, 3, 4] 12 YZYYX ZZZZZ Key Key: compiled_pauli: IIZIY measurement_basis: ZZZZZ n_random_cycles: 12 protocol: SRB twirl: Cliffords on [0, 1, 2, 3, 4] SRB Cliffords on [0, 1, 2, 3, 4] 12 IIZIY ZZZZZ

We can look at the key of a particular circuit, inspect its values either with property syntax, or subscript syntax, and perform other container-like actions.

[4]:

# get the whole key
circuits[0].key

[4]:

Key(compiled_pauli=Weyls('ZZYZX'), measurement_basis=Weyls('ZZZZZ'), n_random_cycles=4, protocol='SRB', twirl=Twirl({(0,): 'C', (1,): 'C', (2,): 'C', (3,): 'C', (4,): 'C'}, dim=2))

[5]:

# get all keywords (names) present in the key
circuits[0].key.names

[5]:

('compiled_pauli', 'measurement_basis', 'n_random_cycles', 'protocol', 'twirl')

[6]:

# find out whether the key contains a particular keyword (name)
"protocol" in circuits[0].key

[6]:

True

[7]:

# inspect a particular value using property syntax
circuits[0].key.compiled_pauli

[7]:

True-Q formatting will not be loaded without trusting this notebook or rerunning the affected cells. Notebooks can be marked as trusted by clicking "File -> Trust Notebook".
Type:
• Weyls
Dim:
• 2
Powers:
X0 X1 X2 X3 X4 Z0 Z1 Z2 Z3 Z4
0 0 0 1 0 1 1 1 1 1 0
[8]:

# inspect a particular value using subscript syntax
circuits[0].key["measurement_basis"]

[8]:

True-Q formatting will not be loaded without trusting this notebook or rerunning the affected cells. Notebooks can be marked as trusted by clicking "File -> Trust Notebook".
Type:
• Weyls
Dim:
• 2
Powers:
X0 X1 X2 X3 X4 Z0 Z1 Z2 Z3 Z4
0 0 0 0 0 0 1 1 1 1 1

If we have a KeySet, as returned by keys(), we can look at all unique values associated with a particular keyword to quickly identify the contents of a collection.

[9]:

# our collection contains circuits generated by the SRB and IRB protocols
circuits.keys().protocol

[9]:

{'IRB', 'SRB'}

[10]:

# all circuits present use simultaneous single-qubit Clifford twirling
circuits.keys().twirl

[10]:

{Twirl({(0,): 'C', (1,): 'C', (2,): 'C', (3,): 'C', (4,): 'C'}, dim=2)}


## Filtering Based on Keys

Keys are designed to allow fast filtering of large collections. Circuit and estimate collections contain the respective methods subset() and subset() for this purpose. We use the circuit collection created in the previous subsection, though the mechanics of filtering estimate collections are identical.

There are three ways that circuits can be filtered based on key values, (which can all be used together on different keywords in the same filtering operation):

1. By exact value equality.

[11]:

# collect all SRB circuits into a new collection
srb_circuits = circuits.subset(protocol="SRB")

1. By value containment in some allowed set of values.

[12]:

# collect all circuits with sequence length 2 or 4. the use of a set is necessary
short_circuits = circuits.subset(n_random_cycles={2, 4})

1. By value exclusion from some list of disallowed values.

[13]:

# collect all circuits whose sequence length is not 2 or 4. the use of list is necessary
long_circuits = circuits.subset(n_random_cycles=[2, 4])


We can combine the three types of filtering in a single operation, as seen below.

[14]:

irb_circuits_h = circuits.subset(cycles=(cycle_h,), n_random_cycles={2, 4})
irb_circuits_h.keys()

[14]:

True-Q formatting will not be loaded without trusting this notebook or rerunning the affected cells. Notebooks can be marked as trusted by clicking "File -> Trust Notebook".
 KeySet List of all the keys in the KeySet protocol The characterization protocol used to generate a circuit. cycles twirl The twirling group used to generate a circuit. n_random_cycles The number of independent random cycles in the circuit. compiled_pauli The n-qubit Pauli operator that was compiled into the circuit immediately before measurement. measurement_basis An n-qubit Pauli operator describing the change-of-basis gates added prior to measurement. Key Key: compiled_pauli: XZXXY cycles: (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) measurement_basis: ZZZZZ n_random_cycles: 4 protocol: IRB twirl: Cliffords on [0, 1, 2, 3, 4] IRB (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) Cliffords on [0, 1, 2, 3, 4] 4 XZXXY ZZZZZ Key Key: compiled_pauli: YYYYZ cycles: (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) measurement_basis: ZZZZZ n_random_cycles: 4 protocol: IRB twirl: Cliffords on [0, 1, 2, 3, 4] IRB (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) Cliffords on [0, 1, 2, 3, 4] 4 YYYYZ ZZZZZ Key Key: compiled_pauli: IYXIZ cycles: (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) measurement_basis: ZZZZZ n_random_cycles: 4 protocol: IRB twirl: Cliffords on [0, 1, 2, 3, 4] IRB (Cycle((0,): Gate.h, (1,): Gate.h, (2,): Gate.h, (3,): Gate.h, (4,): Gate.h),) Cliffords on [0, 1, 2, 3, 4] 4 IYXIZ ZZZZZ

## Using Keys in Custom Circuits

Users are encouraged to use keys to attach metadata to their own circuits. In the following demonstration, we create a collection of circuits which produce a 5 qubit GHZ state, rotate each qubit about Z by some angle phi, and then undo the GHZ state to measure the total phase accumulation. We use the key to keep track of which phase each circuit contains.

[15]:

circuits = tq.CircuitCollection()
for phi in np.linspace(-180, 180, 61):
circuit = tq.Circuit(key=tq.Key(phi=phi, measurement_basis=tq.math.Weyls("Z")))
circuit += {0: tq.Gate.h}
circuit += [{(i, i + 1): tq.Gate.cx} for i in range(4)]
circuit += {range(5): tq.Gate.rz(phi)}
circuit += [{(i, i + 1): tq.Gate.cx} for i in reversed(range(4))]
circuit += [{0: tq.Gate.h}, {0: tq.Meas()}]

circuits += circuit

# draw an example circuit
circuits[5].draw(False)

[15]:


Next, we attach results to all circuits in the collection with a noisy simulator.

[16]:

sim = tq.Simulator().add_overrotation(0.04, 0.08).add_stochastic_pauli(px=0.01)
sim.run(circuits, n_shots=128)


Finally, we can extract values from each circuit’s results and key to produce a plot.

[17]:

xs, ys = [], []
for circuit in circuits:
xs.append(circuit.key.phi)
ys.append(circuit.results[0] / 128)
ys = np.array(ys)
plt.errorbar(xs, ys, yerr=np.sqrt(ys * (1 - ys) / 128))
plt.xlabel("phi")
plt.ylabel("Pr(0)")

[17]:

Text(0, 0.5, 'Pr(0)')


## Augmenting True-Q™ Generated Circuits with User Metadata

We also encourage users to augment key metadata generated by True-Q™ protocols with their own keynames/values when convenient. In the following example, we insert SRB circuits into a circuit collection 11 times, each time augmenting the new circuits with an additional keyname eps whose value records how much single-qubit overrotation noise we have included in their simulation.

[18]:

circuits = tq.CircuitCollection()
for eps in np.linspace(0, 0.05, 11):
srb_circuits = tq.make_srb(range(3), [4, 12, 24, 48]).update_keys(eps=eps)
circuits += srb_circuits


Importantly, the fitter will treat these 11 groups independently, so that in the following table we see estimates for each of the three qubits, and for each of the 11 values of eps. Hovering over a cell in the top row of the table will produce a tooltip containing the full contents of the respective estimate’s key.

[19]:

fit = circuits.fit()
fit

[19]:

True-Q formatting will not be loaded without trusting this notebook or rerunning the affected cells. Notebooks can be marked as trusted by clicking "File -> Trust Notebook".
 SRB Streamlined Randomized Benchmarking Cliffords (0,) Key: eps: 0.025 labels: (0,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (0,) Key: eps: 0.04 labels: (0,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (0,) Key: eps: 0.01 labels: (0,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (0,) Key: eps: 0.045 labels: (0,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (0,) Key: eps: 0.0 labels: (0,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (0,) Key: eps: 0.05 labels: (0,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (0,) Key: eps: 0.015 labels: (0,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (0,) Key: eps: 0.035 labels: (0,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (0,) Key: eps: 0.03 labels: (0,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (0,) Key: eps: 0.005 labels: (0,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (0,) Key: eps: 0.02 labels: (0,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (1,) Key: eps: 0.01 labels: (1,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (1,) Key: eps: 0.005 labels: (1,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (1,) Key: eps: 0.04 labels: (1,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (1,) Key: eps: 0.045 labels: (1,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (1,) Key: eps: 0.015 labels: (1,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (1,) Key: eps: 0.05 labels: (1,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (1,) Key: eps: 0.035 labels: (1,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (1,) Key: eps: 0.025 labels: (1,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (1,) Key: eps: 0.02 labels: (1,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (1,) Key: eps: 0.0 labels: (1,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (1,) Key: eps: 0.03 labels: (1,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (2,) Key: eps: 0.05 labels: (2,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (2,) Key: eps: 0.005 labels: (2,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (2,) Key: eps: 0.015 labels: (2,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (2,) Key: eps: 0.0 labels: (2,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (2,) Key: eps: 0.04 labels: (2,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (2,) Key: eps: 0.02 labels: (2,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (2,) Key: eps: 0.045 labels: (2,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (2,) Key: eps: 0.035 labels: (2,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (2,) Key: eps: 0.025 labels: (2,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (2,) Key: eps: 0.01 labels: (2,) protocol: SRB twirl: Cliffords on [0, 1, 2] Cliffords (2,) Key: eps: 0.03 labels: (2,) protocol: SRB twirl: Cliffords on [0, 1, 2] ${e}_{F}$ The probability of an error acting on the targeted systems during a random gate. 9.2e-04 (2.2e-04) 0.0009197495574557457, 0.00021819845416838483 1.6e-03 (4.8e-04) 0.0015993973062819744, 0.00048017976701117887 2.3e-04 (1.0e-04) 0.0002267967044790875, 9.96152187205453e-05 5.1e-03 (1.2e-03) 0.0051076524528024525, 0.001160114401425507 0.0e+00 (0.0e+00) 0.0, 0.0 5.3e-03 (1.2e-03) 0.005341783185068283, 0.0011532446783725718 5.5e-04 (1.6e-04) 0.0005488905296296975, 0.00015932913195428644 2.3e-03 (4.1e-04) 0.0022965205174632353, 0.00040539403562872995 1.3e-03 (2.4e-04) 0.0012797383784513838, 0.00024228368628370663 5.1e-05 (3.3e-05) 5.0790671136058396e-05, 3.290869428928224e-05 4.4e-04 (1.6e-04) 0.0004445324697552322, 0.0001648186586855968 8.2e-05 (6.0e-05) 8.198745869547608e-05, 5.953965663083992e-05 7.1e-05 (4.0e-05) 7.079051513156354e-05, 3.951367767011635e-05 2.4e-03 (4.9e-04) 0.0024234837825752864, 0.0004895125010211547 3.4e-03 (9.9e-04) 0.0034338114816177268, 0.0009852680173187895 4.2e-04 (1.3e-04) 0.0004236298692344431, 0.00013160809670315638 5.6e-03 (1.3e-03) 0.005600883717593985, 0.001260088165945053 1.4e-03 (3.6e-04) 0.0013758944604935208, 0.0003579444161611827 1.1e-03 (3.2e-04) 0.0011448389166610062, 0.0003166249293126454 1.3e-03 (2.5e-04) 0.0012588161168470002, 0.0002511799660835658 0.0e+00 (0.0e+00) 0.0, 0.0 2.1e-03 (4.7e-04) 0.0020704999142930336, 0.0004653569582327504 3.7e-03 (8.9e-04) 0.0036960854909762475, 0.0008889201239180001 4.2e-05 (3.4e-05) 4.1727215156994735e-05, 3.413598177459205e-05 3.5e-04 (1.4e-04) 0.0003454129782984039, 0.0001403406711548313 0.0e+00 (0.0e+00) 0.0, 0.0 2.9e-03 (6.9e-04) 0.002938302923743419, 0.0006904706709807618 7.4e-04 (1.8e-04) 0.0007422562150134204, 0.00018337335835842358 3.1e-03 (1.1e-03) 0.0030730278145677803, 0.0010839059359967703 1.8e-03 (4.0e-04) 0.0018185426786805625, 0.0003959568719495466 8.2e-04 (1.7e-04) 0.0008165918170084663, 0.00017001478763083047 1.6e-04 (6.7e-05) 0.00016021267163310315, 6.700432325065674e-05 1.7e-03 (3.1e-04) 0.0016907203691105266, 0.00031338862026499605 ${p}$ Decay parameter of the exponential decay $Ap^m$. 1.0e+00 (2.9e-04) 0.9987736672567257, 0.00029093127222451314 1.0e+00 (6.4e-04) 0.9978674702582907, 0.0006402396893482385 1.0e+00 (1.3e-04) 0.9996976043940279, 0.00013282029162739372 9.9e-01 (1.5e-03) 0.9931897967295967, 0.001546819201900676 1.0e+00 (0.0e+00) 1.0, 0.0 9.9e-01 (1.5e-03) 0.992877622419909, 0.001537659571163429 1.0e+00 (2.1e-04) 0.9992681459604937, 0.00021243884260571525 1.0e+00 (5.4e-04) 0.9969379726433824, 0.0005405253808383066 1.0e+00 (3.2e-04) 0.9982936821620648, 0.0003230449150449422 1.0e+00 (4.4e-05) 0.9999322791051519, 4.387825905237633e-05 1.0e+00 (2.2e-04) 0.9994072900403264, 0.00021975821158079576 1.0e+00 (7.9e-05) 0.999890683388406, 7.938620884111988e-05 1.0e+00 (5.3e-05) 0.9999056126464912, 5.2684903560155135e-05 1.0e+00 (6.5e-04) 0.9967686882898996, 0.0006526833346948729 1.0e+00 (1.3e-03) 0.9954215846911764, 0.001313690689758386 1.0e+00 (1.8e-04) 0.9994351601743541, 0.00017547746227087517 9.9e-01 (1.7e-03) 0.992532155043208, 0.0016801175545934038 1.0e+00 (4.8e-04) 0.9981654740526753, 0.00047725922154824357 1.0e+00 (4.2e-04) 0.9984735481111187, 0.0004221665724168605 1.0e+00 (3.3e-04) 0.9983215785108707, 0.0003349066214447544 1.0e+00 (0.0e+00) 1.0, 0.0 1.0e+00 (6.2e-04) 0.9972393334476093, 0.0006204759443103339 1.0e+00 (1.2e-03) 0.9950718860120317, 0.0011852268318906668 1.0e+00 (4.6e-05) 0.999944363713124, 4.551464236612273e-05 1.0e+00 (1.9e-04) 0.9995394493622688, 0.0001871208948731084 1.0e+00 (0.0e+00) 1.0, 0.0 1.0e+00 (9.2e-04) 0.9960822627683421, 0.0009206275613076823 1.0e+00 (2.4e-04) 0.9990103250466488, 0.00024449781114456475 1.0e+00 (1.4e-03) 0.9959026295805763, 0.0014452079146623604 1.0e+00 (5.3e-04) 0.9975752764284259, 0.0005279424959327288 1.0e+00 (2.3e-04) 0.9989112109106554, 0.000226686383507774 1.0e+00 (8.9e-05) 0.9997863831044892, 8.933909766754233e-05 1.0e+00 (4.2e-04) 0.9977457061745193, 0.0004178514936866614 ${A}$ SPAM parameter of the exponential decay $Ap^m$. 1.0e+00 (4.6e-03) 0.9990679901001224, 0.004566005479231201 9.9e-01 (9.1e-03) 0.9911848008638039, 0.009131841846399933 1.0e+00 (2.2e-03) 0.9992798138584369, 0.0022276482440086696 9.8e-01 (2.2e-02) 0.9849376574084828, 0.02187742800264987 1.0e+00 (0.0e+00) 1.0, 0.0 1.0e+00 (2.1e-02) 1.009124689161809, 0.020689973714686238 1.0e+00 (2.7e-03) 1.0053166088728227, 0.002745178142003772 1.0e+00 (8.9e-03) 0.9960863612217012, 0.008911828609619959 9.9e-01 (5.4e-03) 0.9938045365862989, 0.005407037037577281 1.0e+00 (6.3e-04) 1.0001548078398088, 0.000632962082015278 9.9e-01 (3.9e-03) 0.9948407008838934, 0.003906337591441529 1.0e+00 (1.7e-03) 0.9987283007989377, 0.0017107024826046114 1.0e+00 (6.0e-04) 1.0010751920376453, 0.0006004989404632469 9.9e-01 (9.9e-03) 0.9934374300378466, 0.009911719606075998 9.8e-01 (1.8e-02) 0.9844418331657746, 0.017959410747761483 1.0e+00 (3.4e-03) 0.9969287158645235, 0.0034342848512044707 1.0e+00 (2.2e-02) 1.0183597577485923, 0.022439959548881956 9.9e-01 (7.2e-03) 0.9932056085559203, 0.007232711093081202 1.0e+00 (5.8e-03) 1.0028306658988808, 0.005811649999985244 1.0e+00 (4.9e-03) 1.0057769110470776, 0.004932955425091038 1.0e+00 (0.0e+00) 1.0, 0.0 1.0e+00 (9.1e-03) 1.000023302897044, 0.009075000527824758 1.0e+00 (1.6e-02) 1.000572581268109, 0.01625180103500067 1.0e+00 (8.7e-04) 0.9995554611673498, 0.0008715741457753192 1.0e+00 (3.7e-03) 0.9966858851602347, 0.003668857931065555 1.0e+00 (0.0e+00) 1.0, 0.0 9.9e-01 (1.4e-02) 0.9891985967219554, 0.014416756498686012 1.0e+00 (4.3e-03) 0.9993918281195138, 0.00426881099221968 9.8e-01 (1.9e-02) 0.9758181215503463, 0.019200080003881292 1.0e+00 (7.5e-03) 0.9999014372212262, 0.007520746887708769 1.0e+00 (3.8e-03) 1.0012136802778526, 0.003833583985936974 1.0e+00 (1.5e-03) 0.9993441508445613, 0.0015151199139123946 1.0e+00 (7.6e-03) 0.9962363680830882, 0.007632300606003632
[20]:

fit.plot.compare("e_F", "eps")


## Special Keywords

True-Q™ uses the following keywords for Keys internally. There are no restrictions on using these keywords for your own purposes, or manually overriding them, but doing so may cause fitting and other features to break.

Keyword

Description

amplification

Used by NOX to specify noise amplification.

analyze_decays

Stores CB decays to measure.

batch

Used by RCAL to index experiment batches.

compiled_pauli

Which Paulis were compiled prior to measurements.

cycles

The cycles of interest, see e.g. CB.

labels

A tuple of qubit labels.

measurement_basis

Which basis change was compiled into the circuit.

mitigation

The name of a mitigation protocol, e.g. NOX.

n_random_cycles

The number of independent random cycles in a circuit.

order

Sometimes used to order by key.

protocol

The name of a protocol, e.g. CB.

relabeling

Stores how a circuit was relabeled by a compiler.

seq_label

Used to index small variations of a common random circuit.

subsystems

Used by KNR to specify the gate-bodies to probe.

targeted_errors

Non-identity errors targeted by CB.

twirl

Stores the twirling group.

Usually, fit() produces a separate set of estimates for every unique combination of custom keywords (i.e. not in the list above). The exceptions to this rule are the following custom keywords, which will be ignored and deleted in the returned fit object:

Keyword

Description

job_id

E.g. store a job execution identifier.

n_shots

E.g. store a recommended number of shots for a circuit.