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

handle T2 > 2*T1 and clarify terminology #1994

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
20 changes: 14 additions & 6 deletions qiskit_aer/noise/errors/standard_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"""

import itertools as it

import logging
import numpy as np

from qiskit.circuit import Reset
Expand All @@ -28,6 +28,8 @@
from .quantum_error import QuantumError
from ..noiseerror import NoiseError

logger = logging.getLogger(__name__)


def kraus_error(noise_ops, canonical_kraus=False):
"""
Expand Down Expand Up @@ -260,7 +262,7 @@ def thermal_relaxation_error(t1, t2, time, excited_state_population=0):

Args:
t1 (double): the :math:`T_1` relaxation time constant.
t2 (double): the :math:`T_2` relaxation time constant.
t2 (double): the :math:`T_2` coherence time constant.
time (double): the gate time for relaxation error.
excited_state_population (double): the population of :math:`|1\rangle`
state at equilibrium (default: 0).
Expand Down Expand Up @@ -294,18 +296,24 @@ def thermal_relaxation_error(t1, t2, time, excited_state_population=0):
if t1 <= 0:
raise NoiseError("Invalid T_1 relaxation time parameter: T_1 <= 0.")
if t2 <= 0:
raise NoiseError("Invalid T_2 relaxation time parameter: T_2 <= 0.")
raise NoiseError("Invalid T_2 coherence time parameter: T_2 <= 0.")
if t2 - 2 * t1 > 0:
raise NoiseError("Invalid T_2 relaxation time parameter: T_2 greater than 2 * T_1.")
logger.warning(
"Warning: T_2 value %g exceeds physical limit %g"
"given by 2 * T_1. Noise model will use the physical limit.",
t2,
2 * t1,
)
t2 = 2 * t1

# T1 relaxation rate
# T1 relaxation time
if t1 == np.inf:
rate1 = 0
p_reset = 0
else:
rate1 = 1 / t1
p_reset = 1 - np.exp(-time * rate1)
# T2 dephasing rate
# T2 coherence time
if t2 == np.inf:
rate2 = 0
exp_t2 = 1
Expand Down
10 changes: 5 additions & 5 deletions test/terra/noise/test_standard_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,11 @@ def test_thermal_relaxation_error_raises_invalid_t1(self):
with self.assertRaises(NoiseError):
thermal_relaxation_error(-0.1, 0.1, 0)

def test_thermal_relaxation_error_raises_invalid_t1_t2(self):
"""Test raises error for invalid t2 > 2 * t1 parameters"""
# T2 > 2 * T1
with self.assertRaises(NoiseError):
thermal_relaxation_error(1, 2.1, 0)
def test_thermal_relaxation_error_t2_limit(self):
"""Test T2 gets limited to 2 * T1"""
err1 = thermal_relaxation_error(1, 2.1, 1) # T2 > 2 * T1
err2 = thermal_relaxation_error(1, 2, 1) # T2 = 2 * T1
self.assertEqual(err1, err2)

def test_thermal_relaxation_error_t1_t2_inf_ideal(self):
"""Test t1 = t2 = inf returns identity channel"""
Expand Down
Loading