Note
Click here to download the full example code
Analyzing Results
This tutorial provides an overview of how to use True-Q™'s analysis tools to retrieve parameters of interest from the results returned by True-Q™'s built-in protocols.
Each of True-Q™'s error characterization protocols returns parameters of interest that give information about the noise in your device or simulator. For example, in the case of SRB, the returned parameter is the process fidelity, averaged over the operations in the twirling group. This figure of merit largely quantifies compilation errors for the twirling gateset.
To see how to analyze the results for a given protocol, we first need a
CircuitCollection
containing circuits for a protocol, with
populated results
. To this end, we can run the
following code to construct a collection of SRB circuits and get some simulated
results:
import trueq as tq
# generate SRB circuits on a single qubit
circuit_collection = tq.make_srb(0, [4, 20, 60])
# create a noisy simulator
sim = tq.Simulator().add_overrotation(0.03)
# run the circuits on the noisy simulator and populate the results attribute
sim.run(circuit_collection)
To analyze the results, we can call the fit()
method, which is a universal function for CircuitCollection
s
containing Circuit
s from any subset of True-Q™'s error
diagnostic protocols. The fit()
method returns
estimates for some set of protocol-specific parameters.
circuit_collection.fit()
As you can see above, fit()
prints a table
containing the parameter estimates returned when the results are analyzed. Every
protocol will return different estimates corresponding to the parameters the protocol
is characterizing. Mousing over a parameter will give a short description of what the
parameter means. If a circuit collection contains circuits from more than one error
diagnostic protocol, fit
will return fits for
each protocol. For example, if we add some XRB circuits to the circuit
collection we defined above, we get the following:
# generate XRB circuits and append them to the circuit_collection
circuit_collection += tq.make_xrb(1, [4, 20, 60])
# run circuits again to populate XRB circuits. We set overwrite = False to keep the
# results obtained above for the SRB circuits
sim.run(circuit_collection, overwrite=False)
# analyze results
circuit_collection.fit()
Optional Fitting Arguments
Valid options for the trueq.CircuitCollection.fit()
method.
Certain analysis routines use optional arguments. The table below is an
exhaustive list of possible arguments. These arguments can be passed into
the fit()
method as keyword arguments.
type |
object |
properties |
Total running time of the script: ( 0 minutes 0.535 seconds)