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.

MockIQParallelExperimentHelper

class MockIQParallelExperimentHelper(exp_list, exp_helper_list)[source]

Helper for Parallel experiment.

Parallel Experiment Helper initializer. The class assumes exp_helper_list is ordered to match the corresponding experiment in exp_list.

Note that __init__() does not have iq_cluster_centers and iq_cluster_width as in MockIQExperimentHelper.__init__(). This is because the centers and widths for MockIQParallelBackend are stored in multiple experiment helpers in the list exp_helper_list.

Parameters:
  • exp_list (List) – List of experiments.

  • exp_helper_list (List) – Ordered list of MockIQExperimentHelper corresponding to the experiments in exp_list. Nested parallel experiment aren’t supported currently.

Raises:
  • ValueError – Raised if the list are empty or if they don’t have the same length.

  • QiskitError – Raised if exp_helper_list contains an object of type MockIQParallelExperimentHelper, because the parallel mock backend currently does not support parallel sub-experiments.`.

Examples

Parallel experiment for Resonator Spectroscopy

To run a parallel experiment of Resonator Spectroscopy on two qubits we will create two instances of SpectroscopyHelper objects (for each experiment) and an instance of ParallelExperimentHelper with them.

iq_cluster_centers = [
    ((-1.0, 0.0), (1.0, 0.0)),
    ((0.0, -1.0), (0.0, 1.0)),
    ((3.0, 0.0), (5.0, 0.0)),
    ]

parallel_backend = MockIQParallelBackend(
    experiment_helper=None,
    rng_seed=0,
)
parallel_backend._configuration.basis_gates = ["x"]
parallel_backend._configuration.timing_constraints = {"granularity": 16}

# experiment parameters
qubit1 = 0
qubit2 = 1
freq01 = parallel_backend.defaults().qubit_freq_est[qubit1]
freq02 = parallel_backend.defaults().qubit_freq_est[qubit2]

# experiments initialization
frequencies1 = np.linspace(freq01 - 10.0e6, freq01 + 10.0e6, 23)
frequencies2 = np.linspace(freq02 - 10.0e6, freq02 + 10.0e6, 21)

exp_list = [
    QubitSpectroscopy(qubit1, frequencies1),
    QubitSpectroscopy(qubit2, frequencies2),
]

exp_helper_list = [
    SpectroscopyHelper(iq_cluster_centers=iq_cluster_centers,),
    SpectroscopyHelper(iq_cluster_centers=iq_cluster_centers,),
]
parallel_helper = ParallelExperimentHelper(exp_list, exp_helper_list)

parallel_backend.experiment_helper = parallel_helper

# initializing the parallel experiment
par_experiment = ParallelExperiment(exp_list, backend=parallel_backend)
par_experiment.set_run_options(meas_level=MeasLevel.KERNELED, meas_return="single")

par_data = par_experiment.run().block_for_results()

Attributes

MockIQParallelExperimentHelper.iq_cluster_centers

The base cluster centers in the IQ plane.

MockIQParallelExperimentHelper.iq_cluster_width

The base cluster widths in the IQ plane.

Methods

MockIQParallelExperimentHelper.compute_probabilities(...)

Run the compute_probabilities for each helper.

MockIQParallelExperimentHelper.iq_clusters(...)

Returns circuit-specific IQ cluster centers and widths in the IQ plane.

MockIQParallelExperimentHelper.iq_phase(circuits)

Sub-classes can override this method to introduce a phase in the IQ plane.