Repeated
- class caqtus.shot_compilation.timed_instructions.Repeated(repetitions: int, instruction: TimedInstruction[T])
Bases:
TimedInstruction,GenericRepresents a repetition of an instruction.
Use the * operator with an integer to repeat an instruction. Do not use the class constructor directly.
- instruction
The instruction to repeat.
- repetitions
The number of times to repeat the instruction.
- property dtype: numpy.dtype[T]
Returns the dtype of the instruction.
- property depth: Depth
Returns the number of nested instructions.
The invariant instruction.depth <= len(instruction) always holds.
- apply(func: Callable[[Array1D[T]], Array1D[S]]) Repeated[S]
Applies an element-wise function to the values of the instruction.
- Parameters:
func – The function to apply to the values of the instruction. It must take a 1D numpy array with the same dtype as the instruction and return a 1D numpy array with the same length and a (possibly) different dtype.
- Returns:
A new instruction with the function applied to the values. The length of the new instruction is the same as the original instruction.
- Raises:
ValueError – If the function does not return an array of the same length as the one given.