def binArr2int(arr):
 from numpy import packbits
 tmp2 = packbits(arr.astype(int))
 return sum(((val * (256 ** i)) for (i, val) in enumerate(tmp2[::(-1)])))

def binArr2int ( arr ) : from numpy import packbits tmp2 = packbits ( arr . astype ( int ) ) return sum ( ( ( val * ( 256 ** i ) ) for ( i , val ) in enumerate ( tmp2 [ : : ( - 1 ) ] ) ) )
convert a binary array into its integer representation .