block_to_events

block_to_events#

pypulseqpp.block_to_events()[source]#

Return the events of a block, or of a list of events, as a tuple.

A block is a namespace with an rf field; its events are its non-None fields in storage order, a field holding a list, such as a label chain, contributing each element. A list of events is returned as a tuple of the same events.

Parameters:

*args (SimpleNamespace or list) – One block, or the events themselves.

Returns:

The events.

Return type:

tuple

Raises:

ValueError – When more than one block is passed.

Examples

>>> import pypulseqpp as pp
>>> gx = pp.make_trapezoid("x", area=1000, duration=1e-3)
>>> adc = pp.make_adc(num_samples=128, duration=1e-3)
>>> len(pp.block_to_events([gx, adc]))
2