Sequence.label_blocks

Sequence.label_blocks#

Sequence.label_blocks()[source]#

Return the blocks whose extension chain sets, or increments, a label.

Parameters:
  • label (str) – Label name, such as 'TRID' or 'LIN'.

  • kind ({'SET', 'INC'}, default='SET') – Whether LABELSET or LABELINC statements are looked for.

Returns:

1-based block indices, ascending; empty when no block states the label.

Return type:

NDArray[np.int32]

Raises:

ValueError – If kind is neither 'SET' nor 'INC'.

Notes

A block is listed once however many statements of the label it holds. evaluate_labels() gives the value a label takes; this gives where it is stated, which a value set again at every repetition does not.

Examples

>>> import pypulseqpp as pp
>>> seq = pp.Sequence(pp.Opts())
>>> for _ in range(3):
...     _ = seq.add_block(pp.make_label("TRID", "SET", 1), pp.make_delay(1e-3))
...     _ = seq.add_block(pp.make_delay(2e-3))
>>> seq.label_blocks("TRID").tolist()
[1, 3, 5]