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.

ProcessTomographyAnalysis

class ProcessTomographyAnalysis[source]

Quantum state and process 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 the run() method.

Options
  • Defined in the class ProcessTomographyAnalysis:

    • measurement_basis (MeasurementBasis)

      Default value: Instance of PauliMeasurementBasis
      The measurement MeasurementBasis to use for tomographic process reconstruction.
    • preparation_basis (PreparationBasis)

      Default value: Instance of PauliPreparationBasis
      The preparation PreparationBasis to use for tomographic process 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.
    • 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 (str or QuantumChannel or Operator)

      Default value: None
      Optional, Set a custom target quantum channel for computing the process_fidelity() of the fitted process 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 channel. Enabling this will return a list of reconstructed channel 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 reconstructed channel components conditioned on the remaining tomographic bases conditional on the basis index, and outcome value for these measurements. The conditional 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.
    • 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 reconstructed channel components conditioned on the remaining tomographic bases conditional on the basis index. The conditional preparation basis index is stored in state analysis result extra fields “conditional_preparation_index”.
  • Defined in the class TomographyAnalysis:

    • 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).
    • extra (Dict[str, Any])

      Default value: {}
      Extra metadata dictionary attached to analysis results.
  • 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

options

Return the analysis options for run() method.

Methods

config()

Return the config dataclass for this analysis

Return type:

AnalysisConfig

copy()

Return a copy of the analysis

Return type:

BaseAnalysis

classmethod from_config(config)

Initialize an analysis class from analysis config

Return type:

BaseAnalysis

run(experiment_data, replace_results=False, **options)

Run analysis and update ExperimentData with analysis result.

Parameters:
  • experiment_data (ExperimentData) – the experiment data to analyze.

  • replace_results (bool) – If True clear any existing analysis results, figures, and artifacts in the experiment data and replace with new results. See note for additional information.

  • options – additional analysis options. See class documentation for supported options.

Returns:

An experiment data object containing analysis results, figures, and artifacts.

Raises:

QiskitError – If experiment_data container is not valid for analysis.

Return type:

ExperimentData

Note

Updating Results

If analysis is run with replace_results=True then any analysis results, figures, and artifacts in the experiment data will be cleared and replaced with the new analysis results. Saving this experiment data will replace any previously saved data in a database service using the same experiment ID.

If analysis is run with replace_results=False and the experiment data being analyzed has already been saved to a database service, or already contains analysis results or figures, a copy with a unique experiment ID will be returned containing only the new analysis results and figures. This data can then be saved as its own experiment to a database service.

set_options(**fields)

Set the analysis options for run() method.

Parameters:

fields – The fields to update the options