Processing math: 0%

Python Tools Related to Tomography (tomographer.tools)¶

The tools collected in these modules are separated from the other modules, because in contrast to the other modules (except for jpyutil and querrorbars), these do not interface any C++ code and are written in pure Python.

Simulating Measurements, and More (tomographer.tools.densedm)¶

This module collects utilities gravitating around some standard tasks you may need to perform when doing quantum tomography.

A routine allows you to simulate measurement outcomes from a true quantum state and a set of measurement settings. The standard Pauli measurement settings on a qubit are available in PauliMeasEffectsQubit.

A separate submodule (mle) determines the maximum likelihood estimate given experimental data.

Further tools may be added to these modules in the future.

tomographer.tools.densedm.PauliMeasEffectsQubit = [[array([[ 0.5, 0.5], [ 0.5, 0.5]]), array([[ 0.5, -0.5], [-0.5, 0.5]])], [array([[ 0.5+0.j , -0.0-0.5j], [ 0.0+0.5j, 0.5+0.j ]]), array([[ 0.5+0.j , 0.0+0.5j], [-0.0-0.5j, 0.5+0.j ]])], [array([[1, 0], [0, 0]]), array([[0, 0], [0, 1]])]]¶

List of POVMs corresponding to measuring Pauli operators on a single qubit. PauliMeasEffectQubit[i][s] is the POVM effect corresponding to measuring the outcome indexed by s of the Pauli operator indexed by i.

tomographer.tools.densedm.simulate_measurements(rho, Mk, num_samples_per_setting)¶

Simulate measurements for quantum tomography.

The “true state” rho should be a numpy.array object, as well as each POVM effect in Mk.

Mk should be a list of lists of POVM effects, where Mk[k][i] is the POVM effect corresponding to outcome i of measurement setting k. A POVM effect must be a positive semidefinite matrix (given as a NumPy array), and all effects of a measurement setting should sum up to the identity matrix.

num_samples_per_setting specifies the number of repetitions of a measurement setting. If it is an integer, then we simulate this number of measurement outcomes for each measurement setting in Mk. If it is a list (or a numpy.array), then it should have the same length as there are settings in Mk (i.e. len(Mk) == len(num_samples_per_setting)), and for the k-th measurement setting in Mk we will simulate num_samples_per_setting[k] number of outcomes.

Returns: an object d with properties d.Emn and d.Nm, representing the POVM effects and simulated frequency counts. They are in a format suitable for input to tomographer.tomorun.tomorun() or tomographer.densedm.IndepMeasLLH.

Maximum Likelihood Estimation (tomographer.tools.densedm.mle)¶

Utility to find the MLE estimate, using cvxpy.

tomographer.tools.densedm.mle.DEFAULT_SOLVER_OPTS = {'eps': 1e-06, 'max_iters': 5000, 'solver': 'SCS', 'verbose': True}¶

The default solver options used by find_mle().

tomographer.tools.densedm.mle.find_mle(llh, solver_opts=None)¶

Find the Maximum Likelihood Estimate state. The measurement data is specified in the llh argument as a tomographer.densedm.IndepMeasLLH instance.

This function creates and solves a cvxpy problem solving the following:

maximize:∑kNklntr(Ek⋅ρ)subject to:ρ⩾

The return value of this function is an two-tuple (rho_MLE, d), where rho_MLE is a numpy.array representing the maximum likelihood estimate, and where d is an object with the following attributes set:

  • d.result: the raw return value of cvxpy.solve()
  • d.rho_MLE: a copy of rho_MLE
  • d.rho_vars: a two-tuple (rho_R, rho_I,) of the raw cvxpy variables used to represent the complex variable rho. (Cvxpy doesn’t support complex variables, so we need to declare two real matrix variables, corresponding to the real and imaginary parts of the variable rho.)
  • d.objective: the raw optimization objective object constructed for cvxpy
  • d.constraints: the list of constraints specified to cvxpy
  • d.problem: the raw cvxpy problem object

The optional solve_opts argument is a dictionary of options that are directly passed on to cvxpy. The keys specified in solve_opts override the default keys in DEFAULT_SOLVER_OPTS.

Tomographer Python Interface

Navigation

  • Histogram Classes (tomographer)
  • Metropolis-Hastings Random Walk related classes (tomographer)
  • Exception Classes (tomographer)
  • Multiprocessing related classes (tomographer.multiproc)
  • Storing Tomography Data and Calculating the Likelihood Function (tomographer.densedm)
  • Tomorun, the main tomography routine (tomographer.tomorun)
  • Utilities for Metropolis-Hastings random walk tasks (tomographer.mhrwtasks)
  • Computing the quantum error bars (tomographer.querrorbars)
  • Python Tools Related to Tomography (tomographer.tools)
    • Simulating Measurements, and More (tomographer.tools.densedm)
    • Maximum Likelihood Estimation (tomographer.tools.densedm.mle)
  • Utilities for Jupyter notebooks (tomographer.jpyutil)
  • Utilities for compiling other modules (tomographer.include)
  • Version and compilation information (tomographer.version)
  • Writing Special-Purpose C++ Code with a Python Interface

Related Topics

  • Documentation overview
    • <no title>
      • Previous: Computing the quantum error bars (tomographer.querrorbars)
      • Next: Utilities for Jupyter notebooks (tomographer.jpyutil)

Quick search

©2016, Philippe Faist. | Powered by Sphinx 1.7.4 & Alabaster 0.7.9 | Page source