Note

This is the documentation for the current state of the development branch of Qiskit Experiments. The documentation or APIs here can change prior to being released.

StateTomographyAnalysis

class StateTomographyAnalysis[source]

State tomography experiment analysis.

Warning

The API for tomography fitters is still under development so may change in future releases.

Overview

Fitter Functions

Built-in fitter functions may be selected using the following string labels, refer to the corresponding functions documentation for additional details on the fitters.

PSD Rescaling

For fitters that do not constrain the reconstructed state to be positive-semidefinite (PSD) we construct the maximum-likelihood nearest PSD state under the assumption of Gaussian measurement noise using the rescaling method in Reference [1]. For fitters that already support PSD constraints this option can be disabled by setting rescale_positive=False.

References

[1] John A. Smolin, Jay M. Gambetta, Graeme Smith, Maximum Likelihood, Minimum Effort, Phys. Rev. Lett. 108, 070502 (2012), doi: 10.1103/PhysRevLett.108.070502 (open)

Analysis options

These are the keyword arguments of run() method.

Options
  • Defined in the class StateTomographyAnalysis:

    • measurement_basis (MeasurementBasis)

      Default value: Instance of PauliMeasurementBasis
      The measurement MeasurementBasis to use for tomographic state reconstruction.
    • fitter (str or Callable)

      Default value: "linear_inversion"
      The fitter function to use for reconstruction. This can be a string to select one of the built-in fitters, or a callable to supply a custom fitter function. See the Fitter Functions section for additional information.
    • fitter_options (dict)

      Default value: {}
      Any addition kwarg options to be supplied to the fitter function. For documentation of available kwargs refer to the fitter function documentation.
    • rescale_positive (bool)

      Default value: True
      If True rescale the state returned by the fitter to be positive-semidefinite. See the PSD Rescaling section for additional information (Default: True).
    • rescale_trace (bool)

      Default value: True
      If True rescale the state returned by the fitter have either trace 1 for DensityMatrix, or trace dim for Choi matrices (Default: True).
    • measurement_qubits (Sequence[int])

      Default value: None
      Optional, the physical qubits with tomographic measurements. If not specified will be set to [0, ..., N-1] for N-qubit tomographic measurements.
    • target (str or DensityMatrix or Statevector)

      Default value: None
      Optional, set a custom target quantum state for computing the state_fidelity() of the fitted state against (Default: None).
    • conditional_circuit_clbits (list[int])

      Default value: None
      Optional, the clbit indices in the source circuit to be conditioned on when reconstructing the state. Enabling this will return a list of reconstrated state components conditional on the values of these clbit values. The integer value of the conditioning clbits is stored in state analysis result extra field “conditional_circuit_outcome”.
    • conditional_measurement_indices (list[int])

      Default value: None
      Optional, indices of tomography measurement qubits to used for conditional state reconstruction. Enabling this will return a list of reconstrated state components conditioned on the remaining tomographic bases conditional on the basis index, and outcome value for these measurements. The conditionl measurement basis index and integer value of the measurement outcome is stored in state analysis result extra fields “conditional_measurement_index” and “conditional_measurement_outcome” respectively.
  • Defined in the class TomographyAnalysis:

    • preparation_basis (PreparationBasis)

      Default value: None
      The preparation PreparationBasis to use for tomographic reconstruction for ProcessTomography.
    • preparation_qubits (Sequence[int])

      Default value: None
      Optional, the physical qubits with tomographic preparations. If not specified will be set to [0, ..., N-1] for N-qubit tomographic preparations.
    • target_bootstrap_samples (int)

      Default value: 0
      Optional, number of outcome re-samples to draw from measurement data for each basis for computing a bootstrapped standard error of fidelity with the target state. If 0 no bootstrapping will be performed and the target fidelity will not include a standard error (Default: 0).
    • target_bootstrap_seed (int | None | Generator)

      Default value: None
      Optional, RNG seed or Generator to use for bootstrapping data for boostrapped fidelity standard error calculation (Default: None).
    • conditional_preparation_indices (list[int])

      Default value: None
      Optional, indices of tomography preparation qubits to used for conditional state reconstruction. Enabling this will return a list of reconstrated channel components conditioned on the remaining tomographic bases conditional on the basis index. The conditionl preparation basis index is stored in state analysis result extra fields “conditional_preparation_index”.
  • Defined in the class BaseAnalysis:

    • figure_names (str or List[str])

      Default value: None
      Identifier of figures that appear in the experiment data to sort figures by name.

Note

Fitters starting with "cvxpy_*" require the optional CVXPY Python package to be installed.

See also

Initialization

Initialize the analysis object.

Attributes

StateTomographyAnalysis.options

Return the analysis options for run() method.

Methods

StateTomographyAnalysis.config()

Return the config dataclass for this analysis

StateTomographyAnalysis.copy()

Return a copy of the analysis

StateTomographyAnalysis.from_config(config)

Initialize an analysis class from analysis config

StateTomographyAnalysis.run(experiment_data)

Run analysis and update ExperimentData with analysis result.

StateTomographyAnalysis.set_options(**fields)

Set the analysis options for run() method.