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

Add missing delay instruction to fake backends #8003

Merged
merged 7 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions qiskit/test/mock/utils/backend_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from qiskit.circuit.library.standard_gates import IGate, SXGate, XGate, CXGate, RZGate
from qiskit.circuit.parameter import Parameter
from qiskit.circuit.gate import Gate
from qiskit.circuit.delay import Delay
from qiskit.circuit.measure import Measure
from qiskit.circuit.reset import Reset
from qiskit.providers.models.pulsedefaults import PulseDefaults
Expand All @@ -43,6 +44,7 @@ def convert_to_target(conf_dict: dict, props_dict: dict = None, defs_dict: dict
if props_dict:
qubit_props = qubit_props_from_props(props_dict)
target = Target(qubit_properties=qubit_props)
target.add_instruction(Delay(Parameter("t")))
# Parse from properties if it exsits
if props_dict is not None:
# Parse instructions
Expand Down
11 changes: 11 additions & 0 deletions test/python/providers/test_fake_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from qiskit.execute_function import execute
from qiskit.test.base import QiskitTestCase
from qiskit.test.mock import FakeProviderForBackendV2, FakeProvider
from qiskit.test.mock import FakeMumbaiV2
from qiskit.utils import optionals

FAKE_PROVIDER_FOR_BACKEND_V2 = FakeProviderForBackendV2()
Expand Down Expand Up @@ -140,3 +141,13 @@ def test_defaults_to_dict(self, backend):
self.assertGreater(i, 1e6)
else:
self.skipTest("Backend %s does not have defaults" % backend)

def test_delay_circuit(self):
backend = FakeMumbaiV2()
qc = QuantumCircuit(2)
qc.delay(502, 0, unit="ns")
qc.x(1)
qc.delay(250, 1, unit="ns")
qc.measure_all()
res = transpile(qc, backend)
self.assertIn("delay", res.count_ops())