parameters: (arr)
return_statement: return _np.array(bit_arr, dtype="uint8")
docstring: Convert bit array to byte array.
  
      arr: list
          Bits as a list where each element is an integer of 0 or 1
  
      Returns
      -------
      numpy.array
          1D numpy array of type uint8
docstring_summary: Convert bit array to byte array.
docstring_tokens: Convert bit array to byte array .
function: def _convert_1bit_array_to_byte_array(arr):
      """
      Convert bit array to byte array.
  
      arr: list
          Bits as a list where each element is an integer of 0 or 1
  
      Returns
      -------
      numpy.array
          1D numpy array of type uint8
      """
      # Padding if necessary
      while len(arr) < 8 or len(arr) % 8:
          arr.append(0)
  
      arr = _np.array(arr, dtype="uint8")
      bit_arr = []
      idx = 0
      # Iterate and combine 8-bits into a uint8
      for arr_idx in range(int(len(arr) / 8)):
          bit_arr.append(
              ((arr[idx] << 7) & (1 << 7))
              | ((arr[idx + 1] << 6) & (1 << 6))
              | ((arr[idx + 2] << 5) & (1 << 5))
              | ((arr[idx + 3] << 4) & (1 << 4))
              | ((arr[idx + 4] << 3) & (1 << 3))
              | ((arr[idx + 5] << 2) & (1 << 2))
              | ((arr[idx + 6] << 1) & (1 << 1))
              | ((arr[idx + 7] << 0) & (1 << 0))
          )
          idx += 8
      return _np.array(bit_arr, dtype="uint8")
function_tokens: def _convert_1bit_array_to_byte_array ( arr ) : # Padding if necessary while len ( arr ) < 8 or len ( arr ) % 8 : arr . append ( 0 ) arr = _np . array ( arr , dtype = "uint8" ) bit_arr = [ ] idx = 0 # Iterate and combine 8-bits into a uint8 for arr_idx in range ( int ( len ( arr ) / 8 ) ) : bit_arr . append ( ( ( arr [ idx ] << 7 ) & ( 1 << 7 ) ) | ( ( arr [ idx + 1 ] << 6 ) & ( 1 << 6 ) ) | ( ( arr [ idx + 2 ] << 5 ) & ( 1 << 5 ) ) | ( ( arr [ idx + 3 ] << 4 ) & ( 1 << 4 ) ) | ( ( arr [ idx + 4 ] << 3 ) & ( 1 << 3 ) ) | ( ( arr [ idx + 5 ] << 2 ) & ( 1 << 2 ) ) | ( ( arr [ idx + 6 ] << 1 ) & ( 1 << 1 ) ) | ( ( arr [ idx + 7 ] << 0 ) & ( 1 << 0 ) ) ) idx += 8 return _np . array ( bit_arr , dtype = "uint8" )