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.

BatchExperiment

class BatchExperiment(experiments, backend=None, flatten_results=False, analysis=None)[source]

Combine multiple experiments into a batch experiment.

Batch experiments combine individual experiments on any subset of qubits into a single composite experiment which appends all the circuits from each component experiment into a single batch of circuits to be executed as one experiment job.

Analysis of batch experiments is performed using the CompositeAnalysis class which handles sorting the composite experiment circuit data into individual child ExperimentData containers for each component experiment which are then analyzed using the corresponding analysis class for that component experiment.

See CompositeAnalysis documentation for additional information.

Initialize a batch experiment.

Parameters:
  • experiments (List[BaseExperiment]) – a list of experiments.

  • backend (Optional[Backend]) – Optional, the backend to run the experiment on.

  • flatten_results (bool) – If True flatten all component experiment results into a single ExperimentData container, including nested composite experiments. If False save each component experiment results as a separate child ExperimentData container. This kwarg is ignored if the analysis kwarg is used.

  • analysis (Optional[CompositeAnalysis]) – Optional, the composite analysis class to use. If not provided this will be initialized automatically from the supplied experiments.

Attributes

BatchExperiment.analysis

Return the analysis instance for the experiment

BatchExperiment.backend

Return the backend for the experiment

BatchExperiment.experiment_options

Return the options for the experiment.

BatchExperiment.experiment_type

Return experiment type.

BatchExperiment.num_experiments

Return the number of sub experiments

BatchExperiment.num_qubits

Return the number of qubits for the experiment.

BatchExperiment.physical_qubits

Return the device qubits for the experiment.

BatchExperiment.run_options

Return options values for the experiment run() method.

BatchExperiment.transpile_options

Return the transpiler options for the run() method.

Methods

BatchExperiment.circuits()

Return a list of experiment circuits.

BatchExperiment.component_experiment([index])

Return the component Experiment object.

BatchExperiment.config()

Return the config dataclass for this experiment

BatchExperiment.copy()

Return a copy of the experiment

BatchExperiment.from_config(config)

Initialize an experiment from experiment config

BatchExperiment.run([backend, analysis, timeout])

Run an experiment and perform analysis.

BatchExperiment.set_experiment_options(**fields)

Set the experiment options.

BatchExperiment.set_run_options(**fields)

Set options values for the experiment run() method.

BatchExperiment.set_transpile_options(**fields)

Set the transpiler options for run() method.