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

Release v0.18.0 #683

Merged
merged 29 commits into from
Apr 29, 2024
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d9125bc
Bump version to 0.18dev0
HGSilveri Feb 6, 2024
21a47f3
Remove `Register.rotate()` (#642)
HGSilveri Feb 6, 2024
7b7918b
Update Github Actions (#641)
HGSilveri Feb 12, 2024
20e6765
FIX: Redefine slope of RampWaveform (#644)
a-corni Feb 12, 2024
6a19445
Release v0.17.1
a-corni Feb 15, 2024
61d75f0
Merge pull request #650 from pasqal-io/release_v0.17.1
a-corni Feb 15, 2024
c2d5b6c
Enabling definition of multiple noise channels and noise channels in …
a-corni Feb 15, 2024
bcb78cc
Enable digital simulation (#652)
a-corni Mar 1, 2024
153b7cf
Bring in changes from v0.17.2
HGSilveri Mar 1, 2024
cadd576
Bump version to v0.18dev2
HGSilveri Mar 1, 2024
ebed93a
Merge v0.17.3 into develop
a-corni Mar 19, 2024
c8dcef0
Merge pull request #657 from pasqal-io/bump_v0.18dev3
a-corni Mar 19, 2024
85615c5
Upgrade black version to 24.3.0 to fix vulnerability (#662)
a-corni Mar 25, 2024
71b8e03
Define max_step from minimum variations of samples, nsteps (#666)
a-corni Mar 29, 2024
6eb736d
[HOTFIX] Restrict SciPy to < 1.13 due to breaking Qutip (#668)
awennersteen Apr 3, 2024
2ddd789
Merge pull request #670 from pasqal-io/v0.18dev4
a-corni Apr 3, 2024
0f6e3dd
Improve access to output modulation durations (#663)
HGSilveri Apr 4, 2024
7df66e3
Block add() on DMM channels (#672)
HGSilveri Apr 16, 2024
188d21d
Remove deprecated noise arguments (#674)
HGSilveri Apr 22, 2024
f303138
Adding relaxation noise channel (#675)
HGSilveri Apr 23, 2024
34b41b4
Fix CI tests on "macos" for python < 3.10 (#677)
HGSilveri Apr 23, 2024
716b86b
Centralize all backend imports from a single `pulser.backends` module…
HGSilveri Apr 25, 2024
96a8c34
Add hyperfine dephasing rate to NoiseModel (#680)
HGSilveri Apr 25, 2024
831ca04
Update pasqal-cloud to ~=0.8.1 (#681)
HGSilveri Apr 25, 2024
4981ca6
Add optional default noise models to devices (#676)
HGSilveri Apr 26, 2024
d83c876
Add missing QPU validation fields to the Device class (#682)
HGSilveri Apr 26, 2024
c695373
Rectangular lattice register and layout (#665)
soufianekaghad98 Apr 29, 2024
227b859
Sync 'master' and 'develop'
HGSilveri Apr 29, 2024
ddc6682
Bump version to v0.18.0
HGSilveri Apr 29, 2024
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
Prev Previous commit
Next Next commit
Enable digital simulation (#652)
a-corni authored Mar 1, 2024
commit bcb78ccee0b8f0b10836eb93ae9cb4c08129fda6
7 changes: 3 additions & 4 deletions pulser-simulation/pulser_simulation/hamiltonian.py
Original file line number Diff line number Diff line change
@@ -107,11 +107,10 @@ def config(self) -> NoiseModel:
def _build_collapse_operators(self, config: NoiseModel) -> None:
def basis_check(noise_type: str) -> None:
"""Checks if the basis allows for the use of noise."""
if self.basis_name == "digital" or self.basis_name == "all":
if self.basis_name == "all":
# Go back to previous config
raise NotImplementedError(
f"Cannot include {noise_type} "
+ "noise in digital- or all-basis."
f"Cannot include {noise_type} noise in all-basis."
)

local_collapse_ops = []
@@ -121,7 +120,7 @@ def basis_check(noise_type: str) -> None:
local_collapse_ops.append(coeff * qutip.sigmaz())

if "depolarizing" in config.noise_types:
basis_check("dephasing")
basis_check("depolarizing")
coeff = np.sqrt(config.depolarizing_rate / 4)
local_collapse_ops.append(coeff * qutip.sigmax())
local_collapse_ops.append(coeff * qutip.sigmay())
103 changes: 84 additions & 19 deletions tests/test_simulation.py
Original file line number Diff line number Diff line change
@@ -37,38 +37,48 @@ def reg():
return Register(q_dict)


duration = 1000
pi_pulse = Pulse.ConstantDetuning(BlackmanWaveform(duration, np.pi), 0.0, 0)
twopi_pulse = Pulse.ConstantDetuning(
BlackmanWaveform(duration, 2 * np.pi), 0.0, 0
)
pi_Y_pulse = Pulse.ConstantDetuning(
BlackmanWaveform(duration, np.pi), 0.0, -np.pi / 2
)


@pytest.fixture
def seq(reg):
duration = 1000
pi = Pulse.ConstantDetuning(BlackmanWaveform(duration, np.pi), 0.0, 0)
twopi = Pulse.ConstantDetuning(
BlackmanWaveform(duration, 2 * np.pi), 0.0, 0
)
pi_Y = Pulse.ConstantDetuning(
BlackmanWaveform(duration, np.pi), 0.0, -np.pi / 2
)
def seq_digital(reg):
seq = Sequence(reg, DigitalAnalogDevice)
# Declare Channels
seq.declare_channel("ryd", "rydberg_local", "control1")
seq.declare_channel("raman", "raman_local", "control1")

# Prepare state 'hhh':
seq.add(pi_Y, "raman")
seq.add(pi_Y_pulse, "raman")
seq.target("target", "raman")
seq.add(pi_Y, "raman")
seq.add(pi_Y_pulse, "raman")
seq.target("control2", "raman")
seq.add(pi_Y, "raman")
seq.add(pi_Y_pulse, "raman")
return seq


@pytest.fixture
def seq(seq_digital):
# Write CCZ sequence:
seq.add(pi, "ryd", protocol="wait-for-all")
with pytest.warns(
UserWarning, match="Building a non-parametrized sequence"
):
seq = seq_digital.build()
seq.declare_channel("ryd", "rydberg_local", "control1")
seq.add(pi_pulse, "ryd", protocol="wait-for-all")
seq.target("control2", "ryd")
seq.add(pi, "ryd")
seq.add(pi_pulse, "ryd")
seq.target("target", "ryd")
seq.add(twopi, "ryd")
seq.add(twopi_pulse, "ryd")
seq.target("control2", "ryd")
seq.add(pi, "ryd")
seq.add(pi_pulse, "ryd")
seq.target("control1", "ryd")
seq.add(pi, "ryd")
seq.add(pi_pulse, "ryd")

# Add a ConstantWaveform part to testout the drawing procedure
seq.add(Pulse.ConstantPulse(duration, 1, 0, 0), "ryd")
@@ -744,9 +754,10 @@ def test_noise_with_zero_epsilons(seq, matrices):
(("eff_noise", "dephasing"), {"0": 595, "1": 405}, 2),
],
)
def test_noises(matrices, noise, result, n_collapse_ops):
def test_noises_rydberg(matrices, noise, result, n_collapse_ops):
np.random.seed(123)
reg = Register.from_coordinates([(0, 0)], prefix="q")
# Test with Rydberg Sequence
seq = Sequence(reg, DigitalAnalogDevice)
seq.declare_channel("ch0", "rydberg_global")
duration = 2500
@@ -769,6 +780,60 @@ def test_noises(matrices, noise, result, n_collapse_ops):
assert np.trace(trace_2) < 1 and not np.isclose(np.trace(trace_2), 1)


depo_res = {
"111": 821,
"110": 61,
"011": 59,
"101": 48,
"100": 5,
"001": 3,
"010": 3,
}
deph_depo_res = {
"111": 806,
"110": 65,
"011": 63,
"101": 52,
"100": 6,
"001": 4,
"010": 3,
"000": 1,
}
eff_deph_res = {"111": 958, "110": 19, "011": 12, "101": 11}


@pytest.mark.parametrize(
"noise, result, n_collapse_ops",
[
("dephasing", {"111": 978, "110": 11, "011": 6, "101": 5}, 1),
("eff_noise", {"111": 978, "110": 11, "011": 6, "101": 5}, 1),
("depolarizing", depo_res, 3),
(("dephasing", "depolarizing"), deph_depo_res, 4),
(("eff_noise", "dephasing"), eff_deph_res, 2),
],
)
def test_noises_digital(matrices, noise, result, n_collapse_ops, seq_digital):
np.random.seed(123)
# Test with Digital Sequence
sim = QutipEmulator.from_sequence(
seq_digital, # resulting state should be hhh
sampling_rate=0.01,
config=SimConfig(
noise=noise,
eff_noise_opers=[matrices["Z"]],
eff_noise_rates=[0.025],
),
)
res = sim.run()
res_samples = res.sample_final_state()
assert res_samples == Counter(result)
assert len(sim._hamiltonian._collapse_ops) == n_collapse_ops * len(
seq_digital.register.qubits
)
trace_2 = res.states[-1] ** 2
assert np.trace(trace_2) < 1 and not np.isclose(np.trace(trace_2), 1)


def test_add_config(matrices):
reg = Register.from_coordinates([(0, 0)], prefix="q")
seq = Sequence(reg, DigitalAnalogDevice)