psifr.fr.block_index#

psifr.fr.block_index(list_labels)#

Get index of each block in a list.

Parameters:

list_labels (list or numpy.ndarray) – Position labels that define the blocks.

Returns:

block – Block index of each position.

Return type:

numpy.ndarray

Examples

>>> from psifr import fr
>>> list_labels = [2, 2, 3, 3, 3, 1, 1]
>>> fr.block_index(list_labels)
array([1, 1, 2, 2, 2, 3, 3])