Skip to content

Commit

Permalink
Add deprecations for analysis classes
Browse files Browse the repository at this point in the history
Also, add deprecation notes to the relevant manuals and tutorials and
deprecation warnings to the relevant methods of BackendData and
Backendtiming.
  • Loading branch information
wshanks committed Oct 24, 2024
1 parent ee94384 commit 7e50aa3
Show file tree
Hide file tree
Showing 12 changed files with 215 additions and 3 deletions.
8 changes: 8 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
5 changes: 5 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
8 changes: 8 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
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 @@ -50,6 +51,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 @@ -64,6 +73,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 @@ -78,6 +95,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 @@ -92,6 +117,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 @@ -119,6 +152,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 @@ -131,6 +173,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 @@ -143,6 +194,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 @@ -209,6 +269,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 @@ -220,6 +289,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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from typing import List, Dict
import numpy as np

from qiskit.utils.deprecation import deprecate_func

import qiskit_experiments.curve_analysis as curve
from qiskit_experiments.framework import AnalysisResultData
from qiskit_experiments.visualization import PlotStyle
Expand Down Expand Up @@ -44,6 +46,14 @@ class CrossResonanceHamiltonianAnalysis(curve.CompositeCurveAnalysis):
"""

@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):
analyses = []
for control_state in (0, 1):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
"""DRAG pulse calibration experiment."""

import warnings
from typing import List, Union
from typing import List, Optional, Union

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 ExperimentData
from qiskit_experiments.exceptions import AnalysisError
Expand Down Expand Up @@ -253,3 +255,33 @@ def _initialize(
self._options.data_subfit_map = data_subfit_map

super()._initialize(experiment_data)

@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,
models: Optional[List[lmfit.Model]] = None,
name: Optional[str] = None,
):
"""Initialize data fields that are privately accessed by methods.
Args:
models: List of LMFIT ``Model`` class to define fitting functions and
parameters. If multiple models are provided, the analysis performs
multi-objective optimization where the parameters with the same name
are shared among provided models. When multiple models are provided,
user must specify the ``data_subfit_map`` value in the analysis options
to allocate experimental results to a particular fit model.
name: Optional. Name of this analysis.
"""
super().__init__()

self._models = models or []
self._name = name or self.__class__.__name__
self._plot_config_cache = {}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@

"""Spectroscopy analysis class for resonators."""

from typing import List, Tuple
from typing import List, Optional, Tuple
import numpy as np

from qiskit.utils.deprecation import deprecate_func

import qiskit_experiments.curve_analysis as curve
from qiskit_experiments.framework import AnalysisResultData, ExperimentData
from qiskit_experiments.framework.matplotlib import get_non_gui_ax
Expand All @@ -25,6 +27,20 @@
class ResonatorSpectroscopyAnalysis(curve.ResonanceAnalysis):
"""Class to analysis resonator spectroscopy."""

@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,
):
super().__init__(name=name)

@classmethod
def _default_options(cls):
"""Return default analysis options.
Expand Down
18 changes: 18 additions & 0 deletions qiskit_experiments/library/driven_freq_tuning/p1_spect_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import numpy as np
from uncertainties import unumpy as unp

from qiskit.utils.deprecation import deprecate_func

import qiskit_experiments.data_processing as dp
import qiskit_experiments.visualization as vis
from qiskit_experiments.data_processing.exceptions import DataProcessorError
Expand Down Expand Up @@ -48,6 +50,22 @@ class StarkP1SpectAnalysis(BaseAnalysis):
"""

@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):
"""Initialize the analysis object."""
# Analysis options
self._options = self._default_options()

# Store keys of non-default options
self._set_options = set()

@property
def plotter(self) -> vis.CurvePlotter:
"""Curve plotter instance."""
Expand Down
Loading

0 comments on commit 7e50aa3

Please sign in to comment.