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

Revert too many deprecations in Estimator #1990

Merged
merged 3 commits into from
Nov 8, 2023
Merged
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
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
Loading