Skip to content

Commit

Permalink
fix #727
Browse files Browse the repository at this point in the history
  • Loading branch information
nkanazawa1989 committed Apr 20, 2022
1 parent af231ec commit c4bc7af
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def _generate_circuit(
group_elt_gate = group_elt_circ
group_elt_op = Clifford(group_elt_circ)

if not isinstance(group_elt_gate, Gate):
if hasattr(group_elt_gate, "to_gate"):
group_elt_gate = group_elt_gate.to_gate()
circ_op = circ_op.compose(group_elt_op)
for circ in circs:
Expand Down
17 changes: 17 additions & 0 deletions test/randomized_benchmarking/test_randomized_benchmarking.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import numpy as np
from ddt import ddt, data, unpack
from qiskit.circuit.library import SXGate, CXGate, TGate, XGate
from qiskit.circuit import Delay
from qiskit.exceptions import QiskitError
from qiskit.providers.aer import AerSimulator
from qiskit.providers.aer.noise import NoiseModel, depolarizing_error
Expand Down Expand Up @@ -345,6 +346,22 @@ def test_non_clifford_interleaved_element(self):
lengths=lengths,
)

def test_interleaving_delay(self):
"""Test delay instruction can be interleaved."""
# See qiskit-experiments/#727 for details
interleaved_element = Delay(10, unit="us")
exp = InterleavedRB(
interleaved_element,
qubits=[0],
lengths=[1],
num_samples=1,
)
# Not raises an error
_, int_circ = exp.circuits()

# barrier, clifford, barrier, "delay", barrier, ...
self.assertEqual(int_circ.data[3][0], interleaved_element)

def test_experiment_config(self):
"""Test converting to and from config works"""
exp = rb.InterleavedRB(
Expand Down

0 comments on commit c4bc7af

Please sign in to comment.