how to convert 3 byte to float
Mario M. Mueller
news.mueller at arcor.de
Mon Dec 10 07:21:38 EST 2007
More information about the Python-list mailing list
Mon Dec 10 07:21:38 EST 2007
- Previous message (by thread): how to convert 3 byte to float
- Next message (by thread): how to convert 3 byte to float
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
marek.rocki at wp.pl wrote: [...] >> But I'm experiencing some strange jumps in the data (seismic data is >> mostly quite smooth at 40 Hz sampling rate). I think I did some mistake >> in the byte order... > > Probably. In your code sample, when you pad it to 32-bits, why are you > inserting every third byte, instead of the most significant one? Hm, I'm not that good when we go the the very basics. A good friend of mine (Robert, now you don't need to go on reading this thread) helped me a lot, but finally I got a bit confused. ;) > Maybe the following will work: > > if sign: > s = struct.unpack('>i','%c%c%c%c' % (chr(0xFF),s0,s1,s2))[0] > else: > s = struct.unpack('>i','%c%c%c%c' % (chr(0x00),s0,s1,s2))[0] Perfect! Today I got a bit of c code - the results are identical. :) Thanks to all of you, Mario
- Previous message (by thread): how to convert 3 byte to float
- Next message (by thread): how to convert 3 byte to float
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list