bidsaid.events.EPrimeBlockExtractor.extract_durations

EPrimeBlockExtractor.extract_durations(offset_column_name=None)[source]

Extract the duration for each block.

Duration is computed in one of two ways:

If offset_column_name is None, then duration is computed as the difference between the onset time of the current block and the onset time of the next block start of the block (either a rest block or some task block).

If offset_column_name is not None, duration is computed by subtracting the final stimulus offset time (considered to be the index prior to the start of the next block, which may be a rest block or a different task block) by the onset time of the start of the block.

Note, if there is no final quit code or rest block for the final task block, then the block ends at the final index of the DataFrame.

Parameters

offset_column_namestr, default=None

The name of the stimulus offset column.

Returns

list[float]

A list of durations for each block.