def binary_to_array(value=0, length=8):
    """
    takes an integer and converts it to 8 bit representation as an array.
    If float number is passed, it will be converted to int.
    """
    from numpy import arange, ndarray, nan
    value = int(value)
    binary = format(value, '#0' + str(length + 2) + 'b')
    arr = arange(length - 1)
    for i in range(length - 1):
        arr[i] = binary[length + 1 - i]
    return arr
