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 noise model construction for a backend with no T2 value for a qubit #1912

Merged
merged 4 commits into from
Aug 25, 2023
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
4 changes: 3 additions & 1 deletion qiskit_aer/noise/device/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,10 @@ def _device_thermal_relaxation_error(

def _truncate_t2_value(t1, t2):
"""Return t2 value truncated to 2 * t1 (for t2 > 2 * t1)"""
if t1 is None or t2 is None:
if t1 is None:
return t2
elif t2 is None:
return 2 * t1
return min(t2, 2 * t1)


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
fixes:
- |
Fixed a bug where :meth:`~.NoiseModel.from_backend` raises an error when
a backend reports no T2 value (while it reports T1 value) for a qubit,
which was an oversight in the previous fix on None handling:
`#1818 <https://github.com/Qiskit/qiskit-aer/issues/1818>`__.
Fixed `#1896 <https://github.com/Qiskit/qiskit-aer/issues/1896>`__.
7 changes: 7 additions & 0 deletions test/terra/noise/test_device_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,10 @@ def test_basic_device_gate_errors_from_target_and_properties(self):
self.assertEqual(name1, name2)
self.assertEqual(tuple(qargs1), qargs2)
self.assertEqual(err1, err2)

def test_basic_device_gate_errors_from_target_with_no_t2_value(self):
"""Test if gate errors are successfully created from a target with qubits not reporting T2.
See https://github.com/Qiskit/qiskit-aer/issues/1896 for the details."""
target = FakeNairobiV2().target
target.qubit_properties[0].t2 = None
basic_device_gate_errors(target=target)
Loading