optic.utils.decimal2bitarray
- decimal2bitarray(x, bit_width)
Converts a positive integer to a NumPy array of the specified size containing bits (0 and 1). This version is slightly quicker but only works for one integer.
- Parameters:
x (int) – Positive integer to be converted to a bit array.
bit_width (int) – Size of the output bit array.
- Returns:
bitarray – Array containing the binary representation of the input decimal.
- Return type:
1D NumPy array of int