Skip to content

Commit

Permalink
Revert too many deprecations in Estimator (Qiskit#1990)
Browse files Browse the repository at this point in the history
* Revert too much deprecation

* fix typo

* fix tests
  • Loading branch information
ikkoham authored and doichanj committed Nov 8, 2023
1 parent 5c38827 commit 5db25fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
12 changes: 3 additions & 9 deletions qiskit_aer/primitives/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
Optimize1qGatesDecomposition,
SetLayout,
)
from qiskit.utils import deprecate_arg, deprecate_func
from qiskit.utils import deprecate_func

from .. import AerError, AerSimulator

Expand Down Expand Up @@ -76,12 +76,6 @@ class Estimator(BaseEstimator):
normal distribution approximation.
"""

@deprecate_arg(
"approximation",
since=0.13,
package_name="qiskit-aer",
additional_msg="approximation=True will be default in the future.",
)
def __init__(
self,
*,
Expand Down Expand Up @@ -118,7 +112,7 @@ def __init__(
warn(
"Option approximation=False is deprecated as of qiskit-aer 0.13. "
"It will be removed no earlier than 3 months after the release date. "
"Instead, use BackendEstmator from qiskit.primitives.",
"Instead, use BackendEstimator from qiskit.primitives.",
DeprecationWarning,
stacklevel=3,
)
Expand Down Expand Up @@ -153,7 +147,7 @@ def approximation(self, approximation):
warn(
"Option approximation=False is deprecated as of qiskit-aer 0.13. "
"It will be removed no earlier than 3 months after the release date. "
"Instead, use BackendEstmator from qiskit.primitives.",
"Instead, use BackendEstimator from qiskit.primitives.",
DeprecationWarning,
stacklevel=3,
)
Expand Down
6 changes: 2 additions & 4 deletions test/terra/primitives/test_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,7 @@ def test_with_shots_option_with_approximation(self, abelian_grouping):
"""test with shots option."""
# Note: abelian_gropuing is ignored when approximation is True as documented.
# The purpose of this test is to make sure the results remain the same.
with self.assertWarns(DeprecationWarning):
est = Estimator(approximation=True, abelian_grouping=abelian_grouping)
est = Estimator(approximation=True, abelian_grouping=abelian_grouping)
result = est.run(
self.ansatz, self.observable, parameter_values=[[0, 1, 1, 2, 3, 5]], shots=1024, seed=15
).result()
Expand Down Expand Up @@ -332,8 +331,7 @@ def test_result_order(self):
qc2.ry(np.pi / 2 * param, 0)
qc2.measure_all()

with self.assertWarns(DeprecationWarning):
estimator = Estimator(approximation=True)
estimator = Estimator(approximation=True)
job = estimator.run([qc1, qc2, qc1, qc1, qc2], ["Z"] * 5, [[], [1], [], [], [1]])
result = job.result()
np.testing.assert_allclose(result.values, [1, 0, 1, 1, 0], atol=1e-10)
Expand Down

0 comments on commit 5db25fd

Please sign in to comment.