From 08156ed8ad4ac05cb2d3b507c6dc615ce9f60f5c Mon Sep 17 00:00:00 2001 From: YingHongTham Date: Fri, 26 Jul 2024 14:25:13 +0200 Subject: [PATCH] fixes #9355 deprecate visualize_transition (#12287) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added deprecation warnings and decorators to transition_visualization.py * fixed style with tox -epy310 -eblack * added release notes * added to warning category=DeprecationWarning and stacklevel=2 * Update releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml Co-authored-by: atharva-satpute <55058959+atharva-satpute@users.noreply.github.com> * Update releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml Co-authored-by: atharva-satpute <55058959+atharva-satpute@users.noreply.github.com> * Apply suggestions from code review * Fix lint complaint --------- Co-authored-by: atharva-satpute <55058959+atharva-satpute@users.noreply.github.com> Co-authored-by: Matthew Treinish Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com> (cherry picked from commit 4ec51d1a83987e022eb7323590b6d7b218ede28d) --- qiskit/visualization/transition_visualization.py | 5 +++++ .../deprecate-visualize_transition-8c1d257b7f37aa58.yaml | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml diff --git a/qiskit/visualization/transition_visualization.py b/qiskit/visualization/transition_visualization.py index a2ff74799999..0d1623831883 100644 --- a/qiskit/visualization/transition_visualization.py +++ b/qiskit/visualization/transition_visualization.py @@ -18,6 +18,7 @@ import numpy as np from qiskit.exceptions import MissingOptionalLibraryError +from qiskit.utils.deprecation import deprecate_func def _normalize(v, tolerance=0.00001): @@ -121,6 +122,10 @@ def vector_norm(self): return np.linalg.norm(v) +@deprecate_func( + since="1.2.0", + removal_timeline="in the 2.0 release", +) def visualize_transition(circuit, trace=False, saveas=None, fpg=100, spg=2): """ Creates animation showing transitions between states of a single diff --git a/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml b/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml new file mode 100644 index 000000000000..6900dcbd7676 --- /dev/null +++ b/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml @@ -0,0 +1,7 @@ +--- +deprecations_visualization: + - | + The :func:`.transition_visualization` function has been deprecated and will + be removed in the 2.0.0 release. This function had a number of limitations + which limited it's utility to only very specific use cases and didn't fit in with + the rest of the Qiskit visualization module.