Skip to content

Commit

Permalink
Switch tests and documentation to use qiskit-ibm-runtime fake backends
Browse files Browse the repository at this point in the history
The IBM-specific fake backends in Qiskit are being removed in Qiskit 1.0
in Qiskit/qiskit#11376. The same fake backends
have been moved to qiskit-ibm-runtime in
Qiskit/qiskit-ibm-runtime#1140 and follow up
PRs.

Here the `qiskit` imports are replaced with `qiskit-ibm-runtime` imports
in order to provide a smooth transition between Qiskit 0.45 and Qiskit
1.0. In the future, it may be preferable to use generic fake backends
maintained in the repo and not depend on `qiskit-ibm-runtime` for them.

Additionally, this commit reorders the requirements-dev.txt file so it
is easier to read and adds qiskit-ibm-runtime as a development
dependency.
  • Loading branch information
wshanks committed Jan 26, 2024
1 parent 2461683 commit 8fe9a7e
Show file tree
Hide file tree
Showing 34 changed files with 299 additions and 272 deletions.
8 changes: 6 additions & 2 deletions docs/manuals/characterization/stark_experiment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,13 @@ drive port of the qubit.
In a typical IBM device using the cross-resonance drive architecture,
such channel can be identified with your backend as follows:

.. note::
This tutorial requires the :mod:`qiskit_ibm_runtime` package to model a
backend. You can install it with ``python -m pip install qiskit-ibm-runtime``.

.. jupyter-execute::

from qiskit.providers.fake_provider import FakeHanoiV2
from qiskit_ibm_runtime.fake_provider import FakeHanoiV2

backend = FakeHanoiV2()
qubit = 0
Expand Down Expand Up @@ -143,7 +147,7 @@ by a variant of the Hahn-echo pulse sequence [5]_.

from qiskit_experiments.library import StarkRamseyXY
from qiskit import schedule, pulse
from qiskit.providers.fake_provider import FakeHanoi
from qiskit_ibm_runtime.fake_provider import FakeHanoi
from qiskit.visualization.pulse_v2 import IQXSimple

backend = FakeHanoi()
Expand Down
7 changes: 4 additions & 3 deletions docs/manuals/characterization/t1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ The following code demonstrates a basic run of a :math:`T_1` experiment
for qubit 0.

.. note::
This manual requires the :mod:`qiskit_aer` package to run simulations.
You can install it with ``python -m pip install qiskit-aer``.
This tutorial requires the :mod:`qiskit_aer` and :mod:`qiskit_ibm_runtime`
packages to run simulations. You can install them with ``python -m pip
install qiskit-aer qiskit-ibm-runtime``.

.. jupyter-execute::

Expand All @@ -42,9 +43,9 @@ for qubit 0.
from qiskit_experiments.library.characterization.analysis.t1_analysis import T1KerneledAnalysis

# A T1 simulator
from qiskit.providers.fake_provider import FakePerth
from qiskit_aer import AerSimulator
from qiskit_aer.noise import NoiseModel
from qiskit_ibm_runtime.fake_provider import FakePerth

# A kerneled data simulator
from qiskit_experiments.test.mock_iq_backend import MockIQBackend
Expand Down
7 changes: 4 additions & 3 deletions docs/manuals/characterization/t2ramsey.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ We run the experiment on a simulated backend using Qiskit Aer with a
pure T1/T2 relaxation noise model.

.. note::
This manual requires the :mod:`qiskit_aer` package to run simulations.
You can install it with ``python -m pip install qiskit-aer``.
This tutorial requires the :mod:`qiskit_aer` and :mod:`qiskit_ibm_runtime`
packages to run simulations. You can install them with ``python -m pip
install qiskit-aer qiskit-ibm-runtime``.

.. jupyter-execute::

# A T1 simulator
from qiskit.providers.fake_provider import FakePerth
from qiskit_ibm_runtime.fake_provider import FakePerth
from qiskit_aer import AerSimulator
from qiskit_aer.noise import NoiseModel

Expand Down
7 changes: 4 additions & 3 deletions docs/manuals/characterization/tphi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ From the :math:`T_1` and :math:`T_2` estimates, we compute the results for
:math:`T_\varphi.`

.. note::
This manual requires the :mod:`qiskit_aer` package to run simulations.
You can install it with ``python -m pip install qiskit-aer``.
This tutorial requires the :mod:`qiskit_aer` and :mod:`qiskit_ibm_runtime`
packages to run simulations. You can install them with ``python -m pip
install qiskit-aer qiskit-ibm-runtime``.

.. jupyter-execute::

Expand All @@ -31,9 +32,9 @@ From the :math:`T_1` and :math:`T_2` estimates, we compute the results for
from qiskit_experiments.library.characterization import Tphi

# An Aer simulator
from qiskit.providers.fake_provider import FakePerth
from qiskit_aer import AerSimulator
from qiskit_aer.noise import NoiseModel
from qiskit_ibm_runtime.fake_provider import FakePerth

# Create a pure relaxation noise model for AerSimulator
noise_model = NoiseModel.from_backend(
Expand Down
7 changes: 4 additions & 3 deletions docs/manuals/measurement/readout_mitigation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ This notebook demonstrates the usage of both the local and correlated
experiments to generate the corresponding mitigators.

.. note::
This manual requires the :mod:`qiskit_aer` package to run simulations.
You can install it with ``python -m pip install qiskit-aer``.
This tutorial requires the :mod:`qiskit_aer` and :mod:`qiskit_ibm_runtime`
packages to run simulations. You can install them with ``python -m pip
install qiskit-aer qiskit-ibm-runtime``.

.. jupyter-execute::

Expand All @@ -43,7 +44,7 @@ experiments to generate the corresponding mitigators.
from qiskit_experiments.library import LocalReadoutError, CorrelatedReadoutError

from qiskit_aer import AerSimulator
from qiskit.providers.fake_provider import FakePerth
from qiskit_ibm_runtime.fake_provider import FakePerth

from qiskit.result.mitigation.utils import (
expval_with_stddev,
Expand Down
Loading

0 comments on commit 8fe9a7e

Please sign in to comment.