forked from M-Labs/artiq
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):
|
||||
if self.frame.invalidated:
|
||||
raise InvalidatedError
|
||||
raise InvalidatedError()
|
||||
if self.frame.pdq.armed:
|
||||
raise ArmError
|
||||
raise ArmError()
|
||||
self.lines.append((dac_divider, duration, channel_data))
|
||||
|
||||
def get_duration(self):
|
||||
|
@ -59,13 +59,13 @@ class _Segment:
|
|||
@kernel
|
||||
def advance(self):
|
||||
if self.frame.invalidated:
|
||||
raise InvalidatedError
|
||||
raise InvalidatedError()
|
||||
if not self.frame.pdq.armed:
|
||||
raise ArmError
|
||||
raise ArmError()
|
||||
# If a frame is currently being played, check that we are next.
|
||||
if (self.frame.pdq.current_frame >= 0
|
||||
and self.frame.pdq.next_segment != self.segment_number):
|
||||
raise SegmentSequenceError
|
||||
raise SegmentSequenceError()
|
||||
self.frame.advance()
|
||||
|
||||
|
||||
|
@ -83,9 +83,9 @@ class _Frame:
|
|||
|
||||
def create_segment(self, name=None):
|
||||
if self.invalidated:
|
||||
raise InvalidatedError
|
||||
raise InvalidatedError()
|
||||
if self.pdq.armed:
|
||||
raise ArmError
|
||||
raise ArmError()
|
||||
segment = _Segment(self, self.segment_count)
|
||||
if name is not None:
|
||||
if hasattr(self, name):
|
||||
|
@ -120,17 +120,17 @@ class _Frame:
|
|||
@kernel
|
||||
def advance(self):
|
||||
if self.invalidated:
|
||||
raise InvalidatedError
|
||||
raise InvalidatedError()
|
||||
if not self.pdq.armed:
|
||||
raise ArmError
|
||||
raise ArmError()
|
||||
|
||||
call_t = now_mu()
|
||||
trigger_start_t = call_t - seconds_to_mu(trigger_duration/2)
|
||||
|
||||
if self.pdq.current_frame >= 0:
|
||||
# PDQ is in the middle of a frame. Check it is us.
|
||||
if self.frame.pdq.current_frame != self.frame_number:
|
||||
raise FrameActiveError
|
||||
if self.pdq.current_frame != self.frame_number:
|
||||
raise FrameActiveError()
|
||||
else:
|
||||
# PDQ is in the jump table - set the selection signals
|
||||
# to play our first segment.
|
||||
|
@ -176,7 +176,7 @@ class CompoundPDQ2:
|
|||
|
||||
def arm(self):
|
||||
if self.armed:
|
||||
raise ArmError
|
||||
raise ArmError()
|
||||
for frame in self.frames:
|
||||
frame._arm()
|
||||
self.armed = True
|
||||
|
@ -200,7 +200,7 @@ class CompoundPDQ2:
|
|||
|
||||
def create_frame(self):
|
||||
if self.armed:
|
||||
raise ArmError
|
||||
raise ArmError()
|
||||
r = _Frame(self, len(self.frames))
|
||||
self.frames.append(r)
|
||||
return r
|
||||
|
|
Loading…
Reference in New Issue