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. Some additional helper code (like the experiments analysis
classes and methods of `BackendTiming` and `BackendData`) are also
deprecated.

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 25, 2024
1 parent bd05f2a commit 52256d3
Show file tree
Hide file tree
Showing 28 changed files with 494 additions and 11 deletions.
16 changes: 16 additions & 0 deletions docs/manuals/characterization/stark_experiment.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
AC Stark Effect
===============

.. caution::

The experiments described in this manual are deprecated as of Qiskit
Experiments 0.8 and will be removed in a future release. They rely on Qiskit
Pulse, which is `deprecated in Qiskit SDK
<https://github.com/Qiskit/qiskit/issues/13063>`_, with planned removal in
Qiskit 2.0.

When a qubit is driven with an off-resonant tone,
the qubit frequency :math:`f_0` is slightly shifted through what is known as the (AC) Stark effect.
This technique is sometimes used to characterize qubit properties in the vicinity of
Expand Down Expand Up @@ -145,6 +153,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
13 changes: 13 additions & 0 deletions docs/manuals/measurement/restless_measurements.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Restless Measurements
=====================

.. caution::

Support for restless measurements is deprecated as of Qiskit Experiments 0.8
and will be removed in a future version.

When running circuits, the qubits are typically reset to the ground state after
each measurement to ensure that the next circuit has a well-defined initial state.
This can be done passively by waiting several :math:`T_1`-times so that qubits in
Expand Down Expand Up @@ -65,6 +70,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
19 changes: 19 additions & 0 deletions docs/tutorials/calibrations.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Calibrations: Schedules and gate parameters from experiments
============================================================

.. caution::

Support for calibrating pulses is deprecated as of Qiskit Experiments 0.8
and will be removed in a future version. There is no alternative support
path because Qiskit Pulse is `deprecated in Qiskit SDK
<https://github.com/Qiskit/qiskit/issues/13063>`_ with planned removal in
Qiskit 2.0.

To produce high fidelity quantum operations, we want to be able to run good gates. The
calibration module in Qiskit Experiments allows users to run experiments to find the
pulse shapes and parameter values that maximize the fidelity of the resulting quantum
Expand Down Expand Up @@ -33,6 +41,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
10 changes: 10 additions & 0 deletions qiskit_experiments/curve_analysis/standard_analysis/resonance.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import lmfit
import numpy as np

from qiskit.utils.deprecation import deprecate_func

import qiskit_experiments.curve_analysis as curve
from qiskit_experiments.framework import Options

Expand Down Expand Up @@ -59,6 +61,14 @@ class ResonanceAnalysis(curve.CurveAnalysis):
"""

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, experiments and related classses "
"involving pulse gate calibrations like this one have been deprecated."
),
)
def __init__(
self,
name: Optional[str] = None,
Expand Down
78 changes: 78 additions & 0 deletions qiskit_experiments/framework/backend_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class unifies data access for various data fields.
import warnings
from qiskit.providers.models import PulseBackendConfiguration # pylint: disable=no-name-in-module
from qiskit.providers import BackendV1, BackendV2
from qiskit.utils.deprecation import deprecate_func


class BackendData:
Expand Down Expand Up @@ -53,6 +54,14 @@ def name(self):
return self._backend.name
return str(self._backend)

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, utility functions involving "
"pulse like this one have been deprecated."
),
)
def control_channel(self, qubits):
"""Returns the backend control channel for the given qubits"""
try:
Expand All @@ -67,6 +76,14 @@ def control_channel(self, qubits):
return []
return []

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, utility functions involving "
"pulse like this one have been deprecated."
),
)
def drive_channel(self, qubit):
"""Returns the backend drive channel for the given qubit"""
try:
Expand All @@ -81,6 +98,14 @@ def drive_channel(self, qubit):
return None
return None

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, utility functions involving "
"pulse like this one have been deprecated."
),
)
def measure_channel(self, qubit):
"""Returns the backend measure channel for the given qubit"""
try:
Expand All @@ -95,6 +120,14 @@ def measure_channel(self, qubit):
return None
return None

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, utility functions involving "
"pulse like this one have been deprecated."
),
)
def acquire_channel(self, qubit):
"""Returns the backend acquire channel for the given qubit"""
try:
Expand Down Expand Up @@ -122,6 +155,15 @@ def granularity(self):
return 1

@property
@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
is_property=True,
additional_msg=(
"Due to the deprecation of Qiskit Pulse, utility functions involving "
"pulse like this one have been deprecated."
),
)
def min_length(self):
"""Returns the backend's time constraint minimum duration"""
try:
Expand All @@ -134,6 +176,15 @@ def min_length(self):
return 0

@property
@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
is_property=True,
additional_msg=(
"Due to the deprecation of Qiskit Pulse, utility functions involving "
"pulse like this one have been deprecated."
),
)
def pulse_alignment(self):
"""Returns the backend's time constraint pulse alignment"""
try:
Expand All @@ -146,6 +197,15 @@ def pulse_alignment(self):
return 1

@property
@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
is_property=True,
additional_msg=(
"Due to the deprecation of Qiskit Pulse, utility functions involving "
"pulse like this one have been deprecated."
),
)
def acquire_alignment(self):
"""Returns the backend's time constraint acquire alignment"""
try:
Expand Down Expand Up @@ -212,6 +272,15 @@ def provider(self):
return None

@property
@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
is_property=True,
additional_msg=(
"Due to the deprecation of Qiskit Pulse, utility functions involving "
"pulse like this one have been deprecated."
),
)
def drive_freqs(self):
"""Returns the backend's qubit drive frequencies"""
if self._v1:
Expand All @@ -223,6 +292,15 @@ def drive_freqs(self):
return []

@property
@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
is_property=True,
additional_msg=(
"Due to the deprecation of Qiskit Pulse, utility functions involving "
"pulse like this one have been deprecated."
),
)
def meas_freqs(self):
"""Returns the backend's measurement stimulus frequencies.
Expand Down
17 changes: 17 additions & 0 deletions qiskit_experiments/framework/backend_timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from qiskit import QiskitError
from qiskit.providers.backend import Backend
from qiskit.utils.deprecation import deprecate_func

from qiskit_experiments.framework import BackendData

Expand Down Expand Up @@ -283,6 +284,14 @@ def round_delay(

return samples_out

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, utility functions involving "
"pulse like this one have been deprecated."
),
)
def round_pulse(
self, *, time: Optional[float] = None, samples: Optional[Union[int, float]] = None
) -> int:
Expand Down Expand Up @@ -363,6 +372,14 @@ def delay_time(

return self.dt * self.round_delay(time=time, samples=samples)

@deprecate_func(
since="0.8",
package_name="qiskit-experiments",
additional_msg=(
"Due to the deprecation of Qiskit Pulse, utility functions involving "
"pulse like this one have been deprecated."
),
)
def pulse_time(
self, *, time: Optional[float] = None, samples: Optional[Union[int, float]] = None
) -> float:
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
Loading

0 comments on commit 52256d3

Please sign in to comment.