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.
Experiment Framework (qiskit_experiments.framework
)¶
Overview¶
The experiment framework broadly defines an experiment as the execution of one or more circuits on a device, and analysis of the resulting measurement data to return one or more derived results.
The interface for running an experiment is through the Experiment
classes subclassed from
BaseExperiment
, such as those contained in the library
. The
following pseudo-code illustrates the typical workflow in Qiskit Experiments for
Initializing a new experiment
Running the experiment on a backend
Saving result to an online database (for compatible providers)
Viewing analysis results
# Import an experiment
from qiskit_experiments.library import SomeExperiment
# Initialize with desired qubits and options
exp = SomeExperiment(physical_qubits, **options)
# Run on a backend
exp_data = exp.run(backend)
# Wait for execution and analysis to finish
exp_data.block_for_results()
# Optionally save results to database
exp_data.save()
# View analysis results
for result in exp_data.analysis_results():
print(result)
The experiment class contains information for generating circuits and analysis
of results. These can typically be configured with a variety of options.
Once all options are set, you can call the BaseExperiment.run()
method to run
the experiment on a Qiskit compatible backend
.
The steps of running an experiment involves generation experimental circuits
according to the options you set and submission of a job to the specified
backend
. Once the job has finished executing an analysis job performs
data analysis of the experiment execution results.
The result of running an experiment is an ExperimentData
container
which contains the analysis results, any figures generated during analysis,
and the raw measurement data. These can each be accessed using the
ExperimentData.analysis_results()
, ExperimentData.figure()
and ExperimentData.data()
methods respectively. Additional metadata
for the experiment itself can be added via ExperimentData.metadata()
.
Classes¶
Experiment Data Classes¶
|
Experiment data container class. |
|
Class for experiment status enumerated type. |
|
Class for analysis callback status enumerated type. |
|
Class representing an analysis result for an experiment. |
|
Dataclass for experiment analysis results |
A table-like dataset for analysis results. |
|
|
Store configuration settings for an Experiment class. |
|
Store configuration settings for an Analysis class. |
|
JSON Encoder for Qiskit Experiments. |
|
JSON Decoder for Qiskit Experiments. |
|
A dataclass for non-analysis result payloads in |
|
A plot data container. |
Composite Experiment Classes¶
|
Composite Experiment base class |
|
Combine multiple experiments into a parallel experiment. |
|
Combine multiple experiments into a batch experiment. |
|
Run analysis for composite experiments. |
Base Classes¶
|
Abstract base class for experiments. |
Abstract base class for analyzing Experiment data. |
Experiment Configuration Helper Classes¶
|
Class for providing joint interface for accessing backend data |
|
Helper for calculating pulse and delay times for an experiment |
A mixin to facilitate restless experiments. |