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 hyperfine dephasing rate to NoiseModel #680

Merged
merged 3 commits into from
Apr 25, 2024
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
12 changes: 9 additions & 3 deletions pulser-core/pulser/backend/noise_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class NoiseModel:
characterized experimentally by the T1 time.
- "dephasing": Random phase (Z) flip (parametrized
by `dephasing_rate`), commonly characterized experimentally
by the T2 time.
by the T2* time.
- "depolarizing": Quantum noise where the state is
turned into a mixed state I/2 with rate `depolarizing_rate`.
While it does not describe a physical phenomenon, it is a
Expand Down Expand Up @@ -81,8 +81,12 @@ class NoiseModel:
deviation of a normal distribution centered in 1.
relaxation_rate: The rate of relaxation from the Rydberg to the
ground state (in 1/µs). Corresponds to 1/T1.
dephasing_rate: The rate of a dephasing error occuring (in 1/µs).
Corresponds to 1/T2.
dephasing_rate: The rate of a dephasing occuring (in 1/µs) in a
Rydberg state superpostion. Only used if a Rydberg state is
involved. Corresponds to 1/T2*.
hyperfine_dephasing_rate: The rate of dephasing occuring (in 1/µs)
between hyperfine ground states. Only used if the hyperfine
state is involved.
depolarizing_rate: The rate (in 1/µs) at which a depolarizing
error occurs.
eff_noise_rates: The rate associated to each effective noise operator
Expand All @@ -101,13 +105,15 @@ class NoiseModel:
amp_sigma: float = 5e-2
relaxation_rate: float = 0.01
dephasing_rate: float = 0.05
hyperfine_dephasing_rate: float = 1e-3
depolarizing_rate: float = 0.05
eff_noise_rates: list[float] = field(default_factory=list)
eff_noise_opers: list[np.ndarray] = field(default_factory=list)

def __post_init__(self) -> None:
positive = {
"dephasing_rate",
"hyperfine_dephasing_rate",
"relaxation_rate",
"depolarizing_rate",
}
Expand Down
8 changes: 6 additions & 2 deletions pulser-simulation/pulser_simulation/hamiltonian.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,12 @@ def basis_check(noise_type: str) -> None:
local_collapse_ops = []
if "dephasing" in config.noise_types:
basis_check("dephasing")
coeff = np.sqrt(config.dephasing_rate / 2)
local_collapse_ops.append(coeff * qutip.sigmaz())
rate = (
config.hyperfine_dephasing_rate
if self.basis_name == "digital"
HGSilveri marked this conversation as resolved.
Show resolved Hide resolved
else config.dephasing_rate
)
local_collapse_ops.append(np.sqrt(rate / 2) * qutip.sigmaz())

if "relaxation" in config.noise_types:
coeff = np.sqrt(config.relaxation_rate)
Expand Down
8 changes: 7 additions & 1 deletion pulser-simulation/pulser_simulation/simconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class SimConfig:
epsilon_prime: float = 0.05
relaxation_rate: float = 0.01
dephasing_rate: float = 0.05
hyperfine_dephasing_rate: float = 1e-3
depolarizing_rate: float = 0.05
eff_noise_rates: list[float] = field(default_factory=list, repr=False)
eff_noise_opers: list[qutip.Qobj] = field(default_factory=list, repr=False)
Expand All @@ -129,6 +130,7 @@ def from_noise_model(cls: Type[T], noise_model: NoiseModel) -> T:
epsilon=noise_model.p_false_pos,
epsilon_prime=noise_model.p_false_neg,
dephasing_rate=noise_model.dephasing_rate,
hyperfine_dephasing_rate=noise_model.hyperfine_dephasing_rate,
relaxation_rate=noise_model.relaxation_rate,
depolarizing_rate=noise_model.depolarizing_rate,
eff_noise_rates=noise_model.eff_noise_rates,
Expand All @@ -148,6 +150,7 @@ def to_noise_model(self) -> NoiseModel:
laser_waist=self.laser_waist,
amp_sigma=self.amp_sigma,
dephasing_rate=self.dephasing_rate,
hyperfine_dephasing_rate=self.hyperfine_dephasing_rate,
relaxation_rate=self.relaxation_rate,
depolarizing_rate=self.depolarizing_rate,
eff_noise_rates=self.eff_noise_rates,
Expand Down Expand Up @@ -214,7 +217,10 @@ def __str__(self, solver_options: bool = False) -> str:
if "relaxation" in self.noise:
lines.append(f"Relaxation rate: {self.relaxation_rate}")
if "dephasing" in self.noise:
lines.append(f"Dephasing rate: {self.dephasing_rate}")
lines.append(
f"Dephasing rate: {self.dephasing_rate} (Rydberg), "
f"{self.hyperfine_dephasing_rate} (Hyperfine)"
)
if "depolarizing" in self.noise:
lines.append(f"Depolarizing rate: {self.depolarizing_rate}")
if solver_options:
Expand Down
3 changes: 3 additions & 0 deletions pulser-simulation/pulser_simulation/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ def add_config(self, config: SimConfig) -> None:
param_dict["amp_sigma"] = noise_model.amp_sigma
if "dephasing" in diff_noise_set:
param_dict["dephasing_rate"] = noise_model.dephasing_rate
param_dict["hyperfine_dephasing_rate"] = (
noise_model.hyperfine_dephasing_rate
)
if "relaxation" in diff_noise_set:
param_dict["relaxation_rate"] = noise_model.relaxation_rate
if "depolarizing" in diff_noise_set:
Expand Down
8 changes: 2 additions & 6 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def test_init_strict_pos(self, param):
"param",
[
"dephasing_rate",
"hyperfine_dephasing_rate",
"relaxation_rate",
"depolarizing_rate",
],
Expand All @@ -124,12 +125,7 @@ def test_init_rate_like(self, param, value):
NoiseModel(**{param: value})
else:
noise_model = NoiseModel(**{param: value})
if "depolarizing" in param:
assert noise_model.depolarizing_rate == value
elif "dephasing" in param:
assert noise_model.dephasing_rate == value
elif "relaxation" in param:
assert noise_model.relaxation_rate == value
assert getattr(noise_model, param) == value

@pytest.mark.parametrize("value", [-1e-9, 1.0001])
@pytest.mark.parametrize(
Expand Down
1 change: 1 addition & 0 deletions tests/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,7 @@ def test_noises_digital(matrices, noise, result, n_collapse_ops, seq_digital):
sampling_rate=0.01,
config=SimConfig(
noise=noise,
hyperfine_dephasing_rate=0.05,
eff_noise_opers=[matrices["Z"]],
eff_noise_rates=[0.025],
),
Expand Down