TomographyAnalysis

class TomographyAnalysis[source]

Base analysis for state and process tomography experiments.

Analysis options

These are the keyword arguments of the run() method.

Options
  • Defined in the class TomographyAnalysis:

    • measurement_basis (MeasurementBasis)

      Default value: None
      The measurement MeasurementBasis to use for tomographic reconstruction when running a StateTomography or ProcessTomography.
    • preparation_basis (PreparationBasis)

      Default value: None
      The preparation PreparationBasis to use for tomographic reconstruction for ProcessTomography.
    • 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 (Any)

      Default value: None
      Optional, target object for fidelity comparison of the fit (Default: None).
    • 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_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 reconstructed 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 reconstructed state 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”.
    • 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.

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