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

Fix fake backend v2 dtm unit (backport #8019) #8022

Merged
merged 1 commit into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 6 additions & 1 deletion qiskit/test/mock/fake_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,12 @@ def dtm(self) -> float:
Returns:
dtm: The output signal timestep in seconds.
"""
return self._conf_dict.get("dtm")
dtm = self._conf_dict.get("dtm")
if dtm is not None:
# converting `dtm` in nanoseconds in configuration file to seconds
return dtm * 1e-9
else:
return None

@property
def meas_map(self) -> List[List[int]]:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
fixes:
|
Fixed an issue with :class:`~.BackendV2` based fake backend classes from the
``qiskit.providers.fake_provider`` module such as ``FakeMontrealV2`` where the
value for the :attr:`~.BackendV2.dtm` attribute were not properly being
converted to seconds. This would cause issues when using these fake backends
with scheduling.
5 changes: 5 additions & 0 deletions test/python/providers/test_fake_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ def test_convert_to_target(self, backend):
if target.dt is not None:
self.assertLess(target.dt, 1e-6)

@data(*FAKE_PROVIDER_FOR_BACKEND_V2.backends())
def test_backend_v2_dtm(self, backend):
if backend.dtm:
self.assertLess(backend.dtm, 1e-6)

@data(*FAKE_PROVIDER.backends())
def test_to_dict_configuration(self, backend):
configuration = backend.configuration()
Expand Down