diff --git a/VERSION.txt b/VERSION.txt index c3d16c164..884e9604b 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -0.17.2 +0.17.3 diff --git a/pulser-simulation/pulser_simulation/simulation.py b/pulser-simulation/pulser_simulation/simulation.py index e6121d8c6..50ad3397b 100644 --- a/pulser-simulation/pulser_simulation/simulation.py +++ b/pulser-simulation/pulser_simulation/simulation.py @@ -270,6 +270,7 @@ def add_config(self, config: SimConfig) -> None: param_dict["temperature"] = noise_model.temperature if "amplitude" in diff_noise_set: param_dict["laser_waist"] = noise_model.laser_waist + param_dict["amp_sigma"] = noise_model.amp_sigma if "dephasing" in diff_noise_set: param_dict["dephasing_prob"] = noise_model.dephasing_prob param_dict["dephasing_rate"] = noise_model.dephasing_rate diff --git a/tests/test_simresults.py b/tests/test_simresults.py index f34abfb0c..c360f0386 100644 --- a/tests/test_simresults.py +++ b/tests/test_simresults.py @@ -60,6 +60,7 @@ def results_noisy(sim): sim.add_config( SimConfig(noise=("SPAM", "doppler", "amplitude"), amp_sigma=1e-3) ) + assert sim.config.amp_sigma == 1e-3 return sim.run() @@ -277,7 +278,7 @@ def test_expect_noisy(results_noisy): with pytest.raises(ValueError, match="non-diagonal"): results_noisy.expect([bad_op]) op = qutip.tensor([qutip.qeye(2), qutip.basis(2, 0).proj()]) - assert np.isclose(results_noisy.expect([op])[0][-1], 0.7466666666666666) + assert np.isclose(results_noisy.expect([op])[0][-1], 0.7333333333333334) def test_plot(results_noisy, results): @@ -294,7 +295,7 @@ def test_sim_without_measurement(seq_no_meas): ) results_no_meas = sim_no_meas.run() assert results_no_meas.sample_final_state() == Counter( - {"00": 80, "01": 164, "10": 164, "11": 592} + {"11": 587, "10": 165, "01": 164, "00": 84} ) @@ -326,7 +327,7 @@ def test_sample_final_state_three_level(seq_no_meas, pi_pulse): def test_sample_final_state_noisy(seq_no_meas, results_noisy): np.random.seed(123) assert results_noisy.sample_final_state(N_samples=1234) == Counter( - {"11": 772, "10": 190, "01": 161, "00": 111} + {"11": 725, "10": 265, "01": 192, "00": 52} ) res_3level = QutipEmulator.from_sequence( seq_no_meas, config=SimConfig(noise=("SPAM", "doppler"), runs=10) diff --git a/tests/test_simulation.py b/tests/test_simulation.py index d002c9a6d..b8cb2f02c 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -799,7 +799,11 @@ def test_add_config(matrices): assert sim.config.temperature == 20000.0e-6 sim.set_config(SimConfig(noise="doppler", laser_waist=175.0)) sim.add_config( - SimConfig(noise=("SPAM", "amplitude", "dephasing"), laser_waist=172.0) + SimConfig( + noise=("SPAM", "amplitude", "dephasing"), + laser_waist=172.0, + amp_sigma=1e-2, + ) ) assert ( "amplitude" in sim.config.noise @@ -807,6 +811,7 @@ def test_add_config(matrices): and "SPAM" in sim.config.noise ) assert sim.config.laser_waist == 172.0 + assert sim.config.amp_sigma == 1e-2 sim.set_config(SimConfig(noise="SPAM", eta=0.5)) sim.add_config(SimConfig(noise="depolarizing")) assert "depolarizing" in sim.config.noise diff --git a/tutorials/quantum_simulation/Building 1D Rydberg Crystals.ipynb b/tutorials/quantum_simulation/Building 1D Rydberg Crystals.ipynb index b9b72b6e6..e5343060a 100644 --- a/tutorials/quantum_simulation/Building 1D Rydberg Crystals.ipynb +++ b/tutorials/quantum_simulation/Building 1D Rydberg Crystals.ipynb @@ -139,16 +139,16 @@ "name": "stdout", "output_type": "stream", "text": [ - "10.0%. Run time: 0.00s. Est. time left: 00:00:00:00\n", - "20.0%. Run time: 0.01s. Est. time left: 00:00:00:00\n", - "30.0%. Run time: 0.01s. Est. time left: 00:00:00:00\n", - "40.0%. Run time: 0.01s. Est. time left: 00:00:00:00\n", - "50.0%. Run time: 0.02s. Est. time left: 00:00:00:00\n", - "60.0%. Run time: 0.02s. Est. time left: 00:00:00:00\n", - "70.0%. Run time: 0.02s. Est. time left: 00:00:00:00\n", - "80.0%. Run time: 0.03s. Est. time left: 00:00:00:00\n", - "90.0%. Run time: 0.03s. Est. time left: 00:00:00:00\n", - "Total run time: 0.03s\n" + "10.0%. Run time: 0.01s. Est. time left: 00:00:00:00\n", + "20.0%. Run time: 0.02s. Est. time left: 00:00:00:00\n", + "30.0%. Run time: 0.02s. Est. time left: 00:00:00:00\n", + "40.0%. Run time: 0.03s. Est. time left: 00:00:00:00\n", + "50.0%. Run time: 0.04s. Est. time left: 00:00:00:00\n", + "60.0%. Run time: 0.05s. Est. time left: 00:00:00:00\n", + "70.0%. Run time: 0.07s. Est. time left: 00:00:00:00\n", + "80.0%. Run time: 0.07s. Est. time left: 00:00:00:00\n", + "90.0%. Run time: 0.08s. Est. time left: 00:00:00:00\n", + "Total run time: 0.08s\n" ] }, { @@ -165,16 +165,16 @@ "name": "stdout", "output_type": "stream", "text": [ - "10.0%. Run time: 0.01s. Est. time left: 00:00:00:00\n", - "20.0%. Run time: 0.03s. Est. time left: 00:00:00:00\n", - "30.0%. Run time: 0.04s. Est. time left: 00:00:00:00\n", - "40.0%. Run time: 0.06s. Est. time left: 00:00:00:00\n", - "50.0%. Run time: 0.09s. Est. time left: 00:00:00:00\n", - "60.0%. Run time: 0.10s. Est. time left: 00:00:00:00\n", - "70.0%. Run time: 0.12s. Est. time left: 00:00:00:00\n", - "80.0%. Run time: 0.14s. Est. time left: 00:00:00:00\n", - "90.0%. Run time: 0.16s. Est. time left: 00:00:00:00\n", - "Total run time: 0.18s\n" + "10.0%. Run time: 0.02s. Est. time left: 00:00:00:00\n", + "20.0%. Run time: 0.05s. Est. time left: 00:00:00:00\n", + "30.0%. Run time: 0.07s. Est. time left: 00:00:00:00\n", + "40.0%. Run time: 0.13s. Est. time left: 00:00:00:00\n", + "50.0%. Run time: 0.17s. Est. time left: 00:00:00:00\n", + "60.0%. Run time: 0.22s. Est. time left: 00:00:00:00\n", + "70.0%. Run time: 0.27s. Est. time left: 00:00:00:00\n", + "80.0%. Run time: 0.34s. Est. time left: 00:00:00:00\n", + "90.0%. Run time: 0.39s. Est. time left: 00:00:00:00\n", + "Total run time: 0.45s\n" ] }, { @@ -191,16 +191,16 @@ "name": "stdout", "output_type": "stream", "text": [ - "10.0%. Run time: 0.52s. Est. time left: 00:00:00:04\n", - "20.0%. Run time: 0.98s. Est. time left: 00:00:00:03\n", - "30.0%. Run time: 1.42s. Est. time left: 00:00:00:03\n", - "40.0%. Run time: 1.89s. Est. time left: 00:00:00:02\n", - "50.0%. Run time: 2.37s. Est. time left: 00:00:00:02\n", - "60.0%. Run time: 2.83s. Est. time left: 00:00:00:01\n", - "70.0%. Run time: 3.31s. Est. time left: 00:00:00:01\n", - "80.0%. Run time: 3.77s. Est. time left: 00:00:00:00\n", - "90.0%. Run time: 4.25s. Est. time left: 00:00:00:00\n", - "Total run time: 4.68s\n" + "10.0%. Run time: 1.02s. Est. time left: 00:00:00:09\n", + "20.0%. Run time: 1.92s. Est. time left: 00:00:00:07\n", + "30.0%. Run time: 2.74s. Est. time left: 00:00:00:06\n", + "40.0%. Run time: 3.70s. Est. time left: 00:00:00:05\n", + "50.0%. Run time: 4.74s. Est. time left: 00:00:00:04\n", + "60.0%. Run time: 5.74s. Est. time left: 00:00:00:03\n", + "70.0%. Run time: 7.16s. Est. time left: 00:00:00:03\n", + "80.0%. Run time: 8.58s. Est. time left: 00:00:00:02\n", + "90.0%. Run time: 10.25s. Est. time left: 00:00:00:01\n", + "Total run time: 12.29s\n" ] } ], @@ -448,16 +448,16 @@ "name": "stdout", "output_type": "stream", "text": [ - "10.0%. Run time: 0.21s. Est. time left: 00:00:00:01\n", - "20.0%. Run time: 0.45s. Est. time left: 00:00:00:01\n", - "30.0%. Run time: 0.71s. Est. time left: 00:00:00:01\n", - "40.0%. Run time: 0.95s. Est. time left: 00:00:00:01\n", - "50.0%. Run time: 1.15s. Est. time left: 00:00:00:01\n", - "60.0%. Run time: 1.34s. Est. time left: 00:00:00:00\n", - "70.0%. Run time: 1.53s. Est. time left: 00:00:00:00\n", - "80.0%. Run time: 1.75s. Est. time left: 00:00:00:00\n", - "90.0%. Run time: 2.00s. Est. time left: 00:00:00:00\n", - "Total run time: 2.28s\n" + "10.0%. Run time: 0.76s. Est. time left: 00:00:00:06\n", + "20.0%. Run time: 1.61s. Est. time left: 00:00:00:06\n", + "30.0%. Run time: 2.55s. Est. time left: 00:00:00:05\n", + "40.0%. Run time: 3.27s. Est. time left: 00:00:00:04\n", + "50.0%. Run time: 3.86s. Est. time left: 00:00:00:03\n", + "60.0%. Run time: 4.40s. Est. time left: 00:00:00:02\n", + "70.0%. Run time: 4.99s. Est. time left: 00:00:00:02\n", + "80.0%. Run time: 5.60s. Est. time left: 00:00:00:01\n", + "90.0%. Run time: 6.35s. Est. time left: 00:00:00:00\n", + "Total run time: 7.21s\n" ] } ], @@ -530,9 +530,9 @@ " N = len(reg.qubits)\n", " time_window = []\n", " x = []\n", - " detunings = simul.samples[\"Global\"][\"ground-rydberg\"][\"det\"][\n", - " [int(1000 * t) for t in simul.evaluation_times[:-1]]\n", - " ]\n", + " detunings = simul.samples_obj.to_nested_dict()[\"Global\"][\"ground-rydberg\"][\n", + " \"det\"\n", + " ][[int(1000 * t) for t in simul.evaluation_times[:-1]]]\n", "\n", " for t, d in enumerate(detunings):\n", " if start <= d <= end:\n", @@ -617,16 +617,16 @@ "name": "stdout", "output_type": "stream", "text": [ - "10.0%. Run time: 0.71s. Est. time left: 00:00:00:06\n", - "20.0%. Run time: 1.53s. Est. time left: 00:00:00:06\n", - "30.0%. Run time: 2.41s. Est. time left: 00:00:00:05\n", - "40.0%. Run time: 3.26s. Est. time left: 00:00:00:04\n", - "50.0%. Run time: 4.11s. Est. time left: 00:00:00:04\n", - "60.0%. Run time: 4.99s. Est. time left: 00:00:00:03\n", - "70.0%. Run time: 5.83s. Est. time left: 00:00:00:02\n", - "80.0%. Run time: 6.68s. Est. time left: 00:00:00:01\n", - "90.0%. Run time: 7.53s. Est. time left: 00:00:00:00\n", - "Total run time: 8.35s\n" + "10.0%. Run time: 2.20s. Est. time left: 00:00:00:19\n", + "20.0%. Run time: 4.31s. Est. time left: 00:00:00:17\n", + "30.0%. Run time: 6.38s. Est. time left: 00:00:00:14\n", + "40.0%. Run time: 8.46s. Est. time left: 00:00:00:12\n", + "50.0%. Run time: 10.56s. Est. time left: 00:00:00:10\n", + "60.0%. Run time: 12.80s. Est. time left: 00:00:00:08\n", + "70.0%. Run time: 14.89s. Est. time left: 00:00:00:06\n", + "80.0%. Run time: 16.99s. Est. time left: 00:00:00:04\n", + "90.0%. Run time: 19.08s. Est. time left: 00:00:00:02\n", + "Total run time: 21.14s\n" ] }, { @@ -677,7 +677,7 @@ "\n", "simul = QutipEmulator.from_sequence(seq, sampling_rate=0.1)\n", "\n", - "occup_list = [occupation(reg, j) for j in range(simul._size)]\n", + "occup_list = [occupation(reg, j) for j in range(len(reg.qubits))]\n", "\n", "res = simul.run(progress_bar=True, method=\"bdf\")\n", "\n", @@ -730,16 +730,16 @@ "name": "stdout", "output_type": "stream", "text": [ - "10.0%. Run time: 1.56s. Est. time left: 00:00:00:14\n", - "20.0%. Run time: 3.02s. Est. time left: 00:00:00:12\n", - "30.0%. Run time: 4.71s. Est. time left: 00:00:00:10\n", - "40.0%. Run time: 6.75s. Est. time left: 00:00:00:10\n", - "50.0%. Run time: 8.92s. Est. time left: 00:00:00:08\n", - "60.0%. Run time: 10.56s. Est. time left: 00:00:00:07\n", - "70.0%. Run time: 12.01s. Est. time left: 00:00:00:05\n", - "80.0%. Run time: 13.47s. Est. time left: 00:00:00:03\n", - "90.0%. Run time: 14.71s. Est. time left: 00:00:00:01\n", - "Total run time: 15.92s\n" + "10.0%. Run time: 4.70s. Est. time left: 00:00:00:42\n", + "20.0%. Run time: 10.75s. Est. time left: 00:00:00:42\n", + "30.0%. Run time: 16.96s. Est. time left: 00:00:00:39\n", + "40.0%. Run time: 24.73s. Est. time left: 00:00:00:37\n", + "50.0%. Run time: 32.96s. Est. time left: 00:00:00:32\n", + "60.0%. Run time: 39.45s. Est. time left: 00:00:00:26\n", + "70.0%. Run time: 44.43s. Est. time left: 00:00:00:19\n", + "80.0%. Run time: 49.02s. Est. time left: 00:00:00:12\n", + "90.0%. Run time: 53.25s. Est. time left: 00:00:00:05\n", + "Total run time: 58.02s\n" ] }, {