Sequence.expand_repeats#
- Sequence.expand_repeats()[source]#
Repeat the scan in place by extending the block table.
A block whose
ONCElabel is 1 plays in the first repetition only, 2 in the last only, and 0 in every one.ONCEis sticky and is read per block, a block’sLABELSETstatements before itsLABELINCones. Each repetition starts with every counter at zero exceptlabel, which numbers the repetitions: the first block of each repetition after the first resets the counters left nonzero by the previous one, other than those it sets itself, and setslabelto the repetition’s 0-based index.No event row is added. A recorded
TotalDurationis replaced by the duration of the expanded scan.repeats=1leaves the scan as it is.- Parameters:
- Returns:
repeats,blocks_beforeandblocks_after, and the number of blocks of one pass whoseONCEis 1, 0 and 2:prep_blocks,body_blocksandcooldown_blocks.- Return type:
- Raises:
ValueError – If
repeatsis below 1.RuntimeError – If a block’s
ONCEis outside 0, 1 and 2, ifrepeatsexceeds 1 and no block plays on every repetition, or if the scan already writeslabel.
Examples
>>> import pypulseqpp as pp >>> seq = pp.Sequence(pp.Opts()) >>> _ = seq.add_block(pp.make_delay(1e-3), pp.make_label("ONCE", "SET", 1)) >>> _ = seq.add_block(pp.make_delay(2e-3), pp.make_label("ONCE", "SET", 0)) >>> seq.expand_repeats(3)["blocks_after"] 4