API

simulation

Chris’ function for running the SMC simulations

simulation.fid_smc(n_meas, K, n_qubits=1, n_trials=100, n_particles=1000, n_rec=15)[source]

Evaluates the average fidelity incurred by using sequential Monte Carlo (SMC) to estimate pure states.

Parameters:
  • n_meas (Integer) – The number of copies of the system given in each tomographic run
  • K (Integer) – Number of single-shot measurements
  • n_trials (Integer) – Number of times to run the SMC estimation procedure.
  • n_particles (Integer) – Number of SMC particles to use.
  • n_rec (Integer) – Number of place to record data (on a log scale)
Returns:

Dictionary of various fidelities and timings

Return type:

Dictionary

simulation.sim_qubit_fid(n_meas, n_meas_rep, meas_dist, n_trials=100, n_particles=1000, n_rec=15)[source]

Calculates the average fidelity of the optimal estimator (approximated by SMC) averaged over Haar random pure states and a random sample of measurement outcomes. The estimator is calculated at a given number of interim times throughout the tomographic process.

Parameters:
  • n_meas (Integer) – The number of copies of the system given in each tomographic run
  • n_meas_rep (Integer) – The number of measurement outcomes to average the fidelity over for each copy of the system in a tomographic run
  • meas_dist (Object possessing sample(n) function that returns a numpy.array((2, n)) of unit vectors in \(\mathbb{C}^2\)) – Object defining the distribution from which to draw measurement directions
  • n_trials (Integer) – The number of tomographic runs (aka samples from the pure state prior) the fidelity is averaged over
  • n_particles (Integer) – Number of SMC particles to use
  • n_rec (Integer) – Number of places to record average fidelity (on a log scale)
Returns:

An array with the calculated average fidelities at the specified times for all tomographic runs

Return type:

numpy.array((n_trials, n_rec))

model

Chris’ model code from the IPython notebook

gen_meas_record

A routine for generating measurement records that can be fed to different estimators for comparison purposes

gen_meas_record.generate_records(n_meas, n_meas_rep, estimators, n_trials=100, n_particles=1000)[source]

Generate measurement records. (Not implemented yet)

Parameters:
  • n_meas (int) – Number of copies of the system to be measured in each trial.
  • n_meas_rep (int) – Number of measurement outcomes samples for each copy of the system for each trial.
  • estimators ([function, ...]) – List of functions that take measurement records and calculate estimates of the state that produced those records.
  • n_trials (int) – Number of input pure states sampled from the prior distribution.
  • n_particles (int) – Number of SMC particles to use.
Returns:

An array with the calculated average fidelities at the specified times for all tomographic runs

Return type:

numpy.array((n_trials, n_rec))