Repository: Qiskit/qiskit

Issue:
Remove deprecated code since 0.23 in qiskit/visualization/state_visualization.py
There is code in `qiskit/visualization/state_visualization.py` deprecated in 0.23 that needs to be removed:

 - `qiskit/visualization/state_visualization.py:1283` (`num_to_latex_ket`)
 -  `qiskit/visualization/state_visualization.py:1302` (`numbers_to_latex_terms`)

This includes:
 * Remove deprecated code and tests (if they only check the deprecation raise)
 * tag the PR as [Changelog: Removal](https://github.com/Qiskit/qiskit/labels/Changelog%3A%20Removal)
 * create a release note in the category upgrade:. If you can include an example with an alternative for user to migrate to the new code, as this change might break users code.


Discussion:
Hi @1ucian0, can you please assign this to me?

Resolving patch:
diff --git a/qiskit/visualization/state_visualization.py b/qiskit/visualization/state_visualization.py
--- a/qiskit/visualization/state_visualization.py
+++ b/qiskit/visualization/state_visualization.py
@@ -1,6 +1,6 @@
 # This code is part of Qiskit.
 #
-# (C) Copyright IBM 2017, 2018.
+# (C) Copyright IBM 2017, 2023.
 #
 # This code is licensed under the Apache License, Version 2.0. You may
 # obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -17,7 +17,7 @@
 Visualization functions for quantum states.
 """
 
-from typing import Optional, List, Union
+from typing import List, Union
 from functools import reduce
 import colorsys
 
@@ -27,7 +27,6 @@
 from qiskit.quantum_info.operators.operator import Operator
 from qiskit.quantum_info.operators.symplectic import PauliList, SparsePauliOp
 from qiskit.quantum_info.states.densitymatrix import DensityMatrix
-from qiskit.utils.deprecation import deprecate_func
 from qiskit.utils import optionals as _optionals
 from qiskit.circuit.tools.pi_check import pi_check
 
@@ -1280,50 +1279,6 @@ def state_to_latex(
     return prefix + latex_str + suffix
 
 
-@deprecate_func(
-    additional_msg="For similar functionality, see sympy's ``nsimplify`` and ``latex`` functions.",
-    since="0.23.0",
-    package_name="qiskit-terra",
-)
-def num_to_latex_ket(raw_value: complex, first_term: bool, decimals: int = 10) -> Optional[str]:
-    """Convert a complex number to latex code suitable for a ket expression
-
-    Args:
-        raw_value: Value to convert
-        first_term: If True then generate latex code for the first term in an expression
-        decimals: Number of decimal places to round to (default: 10).
-    Returns:
-        String with latex code or None if no term is required
-    """
-    if np.around(np.abs(raw_value), decimals=decimals) == 0:
-        return None
-    return _num_to_latex(raw_value, first_term=first_term, decimals=decimals, coefficient=True)
-
-
-@deprecate_func(
-    additional_msg="For similar functionality, see sympy's ``nsimplify`` and ``latex`` functions.",
-    since="0.23.0",
-    package_name="qiskit-terra",
-)
-def numbers_to_latex_terms(numbers: List[complex], decimals: int = 10) -> List[str]:
-    """Convert a list of numbers to latex formatted terms
-    The first non-zero term is treated differently. For this term a leading + is suppressed.
-    Args:
-        numbers: List of numbers to format
-        decimals: Number of decimal places to round to (default: 10).
-    Returns:
-        List of formatted terms
-    """
-    first_term = True
-    terms = []
-    for number in numbers:
-        term = num_to_latex_ket(number, first_term, decimals)
-        if term is not None:
-            first_term = False
-        terms.append(term)
-    return terms
-
-
 def _numbers_to_latex_terms(numbers: List[complex], decimals: int = 10) -> List[str]:
     """Convert a list of numbers to latex formatted terms
 


Test patch:
diff --git a/test/python/quantum_info/states/test_statevector.py b/test/python/quantum_info/states/test_statevector.py
--- a/test/python/quantum_info/states/test_statevector.py
+++ b/test/python/quantum_info/states/test_statevector.py
@@ -33,7 +33,7 @@
 from qiskit.quantum_info.operators.operator import Operator
 from qiskit.quantum_info.operators.symplectic import Pauli, SparsePauliOp
 from qiskit.quantum_info.operators.predicates import matrix_equal
-from qiskit.visualization.state_visualization import numbers_to_latex_terms, state_to_latex
+from qiskit.visualization.state_visualization import state_to_latex
 
 logger = logging.getLogger(__name__)
 
@@ -1320,28 +1320,6 @@ def test_state_to_latex_with_decimals_round(self):
             "0.354 |000\\rangle+0.354 |001\\rangle- 0.354 i |110\\rangle+0.354 i |111\\rangle",
         )
 
-    def test_number_to_latex_terms(self):
-        """Test conversions of complex numbers to latex terms"""
-
-        cases = [
-            ([1 - 8e-17, 0], ["", None]),
-            ([0, -1], [None, "-"]),
-            ([0, 1], [None, ""]),
-            ([0, 1j], [None, "i"]),
-            ([-1, 1], ["-", "+"]),
-            ([0, 1j], [None, "i"]),
-            ([-1, 1j], ["-", "+i"]),
-            ([1e-16 + 1j], ["i"]),
-            ([-1 + 1e-16 * 1j], ["-"]),
-            ([-1, -1 - 1j], ["-", "+(-1 - i)"]),
-            ([np.sqrt(2) / 2, np.sqrt(2) / 2], ["\\frac{\\sqrt{2}}{2}", "+\\frac{\\sqrt{2}}{2}"]),
-            ([1 + np.sqrt(2)], ["(1 + \\sqrt{2})"]),
-        ]
-        with self.assertWarns(DeprecationWarning):
-            for numbers, latex_terms in cases:
-                terms = numbers_to_latex_terms(numbers, 15)
-                self.assertListEqual(terms, latex_terms)
-
     def test_statevector_draw_latex_regression(self):
         """Test numerical rounding errors are not printed"""
         sv = Statevector(np.array([1 - 8e-17, 8.32667268e-17j]))