Tomography involves making many projective measurements of a quantum state or process and using them to reconstruct the initial-state or process.

Running State Tomography

Prepare the experiments

We wish to perform state tomography on a graph state on qubits 0-1 on the 9q-generic-noisy-qvm

from pyquil import Program, get_qc
from pyquil.gates import *
qubits = [0, 1]
qc = get_qc("9q-generic-noisy-qvm")

state_prep = Program([H(q) for q in qubits])

The state prep program is thus:

H 0
H 1
CZ 0 1

We generate the required experiments:

from forest.benchmarking.tomography import *
exp_desc = generate_state_tomography_experiment(state_prep, qubits)

which in this case are measurements of the following operators:


Data Acquisition

We can then collect data:

from forest.benchmarking.observable_estimation import estimate_observables
results = list(estimate_observables(qc, exp_desc))

Estimate the State

Finally, we analyze our data with one of the analysis routines:

rho_est = linear_inv_state_estimate(results, qubits)
print(np.real_if_close(np.round(rho_est, 3)))
[[ 0.263-0.j     0.209-0.014j  0.23 -0.027j -0.203-0.01j ]
[ 0.209+0.014j  0.231+0.j     0.175+0.j    -0.168-0.019j]
[ 0.23 +0.027j  0.175-0.j     0.277-0.j    -0.173+0.004j]
[-0.203+0.01j  -0.168+0.019j -0.173-0.004j  0.229-0.j   ]]
do_tomography(qc, program, qubits, kind, …) A wrapper around experiment generation, data acquisition, and estimation that runs a tomography experiment and returns the state or process estimate along with the experiment and results.

State Tomography

generate_state_tomography_experiment(…) Generate an ObservablesExperiment containing the experimental settings required to characterize a quantum state.
linear_inv_state_estimate(results, qubits) Estimate a quantum state using linear inversion.
iterative_mle_state_estimate(results, qubits) Given tomography data, use one of three iterative algorithms to return an estimate of the state.
estimate_variance(results, qubits, …[, …]) Use a simple bootstrap-like method to return an error bar on some functional of the quantum state.

Process Tomography

generate_process_tomography_experiment(…) Generate an ObservablesExperiment containing the experiment settings required to characterize a quantum process.
linear_inv_process_estimate(results, qubits) Estimate a quantum process using linear inversion.
pgdb_process_estimate(results, qubits[, …]) Provide an estimate of the process via Projected Gradient Descent with Backtracking [PGD].