Skip to content

Commit

Permalink
Removed support for all noise_amplifier options other than LocalFoldi…
Browse files Browse the repository at this point in the history
…ngAmplifier. Removed deprecation warning.
  • Loading branch information
merav-aharoni committed Sep 19, 2023
1 parent 73e9949 commit 79ddbfc
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions qiskit_ibm_runtime/options/resilience_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@
from dataclasses import dataclass

from .utils import _flexible
from ..utils.deprecation import issue_deprecation_msg

ResilienceSupportedOptions = Literal[
"noise_amplifier",
"noise_factors",
"extrapolator",
]
NoiseAmplifierType = Literal[
"TwoQubitAmplifier",
"GlobalFoldingAmplifier",
"LocalFoldingAmplifier",
"CxAmplifier",
]
ExtrapolatorType = Literal[
"LinearExtrapolator",
Expand All @@ -48,10 +44,9 @@ class ResilienceOptions:
Only applicable for ``resilience_level=2``.
Default: ``None``, and (1, 3, 5) if resilience level is 2.
noise_amplifier (DEPRECATED): A noise amplification strategy. One of ``"TwoQubitAmplifier"``,
``"GlobalFoldingAmplifier"``, ``"LocalFoldingAmplifier"``, ``"CxAmplifier"``.
Only applicable for ``resilience_level=2``.
Default: "TwoQubitAmplifier".
noise_amplifier (DEPRECATED): A noise amplification strategy. Currently only
``"LocalFoldingAmplifier"`` is supported Only applicable for ``resilience_level=2``.
Default: "LocalFoldingAmplifier".
extrapolator: An extrapolation strategy. One of ``"LinearExtrapolator"``,
``"QuadraticExtrapolator"``, ``"CubicExtrapolator"``, ``"QuarticExtrapolator"``.
Expand All @@ -75,21 +70,10 @@ def validate_resilience_options(resilience_options: dict) -> None:
ValueError: if extrapolator == "QuarticExtrapolator" and number of noise_factors < 5.
ValueError: if extrapolator == "CubicExtrapolator" and number of noise_factors < 4.
"""
if resilience_options.get("noise_amplifier", None) is not None:
issue_deprecation_msg(
msg="The 'noise_amplifier' resilience option is deprecated",
version="0.12.0",
period="1 month",
remedy="After the deprecation period, only local folding amplification "
"will be supported. "
"Refer to https://github.com/qiskit-community/prototype-zne "
"for global folding amplification in ZNE.",
)

for opt in resilience_options:
if not opt in get_args(ResilienceSupportedOptions):
raise ValueError(f"Unsupported value '{opt}' for resilience.")
noise_amplifier = resilience_options.get("noise_amplifier") or "TwoQubitAmplifier"
noise_amplifier = resilience_options.get("noise_amplifier") or "LocalFoldingAmplifier"
if noise_amplifier not in get_args(NoiseAmplifierType):
raise ValueError(
f"Unsupported value {noise_amplifier} for noise_amplifier. "
Expand Down

0 comments on commit 79ddbfc

Please sign in to comment.