Skip to content

Commit

Permalink
[FIX] Allow parametrized phase in EOM mode (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
HGSilveri authored Oct 19, 2023
1 parent 394fe6a commit 581886f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pulser-core/pulser/sequence/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ def add_eom_pulse(
channel_obj = self.declared_channels[channel]
channel_obj.validate_duration(duration)
for arg in (phase, post_phase_shift):
if not isinstance(arg, (float, int)):
if not isinstance(arg, (Parametrized, float, int)):
raise TypeError("Phase values must be a numeric value.")
return

Expand Down
7 changes: 5 additions & 2 deletions tests/test_paramseq.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,16 @@ def test_parametrized_before_eom_mode(mod_device):
with pytest.raises(ValueError, match="duration has to be at least"):
seq.add_eom_pulse("ch0", 0, 0.0)

seq.add_eom_pulse("ch0", 100, 0.0)
var = seq.declare_variable("var", dtype=float, size=None)
seq.add_eom_pulse("ch0", 100, 0.0, post_phase_shift=var)
seq.add_eom_pulse("ch0", var * 1000, np.pi)
seq.add_eom_pulse("ch0", 200, var)

seq.disable_eom_mode("ch0")
assert not seq.is_in_eom_mode("ch0")

# Just check that building works
seq.build(amp=3.0)
seq.build(amp=3.0, var=0.5)


def test_iterable_variable_check():
Expand Down

0 comments on commit 581886f

Please sign in to comment.