braintools.cogtask.period_to_arr

Contents

braintools.cogtask.period_to_arr#

braintools.cogtask.period_to_arr(periods)[source]#

Convert period dictionary to label array.

Parameters:

periods (Dict[str, int]) – Period definitions as {name: duration}.

Returns:

Array where each element is the period index for that timestep.

Return type:

Array

Examples

>>> periods = {'fixation': 3, 'stimulus': 2}
>>> period_to_arr(periods)
array([0, 0, 0, 1, 1])