Skip to content

Commit

Permalink
Add EchoRZXWeylDecomposition to Pulse deprecation (#13366)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElePT authored Oct 29, 2024
1 parent ddf93ab commit 5e39fc1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from qiskit.transpiler.exceptions import TranspilerError
from qiskit.transpiler.layout import Layout
from qiskit.transpiler.passes.calibration.rzx_builder import _check_calibration_type, CRCalType
from qiskit.utils.deprecate_pulse import deprecate_pulse_dependency

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

@deprecate_pulse_dependency
def __init__(self, instruction_schedule_map=None, target=None):
"""EchoRZXWeylDecomposition pass.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ deprecations_transpiler:
* :class:`~qiskit.transpiler.passes.ValidatePulseGates`
* :class:`~qiskit.transpiler.passes.RXCalibrationBuilder`
* :class:`~qiskit.transpiler.passes.RZXCalibrationBuilder`
* :class:`~qiskit.transpiler.passes.EchoRZXWeylDecomposition`
- |
The `inst_map` argument in :func:`~qiskit.transpiler.generate_preset_pass_manager`,
:meth:`~transpiler.target.Target.from_configuration` and :func:`~qiskit.transpiler.preset_passmanagers.common.generate_scheduling`
Expand Down
43 changes: 35 additions & 8 deletions test/python/transpiler/test_echo_rzx_weyl_decomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ def test_rzx_number_native_weyl_decomposition(self):
circuit.cx(qr[0], qr[1])

unitary_circuit = qi.Operator(circuit).data

after = EchoRZXWeylDecomposition(self.inst_map)(circuit)
with self.assertWarnsRegex(
DeprecationWarning,
expected_regex="The entire Qiskit Pulse package",
):
after = EchoRZXWeylDecomposition(self.inst_map)(circuit)

unitary_after = qi.Operator(after).data

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

dag = circuit_to_dag(circuit)
pass_ = EchoRZXWeylDecomposition(self.inst_map)
with self.assertWarnsRegex(
DeprecationWarning,
expected_regex="The entire Qiskit Pulse package",
):
pass_ = EchoRZXWeylDecomposition(self.inst_map)
after = dag_to_circuit(pass_.run(dag))

dag_non_native = circuit_to_dag(circuit_non_native)
pass_ = EchoRZXWeylDecomposition(self.inst_map)
with self.assertWarnsRegex(
DeprecationWarning,
expected_regex="The entire Qiskit Pulse package",
):
pass_ = EchoRZXWeylDecomposition(self.inst_map)
after_non_native = dag_to_circuit(pass_.run(dag_non_native))

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

dag = circuit_to_dag(circuit)
pass_ = EchoRZXWeylDecomposition(self.inst_map)
with self.assertWarnsRegex(
DeprecationWarning,
expected_regex="The entire Qiskit Pulse package",
):
pass_ = EchoRZXWeylDecomposition(self.inst_map)
after = dag_to_circuit(pass_.run(dag))

dag_non_native = circuit_to_dag(circuit_non_native)
pass_ = EchoRZXWeylDecomposition(self.inst_map)
with self.assertWarnsRegex(
DeprecationWarning,
expected_regex="The entire Qiskit Pulse package",
):
pass_ = EchoRZXWeylDecomposition(self.inst_map)
after_non_native = dag_to_circuit(pass_.run(dag_non_native))

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

dag = circuit_to_dag(circuit)
pass_ = EchoRZXWeylDecomposition(self.inst_map)
with self.assertWarnsRegex(
DeprecationWarning,
expected_regex="The entire Qiskit Pulse package",
):
pass_ = EchoRZXWeylDecomposition(self.inst_map)
after = dag_to_circuit(pass_.run(dag))
dag_after = circuit_to_dag(after)

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

dag = circuit_to_dag(circuit)
pass_ = EchoRZXWeylDecomposition(self.inst_map)
with self.assertWarnsRegex(
DeprecationWarning,
expected_regex="The entire Qiskit Pulse package",
):
pass_ = EchoRZXWeylDecomposition(self.inst_map)
after = dag_to_circuit(pass_.run(dag))

unitary_after = qi.Operator(after).data
Expand Down

0 comments on commit 5e39fc1

Please sign in to comment.