I have a file where the first byte contains encoded information. In Matlab I can read the byte bit by bit with var = fread(file, 8, \'ubit1\'), and then retrie
var = fread(file, 8, \'ubit1\')
With numpy it is easy like this:
numpy
Bytes = numpy.fromfile(filename, dtype = "uint8") Bits = numpy.unpackbits(Bytes)
More info here: http://docs.scipy.org/doc/numpy/reference/generated/numpy.fromfile.html