tqec.circuit.moment.iter_stim_circuit_without_repeat_by_moments#
- iter_stim_circuit_without_repeat_by_moments(circuit: Circuit, collected_before_use: bool = True) Iterator[Moment] [source]#
Iterate over the stim.Circuit by moments.
A moment in a stim.Circuit is a sequence of instructions between two TICK instructions. Note that stim.CircuitRepeatBlock instances are explicitly not supported and no such instance should appear in the provided circuit.
- Parameters:
circuit – circuit to iterate over. Should not contain any REPEAT block.
collected_before_use – if True, the returned
Moment
instances will contain a copy of the temporary stim.Circuit instance representing the moment. This is needed if the yieldedMoment
instances are not used directly because the underlying stim.Circuit instance is cleared when resuming the generator.
- Yields:
A Moment instance.
- Raises:
TQECException – if the provided circuit contains at least one stim.CircuitRepeatBlock instance.
TQECException – if the provided circuit TICK instructions are not inserted such that instructions between two TICK instructions are always applied on disjoint sets of qubits.