Skip to content

Commit

Permalink
Deprecate pulse and restless related experiments and classes
Browse files Browse the repository at this point in the history
This change deprecates the experiments that rely on scanning the
parameters of pulses in pulse gate calibrations. Qiskit 2.0 will remove
support for pulse gate calibrations, making these experiments impossible
to run. The `Calibrations` and `BasisGateLibrary` classes are also
deprecated since they have no use without pulse gate calibrations to
track. It is planned that Qiskit Pulse will be moved to Qiskit Dynamics
and perhaps the experiments and calibrations can be adapted to that use
case for calibrating simulated experiments. For now though, this code is
removed from Qiskit Experiments to help with making the package more
maintainable.

Support for restless experiments is also deprecated with this change.
Restless support is distinct from pulse support, but it is deprecated
with the same motivation of simplifying the package overall. With
improvements in the reliability of IBM Quantum's qubit initialization,
circuit exectuion has already become reasonably fast and restless
measurements do not add much performance improvement. It is expected
that the restless features are little used as there has been no user
feedback about them.
  • Loading branch information
wshanks committed Oct 24, 2024
1 parent ebe7a33 commit ee94384
Show file tree
Hide file tree
Showing 19 changed files with 222 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/manuals/characterization/stark_experiment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ by a variant of the Hahn-echo pulse sequence [5]_.

%matplotlib inline

import warnings

warnings.filterwarnings(
"ignore",
message=".*Due to the deprecation of Qiskit Pulse.*",
category=DeprecationWarning,
)

from qiskit_experiments.library import StarkRamseyXY
from qiskit import schedule, pulse
from qiskit_ibm_runtime.fake_provider import FakeHanoiV2
Expand Down
8 changes: 8 additions & 0 deletions docs/manuals/measurement/restless_measurements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ they use always starts with the qubits in the ground state.
.. jupyter-execute::
:hide-code:

import warnings

warnings.filterwarnings(
"ignore",
message=".*Support for restless.*",
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()
Expand Down
11 changes: 11 additions & 0 deletions docs/tutorials/calibrations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ This automatic updating can also be disabled using the ``auto_update`` flag.
This tutorial requires the :mod:`qiskit_dynamics` package to run simulations.
You can install it with ``python -m pip install qiskit-dynamics``.

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

import warnings

warnings.filterwarnings(
"ignore",
message=".*Due to the deprecation of Qiskit Pulse.*",
category=DeprecationWarning,
)

.. jupyter-execute::

import pandas as pd
Expand Down
11 changes: 11 additions & 0 deletions docs/tutorials/data_processor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ The code below sets up the Rabi experiment.
This tutorial requires the :mod:`qiskit_dynamics` package to run simulations.
You can install it with ``python -m pip install qiskit-dynamics``.

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

import warnings

warnings.filterwarnings(
"ignore",
message=".*Due to the deprecation of Qiskit Pulse.*",
category=DeprecationWarning,
)

.. jupyter-execute::

import numpy as np
Expand Down
11 changes: 11 additions & 0 deletions docs/tutorials/visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ First, we display the default figure from a :class:`.Rabi` experiment as a start
:external+qiskit_ibm_runtime:doc:`qiskit-ibm-runtime <index>` packages to run simulations. You can install them
with ``python -m pip install qiskit-dynamics qiskit-aer qiskit-ibm-runtime``.

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

import warnings

warnings.filterwarnings(
"ignore",
message=".*Due to the deprecation of Qiskit Pulse.*",
category=DeprecationWarning,
)

.. jupyter-execute::

import numpy as np
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from qiskit.circuit import Parameter
from qiskit import pulse
from qiskit.pulse import ScheduleBlock
from qiskit.utils.deprecation import deprecate_func

from qiskit_experiments.calibration_management.calibration_key_types import DefaultCalValue
from qiskit_experiments.exceptions import CalibrationError
Expand All @@ -39,6 +40,14 @@ class BasisGateLibrary(ABC, Mapping):
# Parameters that do not belong to a schedule, a set of names
__parameters_without_schedule__ = set()

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, support for pulse "
"gate calibrations has been deprecated."
),
)
def __init__(
self,
basis_gates: Optional[List[str]] = None,
Expand Down
8 changes: 8 additions & 0 deletions qiskit_experiments/calibration_management/calibrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ class Calibrations:
ScheduleBlock are supported.
"""

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, support for pulse "
"gate calibrations has been deprecated."
),
)
def __init__(
self,
coupling_map: Optional[List[List[int]]] = None,
Expand Down
6 changes: 6 additions & 0 deletions qiskit_experiments/framework/restless_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import logging
from typing import Callable, Sequence, Optional
from qiskit.qobj.utils import MeasLevel, MeasReturnType
from qiskit.utils.deprecation import deprecate_func

from qiskit.providers import Backend
from qiskit_experiments.framework import Options
Expand Down Expand Up @@ -66,6 +67,11 @@ class makes it easy to determine if restless measurements are supported for a gi
_physical_qubits: Sequence[int]
_num_qubits: int

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=("Support for restless experiments has been deprecated."),
)
def enable_restless(
self,
rep_delay: Optional[float] = None,
Expand Down
9 changes: 9 additions & 0 deletions qiskit_experiments/library/characterization/cr_hamiltonian.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from qiskit.circuit.parameterexpression import ParameterValueType
from qiskit.exceptions import QiskitError
from qiskit.providers import Backend
from qiskit.utils.deprecation import deprecate_func
from qiskit_experiments.framework import (
BaseExperiment,
BackendTiming,
Expand Down Expand Up @@ -134,6 +135,14 @@ class CRPulseGate(circuit.Gate):
def __init__(self, width: ParameterValueType):
super().__init__("cr_gate", 2, [width])

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, experiments involving pulse "
"gate calibrations like this one have been deprecated."
),
)
def __init__(
self,
physical_qubits: Tuple[int, int],
Expand Down
17 changes: 17 additions & 0 deletions qiskit_experiments/library/characterization/drag.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from qiskit.exceptions import QiskitError
from qiskit.providers.backend import Backend
from qiskit.pulse import ScheduleBlock
from qiskit.utils.deprecation import deprecate_func

from qiskit_experiments.framework import BaseExperiment, Options
from qiskit_experiments.framework.restless_mixin import RestlessMixin
Expand Down Expand Up @@ -68,6 +69,14 @@ class RoughDrag(BaseExperiment, RestlessMixin):
.. jupyter-execute::
:hide-code:
import warnings
warnings.filterwarnings(
"ignore",
message=".*Due to the deprecation of Qiskit Pulse.*",
category=DeprecationWarning,
)
# backend
from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend
backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=False, seed=101)
Expand Down Expand Up @@ -120,6 +129,14 @@ def _default_experiment_options(cls) -> Options:

return options

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, experiments involving pulse "
"gate calibrations like this one have been deprecated."
),
)
def __init__(
self,
physical_qubits: Sequence[int],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

"""Multi state discrimination experiment."""

import warnings
from typing import Dict, List, Optional, Sequence

from qiskit import QuantumCircuit
Expand Down Expand Up @@ -141,6 +142,14 @@ def circuits(self) -> List[QuantumCircuit]:
Returns:
A list of circuits preparing the different energy states.
"""
warnings.warn(
(
"Setting pulse schedules for x gates is deprecated as of "
"version 0.8 due to the deprecation of Qiskit Pulse. It will be "
"removed in a future release."
),
DeprecationWarning,
)
circuits = []
for level in range(self.experiment_options.n_states):
circuit = QuantumCircuit(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ class QubitSpectroscopy(Spectroscopy):
.. jupyter-execute::
:hide-code:
import warnings
warnings.filterwarnings(
"ignore",
message=".*Due to the deprecation of Qiskit Pulse.*",
category=DeprecationWarning,
)
# backend
from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend
backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=True, seed=199)
Expand Down
25 changes: 25 additions & 0 deletions qiskit_experiments/library/characterization/rabi.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from qiskit.providers import Backend
from qiskit.pulse import ScheduleBlock
from qiskit.exceptions import QiskitError
from qiskit.utils.deprecation import deprecate_func

from qiskit_experiments.framework import BaseExperiment, Options
from qiskit_experiments.framework.restless_mixin import RestlessMixin
Expand Down Expand Up @@ -61,6 +62,14 @@ class Rabi(BaseExperiment, RestlessMixin):
.. jupyter-execute::
:hide-code:
import warnings
warnings.filterwarnings(
"ignore",
message=".*Due to the deprecation of Qiskit Pulse.*",
category=DeprecationWarning,
)
# backend
from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend
backend = SingleTransmonTestBackend(5.2e9,-0.25e9, 1e9, 0.8e9, 1e4, noise=True, seed=199)
Expand Down Expand Up @@ -115,6 +124,14 @@ def _default_experiment_options(cls) -> Options:

return options

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, experiments involving pulse "
"gate calibrations like this one have been deprecated."
),
)
def __init__(
self,
physical_qubits: Sequence[int],
Expand Down Expand Up @@ -230,6 +247,14 @@ class EFRabi(Rabi):
.. jupyter-execute::
:hide-code:
import warnings
warnings.filterwarnings(
"ignore",
message=".*Due to the deprecation of Qiskit Pulse.*",
category=DeprecationWarning,
)
# backend
from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend
backend = SingleTransmonTestBackend(5.2e9, -0.25e9, 1e9, 0.8e9, 1e4, noise=True, seed=198)
Expand Down
9 changes: 9 additions & 0 deletions qiskit_experiments/library/characterization/spectroscopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from qiskit.exceptions import QiskitError
from qiskit.providers import Backend
from qiskit.qobj.utils import MeasLevel
from qiskit.utils.deprecation import deprecate_func

from qiskit_experiments.framework import BaseAnalysis, BaseExperiment, Options
from qiskit_experiments.curve_analysis import ResonanceAnalysis
Expand Down Expand Up @@ -60,6 +61,14 @@ def _default_run_options(cls) -> Options:

return options

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, experiments involving pulse "
"gate calibrations like this one have been deprecated."
),
)
def __init__(
self,
physical_qubits: Sequence[int],
Expand Down
9 changes: 9 additions & 0 deletions qiskit_experiments/library/driven_freq_tuning/p1_spect.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from qiskit.circuit import QuantumCircuit, Gate, Parameter, ParameterExpression
from qiskit.providers.backend import Backend
from qiskit.utils import optionals as _optional
from qiskit.utils.deprecation import deprecate_func

from qiskit_experiments.framework import BackendTiming, BaseExperiment, Options
from .p1_spect_analysis import StarkP1SpectAnalysis
Expand Down Expand Up @@ -72,6 +73,14 @@ class StarkP1Spectroscopy(BaseExperiment):
"""

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, experiments involving pulse "
"gate calibrations like this one have been deprecated."
),
)
def __init__(
self,
physical_qubits: Sequence[int],
Expand Down
9 changes: 9 additions & 0 deletions qiskit_experiments/library/driven_freq_tuning/ramsey.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from qiskit.circuit import QuantumCircuit, Gate, Parameter
from qiskit.providers.backend import Backend
from qiskit.utils import optionals as _optional
from qiskit.utils.deprecation import deprecate_func

from qiskit_experiments.framework import BaseExperiment, Options, BackendTiming
from qiskit_experiments.library.characterization.analysis import RamseyXYAnalysis
Expand Down Expand Up @@ -88,6 +89,14 @@ class StarkRamseyXY(BaseExperiment):
"""

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, experiments involving pulse "
"gate calibrations like this one have been deprecated."
),
)
def __init__(
self,
physical_qubits: Sequence[int],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from qiskit.circuit import QuantumCircuit, Gate, ParameterExpression, Parameter
from qiskit.providers.backend import Backend
from qiskit.utils import optionals as _optional
from qiskit.utils.deprecation import deprecate_func

from qiskit_experiments.framework import BaseExperiment, Options, BackendTiming
from .ramsey_amp_scan_analysis import StarkRamseyXYAmpScanAnalysis
Expand Down Expand Up @@ -93,6 +94,14 @@ class StarkRamseyXYAmpScan(BaseExperiment):
"""

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, experiments involving pulse "
"gate calibrations like this one have been deprecated."
),
)
def __init__(
self,
physical_qubits: Sequence[int],
Expand Down
Loading

0 comments on commit ee94384

Please sign in to comment.