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 3 commits
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
4 changes: 4 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 Down Expand Up @@ -123,6 +124,9 @@ def convert_to_target(conf_dict: dict, props_dict: dict = None, defs_dict: dict
target[inst][(qubit,)].calibration = sched
else:
target[inst][qarg].calibration = sched
target.add_instruction(
Delay(Parameter("t")), {(bit,): None for bit in range(target.num_qubits)}
mtreinish marked this conversation as resolved.
Show resolved Hide resolved
)
return target


Expand Down
2 changes: 2 additions & 0 deletions qiskit/visualization/gate_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,8 @@ def plot_error_map(backend, figsize=(12, 9), show_title=True, qubit_coordinates=
if prop_dict is None or None in prop_dict:
continue
for qargs, inst_props in prop_dict.items():
if inst_props is None:
continue
if gate == "measure":
if inst_props.error is not None:
read_err[qargs[0]] = inst_props.error
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 @@ -146,3 +147,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())