forked from M-Labs/artiq
1
0
Fork 0

pdq2.mediator: minor tweaks

This commit is contained in:
Robert Jördens 2016-02-24 18:10:51 +01:00
parent f2acf95f98
commit aa50c5b4d9
1 changed files with 5 additions and 6 deletions

View File

@ -5,7 +5,6 @@ frame_setup = 20*ns
trigger_duration = 50*ns trigger_duration = 50*ns
sample_period = 10*ns sample_period = 10*ns
delay_margin_factor = 1 + 1e-4 delay_margin_factor = 1 + 1e-4
minimum_duration = 100*ns
class FrameActiveError(Exception): class FrameActiveError(Exception):
@ -104,9 +103,9 @@ class _Frame:
def _get_program(self): def _get_program(self):
r = [] r = []
for segment in self.segments: 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 " raise ValueError(("Segment too short ({:g} s), trigger might "
"overlap").format(segment.duration)) "spill").format(segment.duration))
segment_program = [ segment_program = [
{ {
"dac_divider": dac_divider, "dac_divider": dac_divider,
@ -172,10 +171,10 @@ class CompoundPDQ2:
def disarm(self): def disarm(self):
for frame in self.frames: for frame in self.frames:
frame._invalidate() frame._invalidate()
self.frames = [] self.frames.clear()
self.armed = False
for dev in self.pdq2s: for dev in self.pdq2s:
dev.park() dev.park()
self.armed = False
def get_program(self): def get_program(self):
return [f._get_program() for f in self.frames] return [f._get_program() for f in self.frames]
@ -185,7 +184,6 @@ class CompoundPDQ2:
raise ArmError() raise ArmError()
for frame in self.frames: for frame in self.frames:
frame._arm() frame._arm()
self.armed = True
full_program = self.get_program() full_program = self.get_program()
n = 0 n = 0
@ -207,6 +205,7 @@ class CompoundPDQ2:
n += dn n += dn
for pdq2 in self.pdq2s: for pdq2 in self.pdq2s:
pdq2.unpark() pdq2.unpark()
self.armed = True
def create_frame(self): def create_frame(self):
if self.armed: if self.armed: