Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed the deprecated code since 0.23 #11167

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion qiskit/visualization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
from .pass_manager_visualization import pass_manager_drawer
from .pass_manager_visualization import staged_pass_manager_drawer

from .pulse.interpolation import step_wise, linear, cubic_spline
from .pulse.interpolation import linear, cubic_spline
from .pulse.qcstyle import PulseStyle, SchedStyle
from .pulse_v2 import draw as pulse_drawer

Expand Down
73 changes: 1 addition & 72 deletions qiskit/visualization/pulse/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,78 +20,7 @@
from __future__ import annotations
from functools import partial

import numpy as np

from qiskit.utils.deprecation import deprecate_func


@deprecate_func(
additional_msg=(
"Instead, use the new interface in ``qiskit.visualization.pulse_drawer`` for "
"pulse visualization."
),
since="0.23.0",
removal_timeline="no earlier than 6 months after the release date",
)
def interp1d(
time: np.ndarray, samples: np.ndarray, nop: int, kind: str = "linear"
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
"""Deprecated.

Scipy interpolation wrapper.

Args:
time: Time vector with length of ``samples`` + 1.
samples: Complex pulse envelope.
nop: Number of data points for interpolation.
kind: Scipy interpolation type.
See ``scipy.interpolate.interp1d`` documentation for more information.
Returns:
Interpolated time vector and real and imaginary part of waveform.
"""
from scipy import interpolate

re_y = np.real(samples)
im_y = np.imag(samples)

dt = time[1] - time[0]

time += 0.5 * dt
cs_ry = interpolate.interp1d(time[:-1], re_y, kind=kind, bounds_error=False)
cs_iy = interpolate.interp1d(time[:-1], im_y, kind=kind, bounds_error=False)

time_ = np.linspace(time[0], time[-1] * dt, nop)

return time_, cs_ry(time_), cs_iy(time_)


@deprecate_func(
additional_msg=(
"Instead, use the new interface in ``qiskit.visualization.pulse_drawer`` for "
"pulse visualization."
),
since="0.23.0",
removal_timeline="no earlier than 6 months after the release date",
)
def step_wise(
time: np.ndarray, samples: np.ndarray, nop: int
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
# pylint: disable=unused-argument
"""Deprecated.

Keep uniform variation between sample values. No interpolation is applied.
Args:
time: Time vector with length of ``samples`` + 1.
samples: Complex pulse envelope.
nop: This argument is not used.
Returns:
Time vector and real and imaginary part of waveform.
"""
samples_ = np.repeat(samples, 2)
re_y_ = np.real(samples_)
im_y_ = np.imag(samples_)
time__: np.ndarray = np.concatenate(([time[0]], np.repeat(time[1:-1], 2), [time[-1]]))
return time__, re_y_, im_y_
from scipy.interpolate import interp1d


linear = partial(interp1d, kind="linear")
Expand Down
4 changes: 0 additions & 4 deletions qiskit/visualization/pulse/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

from qiskit.utils import optionals as _optionals
from qiskit.visualization.pulse.qcstyle import PulseStyle, SchedStyle
from qiskit.visualization.pulse.interpolation import step_wise
from qiskit.pulse.channels import (
DriveChannel,
ControlChannel,
Expand Down Expand Up @@ -335,8 +334,6 @@ def draw(
# revert back to their default rcParam keys.
figure = plt.figure(dpi=self.style.dpi, figsize=self.style.figsize)

interp_method = interp_method or step_wise

ax = figure.add_subplot(111)
ax.set_facecolor(self.style.bg_color)

Expand Down Expand Up @@ -932,7 +929,6 @@ def draw(

if channels is None:
channels = []
interp_method = interp_method or step_wise

if channel_scales is None:
channel_scales = {}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
deprecations:
- |
The following functions are deprecated and will be removed in the future release this includes:
* :func:`~qiskit.visualization.pulse.interpolation.interp1d`
* :func:`~qiskit.visualization.pulse.interpolation.step_wise`
Instead, use the new interface in `qiskit.visualization.pulse_drawer` for pulse visualization.
fixes:
- |
Issue #11145 `Remove deprecated code since 0.23`