Hi again,
I realize that my question was not clear enough, so I've refined it into one
runnable function (attached below)
My question is basically - is there a way to perform the same operation, but
faster using NumPy (or even just by using Python better..)
Thanks again and sorry for the unclearness..
Nissim.
import struct
def Convert():
Endian = '<I' # Big endian
ParameterFormat = 'f' # float32
RawDataList = [17252, 26334, 16141, 58057,17252, 15478, 16144, 43257] #
list of int32 registers
NumOfParametersInRawData = int(len(RawDataList)/2)
Result = []
for i in range(NumOfParametersInRawData):
# pack every 2 registers, take only the first 2 bytes from each one,
change their endianess than unpack them back to the Parameter format
Result.append((struct.unpack(ParameterFormat,(struct.pack(Endian,RawDataList[(i*2)+1])[0:2]
+ struct.pack('<I',RawDataList[i*2])[0:2])))[0])
_______________________________________________
NumPy-Discussion mailing list
[email protected]
https://mail.python.org/mailman/listinfo/numpy-discussion