Skip to content

komm.pack

Packs a given bit array. Splits the bit array into groups of width bits and converts each group to its integer value.

Parameters:

  • bit_array (ArrayLike)

    The input bit array.

  • width (int)

    The width of each group.

Returns:

  • packed (Array1D[int])

    The packed integer array.

Examples:

>>> komm.pack([0, 0, 0, 0, 1, 0, 1, 0, 1, 1], width=5)
array([16, 26])
>>> komm.pack([0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0], width=8)
array([16, 26])