Segment#
- class iqm.pulse.playlist.schedule.Segment(instructions, *, duration=None)#
Bases:
object
Sequence of instructions, for a single channel.
Basically a list[Instruction] that keeps track of the time duration of its contents.
- Parameters:
instructions (Iterable[Instruction]) – contents of the segment
duration (int | None) – If None, compute the sum of the durations of
instructions
. Otherwise, the time duration (in samples) of the segment, which must match the aforementioned sum if the Segment is still to be modified.
Module:
iqm.pulse.playlist.schedule
Attributes
Sum of the durations of the instructions in the segment, in samples.
Methods
Append an instruction to the end of the segment.
Make an independent copy of the segment.
Append all instructions from an iterable to the end of the segment.
Remove and return the instruction at the given index of the segment.
Prepend an instruction to the beginning of the segment.
- _instructions: list[Instruction]#
contents
- copy()#
Make an independent copy of the segment.
Mutating the original must not affect the copy, or vice versa. Instructions are immutable, so they need not be copied.
- Returns:
copy of the segment
- Return type:
- append(instruction)#
Append an instruction to the end of the segment.
- Parameters:
instruction (Instruction) –
- Return type:
None
- prepend(instruction)#
Prepend an instruction to the beginning of the segment.
- Parameters:
instruction (Instruction) –
- Return type:
None
- extend(instructions)#
Append all instructions from an iterable to the end of the segment.
- Parameters:
instructions (Iterable[Instruction]) –
- Return type:
None