Skip to content

Commit 5e39fc1

Browse files
authored
Add EchoRZXWeylDecomposition to Pulse deprecation (#13366)
1 parent ddf93ab commit 5e39fc1

3 files changed

Lines changed: 38 additions & 8 deletions

File tree

qiskit/transpiler/passes/optimization/echo_rzx_weyl_decomposition.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from qiskit.transpiler.exceptions import TranspilerError
2222
from qiskit.transpiler.layout import Layout
2323
from qiskit.transpiler.passes.calibration.rzx_builder import _check_calibration_type, CRCalType
24+
from qiskit.utils.deprecate_pulse import deprecate_pulse_dependency
2425

2526
from qiskit.dagcircuit import DAGCircuit
2627
from qiskit.converters import circuit_to_dag
@@ -34,6 +35,7 @@ class EchoRZXWeylDecomposition(TransformationPass):
3435
Each pair of RZXGates forms an echoed RZXGate.
3536
"""
3637

38+
@deprecate_pulse_dependency
3739
def __init__(self, instruction_schedule_map=None, target=None):
3840
"""EchoRZXWeylDecomposition pass.
3941

releasenotes/notes/deprecate-pulse-package-07a621be1db7fa30.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ deprecations_transpiler:
4040
* :class:`~qiskit.transpiler.passes.ValidatePulseGates`
4141
* :class:`~qiskit.transpiler.passes.RXCalibrationBuilder`
4242
* :class:`~qiskit.transpiler.passes.RZXCalibrationBuilder`
43+
* :class:`~qiskit.transpiler.passes.EchoRZXWeylDecomposition`
4344
- |
4445
The `inst_map` argument in :func:`~qiskit.transpiler.generate_preset_pass_manager`,
4546
:meth:`~transpiler.target.Target.from_configuration` and :func:`~qiskit.transpiler.preset_passmanagers.common.generate_scheduling`

test/python/transpiler/test_echo_rzx_weyl_decomposition.py

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,11 @@ def test_rzx_number_native_weyl_decomposition(self):
7474
circuit.cx(qr[0], qr[1])
7575

7676
unitary_circuit = qi.Operator(circuit).data
77-
78-
after = EchoRZXWeylDecomposition(self.inst_map)(circuit)
77+
with self.assertWarnsRegex(
78+
DeprecationWarning,
79+
expected_regex="The entire Qiskit Pulse package",
80+
):
81+
after = EchoRZXWeylDecomposition(self.inst_map)(circuit)
7982

8083
unitary_after = qi.Operator(after).data
8184

@@ -97,11 +100,19 @@ def test_h_number_non_native_weyl_decomposition_1(self):
97100
circuit_non_native.rzz(theta, qr[1], qr[0])
98101

99102
dag = circuit_to_dag(circuit)
100-
pass_ = EchoRZXWeylDecomposition(self.inst_map)
103+
with self.assertWarnsRegex(
104+
DeprecationWarning,
105+
expected_regex="The entire Qiskit Pulse package",
106+
):
107+
pass_ = EchoRZXWeylDecomposition(self.inst_map)
101108
after = dag_to_circuit(pass_.run(dag))
102109

103110
dag_non_native = circuit_to_dag(circuit_non_native)
104-
pass_ = EchoRZXWeylDecomposition(self.inst_map)
111+
with self.assertWarnsRegex(
112+
DeprecationWarning,
113+
expected_regex="The entire Qiskit Pulse package",
114+
):
115+
pass_ = EchoRZXWeylDecomposition(self.inst_map)
105116
after_non_native = dag_to_circuit(pass_.run(dag_non_native))
106117

107118
circuit_rzx_number = self.count_gate_number("rzx", after)
@@ -127,11 +138,19 @@ def test_h_number_non_native_weyl_decomposition_2(self):
127138
circuit_non_native.swap(qr[1], qr[0])
128139

129140
dag = circuit_to_dag(circuit)
130-
pass_ = EchoRZXWeylDecomposition(self.inst_map)
141+
with self.assertWarnsRegex(
142+
DeprecationWarning,
143+
expected_regex="The entire Qiskit Pulse package",
144+
):
145+
pass_ = EchoRZXWeylDecomposition(self.inst_map)
131146
after = dag_to_circuit(pass_.run(dag))
132147

133148
dag_non_native = circuit_to_dag(circuit_non_native)
134-
pass_ = EchoRZXWeylDecomposition(self.inst_map)
149+
with self.assertWarnsRegex(
150+
DeprecationWarning,
151+
expected_regex="The entire Qiskit Pulse package",
152+
):
153+
pass_ = EchoRZXWeylDecomposition(self.inst_map)
135154
after_non_native = dag_to_circuit(pass_.run(dag_non_native))
136155

137156
circuit_rzx_number = self.count_gate_number("rzx", after)
@@ -166,7 +185,11 @@ def test_weyl_decomposition_gate_angles(self):
166185
unitary_circuit = qi.Operator(circuit).data
167186

168187
dag = circuit_to_dag(circuit)
169-
pass_ = EchoRZXWeylDecomposition(self.inst_map)
188+
with self.assertWarnsRegex(
189+
DeprecationWarning,
190+
expected_regex="The entire Qiskit Pulse package",
191+
):
192+
pass_ = EchoRZXWeylDecomposition(self.inst_map)
170193
after = dag_to_circuit(pass_.run(dag))
171194
dag_after = circuit_to_dag(after)
172195

@@ -221,7 +244,11 @@ def test_weyl_unitaries_random_circuit(self):
221244
unitary_circuit = qi.Operator(circuit).data
222245

223246
dag = circuit_to_dag(circuit)
224-
pass_ = EchoRZXWeylDecomposition(self.inst_map)
247+
with self.assertWarnsRegex(
248+
DeprecationWarning,
249+
expected_regex="The entire Qiskit Pulse package",
250+
):
251+
pass_ = EchoRZXWeylDecomposition(self.inst_map)
225252
after = dag_to_circuit(pass_.run(dag))
226253

227254
unitary_after = qi.Operator(after).data

0 commit comments

Comments
 (0)