Sequence.find_block_by_time

Sequence.find_block_by_time#

Sequence.find_block_by_time()[source]#

Return the 1-based index of the block containing time t in seconds.

Parameters:

t (float) – A time from the start of the sequence, in seconds.

Returns:

The block playing then, or None if t is past the end.

Return type:

int | None

Raises:

ValueError – If the block found at t has a non-positive duration.

Examples

>>> import pypulseqpp as pp
>>> seq = pp.Sequence(pp.Opts())
>>> seq.add_block(pp.make_delay(2e-3))
1
>>> seq.add_block(pp.make_delay(1e-3))
2
>>> seq.find_block_by_time(2.5e-3), seq.find_block_by_time(1.0)
(2, None)