mirror of https://github.com/m-labs/artiq.git
pdq2/mediator: raise instances, not classes
This commit is contained in:
parent
f0860beffd
commit
641ef57458
|
@ -45,9 +45,9 @@ class _Segment:
|
||||||
|
|
||||||
def add_line(self, duration, channel_data, dac_divider=1):
|
def add_line(self, duration, channel_data, dac_divider=1):
|
||||||
if self.frame.invalidated:
|
if self.frame.invalidated:
|
||||||
raise InvalidatedError
|
raise InvalidatedError()
|
||||||
if self.frame.pdq.armed:
|
if self.frame.pdq.armed:
|
||||||
raise ArmError
|
raise ArmError()
|
||||||
self.lines.append((dac_divider, duration, channel_data))
|
self.lines.append((dac_divider, duration, channel_data))
|
||||||
|
|
||||||
def get_duration(self):
|
def get_duration(self):
|
||||||
|
@ -59,13 +59,13 @@ class _Segment:
|
||||||
@kernel
|
@kernel
|
||||||
def advance(self):
|
def advance(self):
|
||||||
if self.frame.invalidated:
|
if self.frame.invalidated:
|
||||||
raise InvalidatedError
|
raise InvalidatedError()
|
||||||
if not self.frame.pdq.armed:
|
if not self.frame.pdq.armed:
|
||||||
raise ArmError
|
raise ArmError()
|
||||||
# If a frame is currently being played, check that we are next.
|
# If a frame is currently being played, check that we are next.
|
||||||
if (self.frame.pdq.current_frame >= 0
|
if (self.frame.pdq.current_frame >= 0
|
||||||
and self.frame.pdq.next_segment != self.segment_number):
|
and self.frame.pdq.next_segment != self.segment_number):
|
||||||
raise SegmentSequenceError
|
raise SegmentSequenceError()
|
||||||
self.frame.advance()
|
self.frame.advance()
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,9 +83,9 @@ class _Frame:
|
||||||
|
|
||||||
def create_segment(self, name=None):
|
def create_segment(self, name=None):
|
||||||
if self.invalidated:
|
if self.invalidated:
|
||||||
raise InvalidatedError
|
raise InvalidatedError()
|
||||||
if self.pdq.armed:
|
if self.pdq.armed:
|
||||||
raise ArmError
|
raise ArmError()
|
||||||
segment = _Segment(self, self.segment_count)
|
segment = _Segment(self, self.segment_count)
|
||||||
if name is not None:
|
if name is not None:
|
||||||
if hasattr(self, name):
|
if hasattr(self, name):
|
||||||
|
@ -120,17 +120,17 @@ class _Frame:
|
||||||
@kernel
|
@kernel
|
||||||
def advance(self):
|
def advance(self):
|
||||||
if self.invalidated:
|
if self.invalidated:
|
||||||
raise InvalidatedError
|
raise InvalidatedError()
|
||||||
if not self.pdq.armed:
|
if not self.pdq.armed:
|
||||||
raise ArmError
|
raise ArmError()
|
||||||
|
|
||||||
call_t = now_mu()
|
call_t = now_mu()
|
||||||
trigger_start_t = call_t - seconds_to_mu(trigger_duration/2)
|
trigger_start_t = call_t - seconds_to_mu(trigger_duration/2)
|
||||||
|
|
||||||
if self.pdq.current_frame >= 0:
|
if self.pdq.current_frame >= 0:
|
||||||
# PDQ is in the middle of a frame. Check it is us.
|
# PDQ is in the middle of a frame. Check it is us.
|
||||||
if self.frame.pdq.current_frame != self.frame_number:
|
if self.pdq.current_frame != self.frame_number:
|
||||||
raise FrameActiveError
|
raise FrameActiveError()
|
||||||
else:
|
else:
|
||||||
# PDQ is in the jump table - set the selection signals
|
# PDQ is in the jump table - set the selection signals
|
||||||
# to play our first segment.
|
# to play our first segment.
|
||||||
|
@ -176,7 +176,7 @@ class CompoundPDQ2:
|
||||||
|
|
||||||
def arm(self):
|
def arm(self):
|
||||||
if self.armed:
|
if self.armed:
|
||||||
raise ArmError
|
raise ArmError()
|
||||||
for frame in self.frames:
|
for frame in self.frames:
|
||||||
frame._arm()
|
frame._arm()
|
||||||
self.armed = True
|
self.armed = True
|
||||||
|
@ -200,7 +200,7 @@ class CompoundPDQ2:
|
||||||
|
|
||||||
def create_frame(self):
|
def create_frame(self):
|
||||||
if self.armed:
|
if self.armed:
|
||||||
raise ArmError
|
raise ArmError()
|
||||||
r = _Frame(self, len(self.frames))
|
r = _Frame(self, len(self.frames))
|
||||||
self.frames.append(r)
|
self.frames.append(r)
|
||||||
return r
|
return r
|
||||||
|
|
Loading…
Reference in New Issue