Repository: pasqal-io/Pulser (language: python)

Issue:
Enable definition of effective noise operators in all basis
- Enables the definition of effective noise operators in a Simulation of a Sequence with Rydberg and Raman channels.
- Redefines the collapse operators associated with dephasing noise: the collapse operators become `$ \sqrt{2\gamma} \left |r \right>\left <r \right |$` and `$ \sqrt{2\gamma_h} \left |h \right>\left <h \right |$`.
- Test the reduction to basis of a density matrix obtained after simulation using effective noise operators in all basis (not implemented error)


Discussion / hints:
Check out this pull request on&nbsp; <a href="https://app.reviewnb.com/pasqal-io/Pulser/pull/716"><img align="absmiddle"  alt="ReviewNB" height="28" class="BotMessageButtonImage" src="https://raw.githubusercontent.com/ReviewNB/support/master/images/button_reviewnb.png"/></a> 

 See visual diffs & provide feedback on Jupyter Notebooks. 

---

 <i>Powered by <a href='https://www.reviewnb.com/?utm_source=gh'>ReviewNB</a></i>
I fixed the issue in the test on #717 , it is unrelated

Fix patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index be813601..cb0e77ad 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -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
\ No newline at end of file


Test patch:
diff --git a/tests/test_simulation.py b/tests/test_simulation.py
index b827a567..4c1427b4 100644
--- a/tests/test_simulation.py
+++ b/tests/test_simulation.py
@@ -858,17 +858,27 @@ 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},
@@ -876,8 +886,21 @@ def test_noises_digital(matrices, noise, result, n_collapse_ops, seq_digital):
         ),
     ],
 )
-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(
@@ -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],
         ),