Skip to content

Commit

Permalink
Remove workarounds for passing run options to sampler (qiskit-communi…
Browse files Browse the repository at this point in the history
…ty#1498)

This runtime patching code was added along with the initial support for
sampler execution because the path through
`qiskit_ibm_runtime.SamplerV2` through to `BackendSamplerV2` did not
carry through options for level 1 measurements or noise models. This
path is used in the tests (while execution on physical backends with
`SamplerV2` does not use this path). Now with Qiskit 1.3 and
qiskit-ibm-runtime 0.34, this patching is no longer needed. Remaining
warnings filtering was moved to the calibrations tutorial where it was
needed.

---------

Co-authored-by: Yael Ben-Haim <[email protected]>
  • Loading branch information
wshanks and yaelbh authored Dec 10, 2024
1 parent fc7acf0 commit 9bf2848
Show file tree
Hide file tree
Showing 27 changed files with 7 additions and 392 deletions.
7 changes: 0 additions & 7 deletions docs/howtos/artifacts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ Viewing artifacts
Here we run a parallel experiment consisting of two :class:`.T1` experiments in parallel and then view the output
artifacts as a list of :class:`.ArtifactData` objects accessed by :meth:`.ExperimentData.artifacts`:

.. jupyter-execute::
:hide-code:

# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()

.. jupyter-execute::

from qiskit_ibm_runtime.fake_provider import FakePerth
Expand Down
7 changes: 0 additions & 7 deletions docs/manuals/characterization/t1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ for qubit 0.
packages to run simulations. You can install them with ``python -m pip
install qiskit-aer qiskit-ibm-runtime``.

.. jupyter-execute::
:hide-code:

# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()

.. jupyter-execute::

import numpy as np
Expand Down
7 changes: 0 additions & 7 deletions docs/manuals/characterization/t2ramsey.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,6 @@ pure T1/T2 relaxation noise model.
packages to run simulations. You can install them with ``python -m pip
install qiskit-aer qiskit-ibm-runtime``.

.. jupyter-execute::
:hide-code:

# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()

.. jupyter-execute::

# A T1 simulator
Expand Down
7 changes: 0 additions & 7 deletions docs/manuals/characterization/tphi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ From the :math:`T_1` and :math:`T_2` estimates, we compute the results for
packages to run simulations. You can install them with ``python -m pip
install qiskit-aer qiskit-ibm-runtime``.

.. jupyter-execute::
:hide-code:

# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()

.. jupyter-execute::

import numpy as np
Expand Down
7 changes: 0 additions & 7 deletions docs/manuals/measurement/readout_mitigation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ experiments to generate the corresponding mitigators.
packages to run simulations. You can install them with ``python -m pip
install qiskit-aer qiskit-ibm-runtime``.

.. jupyter-execute::
:hide-code:

# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()

.. jupyter-execute::

import numpy as np
Expand Down
4 changes: 0 additions & 4 deletions docs/manuals/measurement/restless_measurements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ they use always starts with the qubits in the ground state.
category=DeprecationWarning,
)

# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()

.. jupyter-execute::

from qiskit_ibm_runtime.fake_provider import FakePerth
Expand Down
7 changes: 0 additions & 7 deletions docs/manuals/verification/quantum_volume.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ z_value = 2), and at least 100 trials have been ran.
packages to run simulations. You can install them with ``python -m pip
install qiskit-aer qiskit-ibm-runtime``.

.. jupyter-execute::
:hide-code:

# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()

.. jupyter-execute::

from qiskit_experiments.framework import BatchExperiment
Expand Down
7 changes: 0 additions & 7 deletions docs/manuals/verification/randomized_benchmarking.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ explanation on the RB method, which is based on Refs. [1]_ [2]_.
packages to run simulations. You can install them with ``python -m pip
install qiskit-aer qiskit-ibm-runtime``.

.. jupyter-execute::
:hide-code:

# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()

.. jupyter-execute::

import numpy as np
Expand Down
7 changes: 0 additions & 7 deletions docs/manuals/verification/state_tomography.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ complete basis of measurement operators.

We first initialize a simulator to run the experiments on.

.. jupyter-execute::
:hide-code:

# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()

.. jupyter-execute::

from qiskit_aer import AerSimulator
Expand Down
1 change: 1 addition & 0 deletions docs/tutorials/calibrations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ This automatic updating can also be disabled using the ``auto_update`` flag.
message=".*The entire Qiskit Pulse package is being deprecated.*",
category=DeprecationWarning,
)
warnings.filterwarnings("ignore", ".*Could not determine job completion time.*", UserWarning)

.. jupyter-execute::

Expand Down
7 changes: 0 additions & 7 deletions docs/tutorials/custom_experiment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -562,13 +562,6 @@ To test our code, we first simulate a noisy backend with asymmetric readout erro
You can install it with ``python -m pip install qiskit-aer``.


.. jupyter-execute::
:hide-code:

# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()

.. jupyter-execute::

from qiskit_aer import AerSimulator, noise
Expand Down
7 changes: 0 additions & 7 deletions docs/tutorials/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,6 @@ backend, real or simulated, that you can access through Qiskit.
packages to run simulations. You can install them with ``python -m pip
install qiskit-aer qiskit-ibm-runtime``.

.. jupyter-execute::
:hide-code:

# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()

.. jupyter-execute::

from qiskit_ibm_runtime.fake_provider import FakePerth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ class CorrelatedReadoutError(BaseExperiment):
.. jupyter-execute::
:hide-code:
# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()
from qiskit.providers.fake_provider import GenericBackendV2
from qiskit_aer import AerSimulator
Expand Down
4 changes: 0 additions & 4 deletions qiskit_experiments/library/characterization/fine_frequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ class FineFrequency(BaseExperiment):
.. jupyter-execute::
:hide-code:
# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()
# backend
from qiskit_ibm_runtime.fake_provider import FakePerth
from qiskit_aer import AerSimulator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ class LocalReadoutError(BaseExperiment):
.. jupyter-execute::
:hide-code:
# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()
# backend
from qiskit_aer import AerSimulator
from qiskit_ibm_runtime.fake_provider import FakePerth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ class MultiStateDiscrimination(BaseExperiment):
.. jupyter-execute::
:hide-code:
# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()
# backend
from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend
backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=False, seed=199)
Expand Down
4 changes: 0 additions & 4 deletions qiskit_experiments/library/characterization/ramsey_xy.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ class RamseyXY(BaseExperiment, RestlessMixin):
.. jupyter-execute::
:hide-code:
# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()
# backend
from qiskit_aer import AerSimulator
from qiskit_ibm_runtime.fake_provider import FakePerth
Expand Down
4 changes: 0 additions & 4 deletions qiskit_experiments/library/characterization/t1.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ class T1(BaseExperiment):
.. jupyter-execute::
:hide-code:
# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()
# backend
from qiskit_ibm_runtime.fake_provider import FakeManilaV2
from qiskit_aer import AerSimulator
Expand Down
4 changes: 0 additions & 4 deletions qiskit_experiments/library/characterization/t2ramsey.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ class T2Ramsey(BaseExperiment):
.. jupyter-execute::
:hide-code:
# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()
# backend
from qiskit_ibm_runtime.fake_provider import FakeManilaV2
from qiskit_aer import AerSimulator
Expand Down
4 changes: 0 additions & 4 deletions qiskit_experiments/library/characterization/tphi.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ class Tphi(BatchExperiment):
.. jupyter-execute::
:hide-code:
# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()
# backend
from qiskit_ibm_runtime.fake_provider import FakeManilaV2
from qiskit_aer import AerSimulator
Expand Down
4 changes: 0 additions & 4 deletions qiskit_experiments/library/characterization/zz_ramsey.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ class ZZRamsey(BaseExperiment):
.. jupyter-execute::
:hide-code:
# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support
patch_sampler_test_support()
# backend
from qiskit_ibm_runtime.fake_provider import FakePerth
from qiskit_aer import AerSimulator
Expand Down
5 changes: 0 additions & 5 deletions qiskit_experiments/test/mock_iq_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ def __init__(
backend_version: str = None,
**fields,
):
# Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime
from qiskit_experiments.test.patching import patch_sampler_test_support

patch_sampler_test_support()

super().__init__(provider, name, description, online_date, backend_version, **fields)

backend_v1 = FakeOpenPulse2Q()
Expand Down
Loading

0 comments on commit 9bf2848

Please sign in to comment.