diff --git a/artiq/devices/pdq2/driver.py b/artiq/devices/pdq2/driver.py index 481404d19..ea16a205b 100644 --- a/artiq/devices/pdq2/driver.py +++ b/artiq/devices/pdq2/driver.py @@ -198,13 +198,14 @@ class Pdq2: duration = line["duration"] trigger = line.get("trigger", False) for segment, data in zip(segments, line["channel_data"]): + silence = data.pop("silence", False) if len(data) != 1: raise ValueError("only one target per channel and line " "supported") for target, target_data in data.items(): getattr(segment, target)( shift=shift, duration=duration, trigger=trigger, - **target_data) + silence=silence, **target_data) def program(self, program, channels=None): if channels is None: diff --git a/artiq/test/test_pdq2.py b/artiq/test/test_pdq2.py index ef2c9bbf4..cfec3c7ab 100644 --- a/artiq/test/test_pdq2.py +++ b/artiq/test/test_pdq2.py @@ -31,7 +31,7 @@ class TestPdq2(unittest.TestCase): self.dev.program(_test_program) self.dev.cmd("START", True) self.dev.cmd("ARM", True) - #self.dev.cmd("TRIGGER", True) + # self.dev.cmd("TRIGGER", True) return self.dev.dev.getvalue() def test_synth(self): @@ -103,10 +103,10 @@ _test_program = [ "duration": 40, "channel_data": [ {"bias": {"amplitude": [.4, .04, -2e-3]}}, - {"bias": { - "amplitude": [.5], + { + "bias": {"amplitude": [.5]}, "silence": True, - }}, + }, {"dds": { "amplitude": [.8, .08, -4e-3, 0], "phase": [.25, .025, .02/40], diff --git a/artiq/wavesynth/compute_samples.py b/artiq/wavesynth/compute_samples.py index 1d48a81f5..9b80f8298 100644 --- a/artiq/wavesynth/compute_samples.py +++ b/artiq/wavesynth/compute_samples.py @@ -57,7 +57,7 @@ class DDS: return self.amplitude.next()*cos(2*pi*self.phase.next()) -class Wave: +class Channel: def __init__(self): self.bias = Spline() self.dds = DDS() @@ -80,7 +80,7 @@ class TriggerError(Exception): class Synthesizer: def __init__(self, nchannels, program): - self.channels = [Wave() for _ in range(nchannels)] + self.channels = [Channel() for _ in range(nchannels)] self.program = program # line_iter is None: "wait for segment selection" state # otherwise: iterator on the current position in the frame @@ -104,6 +104,7 @@ class Synthesizer: while True: for channel, channel_data in zip(self.channels, line["channel_data"]): + channel.set_silence(channel_data.get("silence", False)) if "bias" in channel_data: channel.bias.set_coefficients( channel_data["bias"]["amplitude"]) @@ -115,7 +116,6 @@ class Synthesizer: channel_data["dds"]["phase"]) if channel_data["dds"].get("clear", False): channel.dds.phase.clear() - channel.set_silence(channel_data.get("silence", False)) if line.get("dac_divider", 1) != 1: raise NotImplementedError