From 84ddd92d90a7e5d8c19ef3445c381a3de4653433 Mon Sep 17 00:00:00 2001 From: yinghong Date: Sat, 20 Apr 2024 22:09:44 +0200 Subject: [PATCH 1/8] added deprecation warnings and decorators to transition_visualization.py --- qiskit/visualization/transition_visualization.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qiskit/visualization/transition_visualization.py b/qiskit/visualization/transition_visualization.py index f322be64a4f5..e3242cc669aa 100644 --- a/qiskit/visualization/transition_visualization.py +++ b/qiskit/visualization/transition_visualization.py @@ -10,6 +10,11 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. +import warnings +from qiskit.utils.deprecation import deprecate_func +warnings.warn("qiskit.visualization.transition_visualization module is \ +deprecated since 1.1.1") + """ Visualization function for animation of state transitions by applying gates to single qubit. """ @@ -120,7 +125,7 @@ def vector_norm(self): _, v = self.get_axisangle() return np.linalg.norm(v) - +@deprecate_func(since="1.1.1", additional_msg="Plan to move to QuSTaR/kaleidoscope") def visualize_transition(circuit, trace=False, saveas=None, fpg=100, spg=2): """ Creates animation showing transitions between states of a single From e597cfba0ede44dd9b940af70f37f60cf2792122 Mon Sep 17 00:00:00 2001 From: yinghong Date: Sat, 20 Apr 2024 22:21:03 +0200 Subject: [PATCH 2/8] fixed style with tox -epy310 -eblack --- qiskit/visualization/transition_visualization.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qiskit/visualization/transition_visualization.py b/qiskit/visualization/transition_visualization.py index e3242cc669aa..74fcbffcd8fc 100644 --- a/qiskit/visualization/transition_visualization.py +++ b/qiskit/visualization/transition_visualization.py @@ -12,8 +12,11 @@ import warnings from qiskit.utils.deprecation import deprecate_func -warnings.warn("qiskit.visualization.transition_visualization module is \ -deprecated since 1.1.1") + +warnings.warn( + "qiskit.visualization.transition_visualization module is \ +deprecated since 1.1.1" +) """ Visualization function for animation of state transitions by applying gates to single qubit. @@ -125,6 +128,7 @@ def vector_norm(self): _, v = self.get_axisangle() return np.linalg.norm(v) + @deprecate_func(since="1.1.1", additional_msg="Plan to move to QuSTaR/kaleidoscope") def visualize_transition(circuit, trace=False, saveas=None, fpg=100, spg=2): """ From 2353630c3335e727a20ae54a19639e452322d345 Mon Sep 17 00:00:00 2001 From: yinghong Date: Sun, 21 Apr 2024 01:07:06 +0200 Subject: [PATCH 3/8] added release notes --- .../deprecate-visualize_transition-8c1d257b7f37aa58.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml diff --git a/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml b/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml new file mode 100644 index 000000000000..7bb47fd152e9 --- /dev/null +++ b/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml @@ -0,0 +1,6 @@ +--- +deprecations_visualization: + - | + The ``qiskit.visualization.transition_visualization'' module has been deprecated + and will be removed in a future release. Refer to + `#9355 ` for more details. From 12de1c194623f9f46241355376920ae6f7bd2692 Mon Sep 17 00:00:00 2001 From: yinghong Date: Sun, 21 Apr 2024 19:51:03 +0200 Subject: [PATCH 4/8] added to warning category=DeprecationWarning and stacklevel=2 --- qiskit/visualization/transition_visualization.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qiskit/visualization/transition_visualization.py b/qiskit/visualization/transition_visualization.py index 74fcbffcd8fc..7c6edab706a4 100644 --- a/qiskit/visualization/transition_visualization.py +++ b/qiskit/visualization/transition_visualization.py @@ -14,8 +14,10 @@ from qiskit.utils.deprecation import deprecate_func warnings.warn( - "qiskit.visualization.transition_visualization module is \ -deprecated since 1.1.1" + "qiskit.visualization.transition_visualization module is " + "deprecated since 1.1.1", + category=DeprecationWarning, + stacklevel=2 ) """ From 42c54504dea9a034f0458986559f21999371befa Mon Sep 17 00:00:00 2001 From: YingHongTham Date: Sun, 19 May 2024 23:56:26 +0200 Subject: [PATCH 5/8] Update releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml Co-authored-by: atharva-satpute <55058959+atharva-satpute@users.noreply.github.com> --- .../notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml b/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml index 7bb47fd152e9..70ce6d1959c7 100644 --- a/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml +++ b/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml @@ -1,6 +1,6 @@ --- deprecations_visualization: - | - The ``qiskit.visualization.transition_visualization'' module has been deprecated + The ``qiskit.visualization.transition_visualization`` module has been deprecated and will be removed in a future release. Refer to `#9355 ` for more details. From 9cb7da0381703ce9db08e4840d6683c473f4b00b Mon Sep 17 00:00:00 2001 From: YingHongTham Date: Sun, 19 May 2024 23:56:43 +0200 Subject: [PATCH 6/8] Update releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml Co-authored-by: atharva-satpute <55058959+atharva-satpute@users.noreply.github.com> --- .../notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml b/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml index 70ce6d1959c7..47688625dd37 100644 --- a/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml +++ b/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml @@ -3,4 +3,4 @@ deprecations_visualization: - | The ``qiskit.visualization.transition_visualization`` module has been deprecated and will be removed in a future release. Refer to - `#9355 ` for more details. + `#9355 `__ for more details. From 142c8efd679335a8e67a5dffc1ca4237f6ad2a8d Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 25 Jul 2024 09:53:19 -0400 Subject: [PATCH 7/8] Apply suggestions from code review --- qiskit/visualization/transition_visualization.py | 12 ++++-------- ...recate-visualize_transition-8c1d257b7f37aa58.yaml | 7 ++++--- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/qiskit/visualization/transition_visualization.py b/qiskit/visualization/transition_visualization.py index 939fe9de9a35..828520658195 100644 --- a/qiskit/visualization/transition_visualization.py +++ b/qiskit/visualization/transition_visualization.py @@ -10,15 +10,8 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -import warnings from qiskit.utils.deprecation import deprecate_func -warnings.warn( - "qiskit.visualization.transition_visualization module is " - "deprecated since 1.1.1", - category=DeprecationWarning, - stacklevel=2 -) """ Visualization function for animation of state transitions by applying gates to single qubit. @@ -131,7 +124,10 @@ def vector_norm(self): return np.linalg.norm(v) -@deprecate_func(since="1.1.1", additional_msg="Plan to move to QuSTaR/kaleidoscope") +@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 index 47688625dd37..6900dcbd7676 100644 --- a/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml +++ b/releasenotes/notes/deprecate-visualize_transition-8c1d257b7f37aa58.yaml @@ -1,6 +1,7 @@ --- deprecations_visualization: - | - The ``qiskit.visualization.transition_visualization`` module has been deprecated - and will be removed in a future release. Refer to - `#9355 `__ for more details. + 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. From bd1161c8468cce311715a4ac435680d69c9ab896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elena=20Pe=C3=B1a=20Tapia?= <57907331+ElePT@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:59:55 +0200 Subject: [PATCH 8/8] Fix lint complaint --- qiskit/visualization/transition_visualization.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/qiskit/visualization/transition_visualization.py b/qiskit/visualization/transition_visualization.py index 828520658195..0d1623831883 100644 --- a/qiskit/visualization/transition_visualization.py +++ b/qiskit/visualization/transition_visualization.py @@ -10,9 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -from qiskit.utils.deprecation import deprecate_func - - """ Visualization function for animation of state transitions by applying gates to single qubit. """ @@ -21,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):