Skip to content

Commit

Permalink
Fix failing pipeline for test of relaxation noise in qutrit state (#719)
Browse files Browse the repository at this point in the history
* Modifying test for relaxation

* Include macos tests in CI

* Take out dephasing_relaxation result

* Revert ci to without macos tests
  • Loading branch information
a-corni authored Aug 7, 2024
1 parent 0455ed1 commit c9f7957
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ jobs:
- name: Test validation with legacy jsonschema
run: |
pip install jsonschema==4.17.3
pytest tests/test_abstract_repr.py -W ignore::DeprecationWarning
pytest tests/test_abstract_repr.py -W ignore::DeprecationWarning
37 changes: 30 additions & 7 deletions tests/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,26 +858,49 @@ def test_noises_digital(matrices, noise, result, n_collapse_ops, seq_digital):
assert np.trace(trace_2) < 1 and not np.isclose(np.trace(trace_2), 1)


res_deph_relax = {
"000": 412,
"010": 230,
"001": 176,
"100": 174,
"101": 7,
"011": 1,
}


@pytest.mark.parametrize(
"noise, result, n_collapse_ops",
[
("dephasing", {"111": 958, "110": 19, "011": 12, "101": 11}, 2),
("eff_noise", {"111": 958, "110": 19, "011": 12, "101": 11}, 2),
("relaxation", {"111": 1000}, 1),
(
("dephasing", "relaxation"),
{"111": 958, "110": 19, "011": 12, "101": 11},
3,
"relaxation",
{"000": 421, "010": 231, "001": 172, "100": 171, "101": 5},
1,
),
(("dephasing", "relaxation"), res_deph_relax, 3),
(
("eff_noise", "dephasing"),
{"111": 922, "110": 33, "011": 23, "101": 21, "100": 1},
4,
),
],
)
def test_noises_all(matrices, noise, result, n_collapse_ops, seq):
# Test with Digital Sequence
def test_noises_all(matrices, reg, noise, result, n_collapse_ops, seq):
# Test with Digital+Rydberg Sequence
if "relaxation" in noise:
# Bring the states to ggg
seq.target("control1", "raman")
seq.add(pi_Y_pulse, "raman")
seq.target("target", "raman")
seq.add(pi_Y_pulse, "raman")
seq.target("control2", "raman")
seq.add(pi_Y_pulse, "raman")
# Apply a 2pi pulse on ggg
seq.declare_channel("ryd_glob", "rydberg_global")
seq.add(twopi_pulse, "ryd_glob")
# Measure in the rydberg basis
seq.measure()
deph_op = qutip.Qobj([[1, 0, 0], [0, 0, 0], [0, 0, 0]])
hyp_deph_op = qutip.Qobj([[0, 0, 0], [0, 0, 0], [0, 0, 1]])
sim = QutipEmulator.from_sequence(
Expand All @@ -887,7 +910,7 @@ def test_noises_all(matrices, noise, result, n_collapse_ops, seq):
noise=noise,
dephasing_rate=0.1,
hyperfine_dephasing_rate=0.1,
relaxation_rate=1000,
relaxation_rate=1.0,
eff_noise_opers=[deph_op, hyp_deph_op],
eff_noise_rates=[0.2, 0.2],
),
Expand Down

0 comments on commit c9f7957

Please sign in to comment.