From d80739811bec4b161a31968518e4e705d0913c6a Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Wed, 24 Feb 2016 14:47:27 +0100 Subject: [PATCH 1/3] examples/transport: int arguments --- examples/master/repository/coredevice_examples/transport.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/master/repository/coredevice_examples/transport.py b/examples/master/repository/coredevice_examples/transport.py index e60fe1989..ba367bdbc 100644 --- a/examples/master/repository/coredevice_examples/transport.py +++ b/examples/master/repository/coredevice_examples/transport.py @@ -17,8 +17,8 @@ class Transport(EnvExperiment): self.setattr_argument("wait_at_stop", NumberValue(100*us)) self.setattr_argument("speed", NumberValue(1/(10*us))) - self.setattr_argument("repeats", NumberValue(100)) - self.setattr_argument("bins", NumberValue(100)) + self.repeats = int(self.get_argument("repeats", NumberValue(100))) + self.bins = int(self.get_argument("bins", NumberValue(100))) t = np.linspace(0, 10, 101) # waveform time u = 1 - np.cos(np.pi*t/t[-1]) From f2acf95f98170ffec73b4e9fdac367fb19c7156d Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Wed, 24 Feb 2016 15:48:35 +0100 Subject: [PATCH 2/3] pdq2.mediator: err on short segments --- artiq/devices/pdq2/mediator.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/artiq/devices/pdq2/mediator.py b/artiq/devices/pdq2/mediator.py index c73edf392..570030d1e 100644 --- a/artiq/devices/pdq2/mediator.py +++ b/artiq/devices/pdq2/mediator.py @@ -5,6 +5,7 @@ frame_setup = 20*ns trigger_duration = 50*ns sample_period = 10*ns delay_margin_factor = 1 + 1e-4 +minimum_duration = 100*ns class FrameActiveError(Exception): @@ -103,6 +104,9 @@ class _Frame: def _get_program(self): r = [] for segment in self.segments: + if segment.duration < minimum_duration: + raise ValueError(("Segment too short ({:g} s), trigger might " + "overlap").format(segment.duration)) segment_program = [ { "dac_divider": dac_divider, From aa50c5b4d97c3d3568a7ab053f1a1eaea55abeea Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Wed, 24 Feb 2016 18:10:51 +0100 Subject: [PATCH 3/3] pdq2.mediator: minor tweaks --- artiq/devices/pdq2/mediator.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/artiq/devices/pdq2/mediator.py b/artiq/devices/pdq2/mediator.py index 570030d1e..33fe24314 100644 --- a/artiq/devices/pdq2/mediator.py +++ b/artiq/devices/pdq2/mediator.py @@ -5,7 +5,6 @@ frame_setup = 20*ns trigger_duration = 50*ns sample_period = 10*ns delay_margin_factor = 1 + 1e-4 -minimum_duration = 100*ns class FrameActiveError(Exception): @@ -104,9 +103,9 @@ class _Frame: def _get_program(self): r = [] for segment in self.segments: - if segment.duration < minimum_duration: + if segment.duration < 2*trigger_duration: raise ValueError(("Segment too short ({:g} s), trigger might " - "overlap").format(segment.duration)) + "spill").format(segment.duration)) segment_program = [ { "dac_divider": dac_divider, @@ -172,10 +171,10 @@ class CompoundPDQ2: def disarm(self): for frame in self.frames: frame._invalidate() - self.frames = [] - self.armed = False + self.frames.clear() for dev in self.pdq2s: dev.park() + self.armed = False def get_program(self): return [f._get_program() for f in self.frames] @@ -185,7 +184,6 @@ class CompoundPDQ2: raise ArmError() for frame in self.frames: frame._arm() - self.armed = True full_program = self.get_program() n = 0 @@ -207,6 +205,7 @@ class CompoundPDQ2: n += dn for pdq2 in self.pdq2s: pdq2.unpark() + self.armed = True def create_frame(self): if self.armed: