optic.utils.dec2bitarray

dec2bitarray(x, bit_width)

Converts a positive integer or an array-like of positive integers to a NumPy array of the specified size containing bits (0 and 1).

Parameters:
  • x (int or array-like of int) – Positive integer(s) to be converted to a bit array.

  • bit_width (int) – Size of the output bit array.

Returns:

bitarray – Array containing the binary representation of all the input decimal(s).

Return type:

2D NumPy array of int