On Tue, May 17, 2011 at 12:04 AM, Nikolas Tautenhahn <[email protected]> wrote:
> Hi, > > > Here > > > > > http://code.google.com/p/pylibtiff/source/browse/#svn%2Ftrunk%2Flibtiff%2Fbitarray-0.3.5-numpy > > > > you can find bitarray with numpy support. > > > > Thanks, that looks promising - to get a numpy array, I need to do > > numpy.array(bitarray.bitarray(numpy.binary_repr(i, l))) > > for an integer i and l with i < 2**l, right? > > If l < 64 and little endian is assumed then you can use the fromword(i, l) method: >>> from libtiff import bitarray >>> barr = bitarray.bitarray(0, 'little') >>> barr.fromword(3,4) >>> barr bitarray('1100') that will append 4 bits of the value 3 to the bitarray barr. Also check out various bitarray `to*` and `from*` methods. HTH, Pearu
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
