Re: [Numpy-discussion] read not byte aligned records

2015-05-10 Thread Gmail
For the archive, I tried to use bitarray instead of bitstring and for same file parsing went from 180ms to 60ms. Code was finally shorter and more simple but less easy to jump into (documentation). Performance is still far from using fromstring or fromfile which gives like 5ms for similar size of

Re: [Numpy-discussion] read not byte aligned records

2015-05-05 Thread Benjamin Root
I have been very happy with the bitarray package. I don't know if it is faster than bitstring, but it is worth a mention. Just watch out for any hashing operations on its objects, it doesn't seem to do them right (set(), dict(), etc...), but comparison operations work just fine. Ben Root _

Re: [Numpy-discussion] read not byte aligned records

2015-05-05 Thread aymeric . rateau
Hi, To answer Jerome (I hope), data is sometime spread on bytes shared by other data in the whole record. 10 bits was an example, sometimes, 24, 2, 8, 7 etc. all combined including some padding between them. I am not sure to have understood... To Nathaniel, yes indeed I could read the records i

Re: [Numpy-discussion] read not byte aligned records

2015-05-04 Thread Nathaniel Smith
On Mon, May 4, 2015 at 10:21 PM, Jerome Kieffer wrote: > Hi, > If you want to play with 10 bits data-blocks, read 5 bytes and work with 4 > entries at a time... NumPy arrays don't have any support for sub-byte alignment. So if you want to handle such data, you either need to write some manual pa

Re: [Numpy-discussion] read not byte aligned records

2015-05-04 Thread Jerome Kieffer
Hi, If you want to play with 10 bits data-blocks, read 5 bytes and work with 4 entries at a time... -- Jérôme Kieffer Data analysis unit - ESRF ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-d

[Numpy-discussion] read not byte aligned records

2015-05-04 Thread Gmail
Hi, I am developping a code to read binary files (MDF, Measurement Data File). In its previous version 3, data was always byte aligned. I used widely numpy.core.records module (fromstring, fromfile) showing good performance to read and unpack data on the fly. However, in the latest version 4, not