From 2921bd65019f1ba9752647de8ca3fea313ba7a66 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 4 Sep 2015 18:53:50 -0600 Subject: [PATCH] pxi6733: minor mediator fixes --- artiq/devices/pxi6733/mediator.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/artiq/devices/pxi6733/mediator.py b/artiq/devices/pxi6733/mediator.py index 047653b61..2ae2704d1 100644 --- a/artiq/devices/pxi6733/mediator.py +++ b/artiq/devices/pxi6733/mediator.py @@ -58,6 +58,9 @@ class _Segment: raise ArmError self.lines.append((duration, channel_data)) + def get_sample_count(self): + return sum(duration for duration, _ in self.lines) + @kernel def advance(self): if self.frame.invalidated: @@ -107,13 +110,13 @@ class _Frame: self.invalidated = True def _get_samples(self): - program = [ + program = [[ { "dac_divider": 1, "duration": duration, "channel_data": channel_data, - } for duration, channel_data in segment.lines - for segment in self.segments] + } for segment in self.segments + for duration, channel_data in segment.lines]] synth = Synthesizer(self.daqmx.channel_count, program) synth.select(0) # not setting any trigger flag in the program causes the whole @@ -145,7 +148,7 @@ class CompoundDAQmx: self.daqmx = dmgr.get(daqmx_device) self.clock = dmgr.get(clock_device) self.channel_count = channel_count - if self.sample_rate_in_mu: + if sample_rate_in_mu: self.sample_rate = sample_rate else: self.sample_rate = self.clock.frequency_to_ftw(sample_rate)