Re: [Numpy-discussion] converting list of int16 values to bitmask and back to

2017-10-16 Thread Nissim Derdiger
ke 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,RawDa > taList[(i*2)+1])[0:2] + struct.pack(' To: numpy-discussion@python.org Subject: Re: [Numpy-dis

Re: [Numpy-discussion] converting list of int16 values to bitmask and back to bitmask and back to list of int32\float values

2017-10-08 Thread Thomas Jollans
On 08/10/17 22:50, Thomas Jollans wrote: > On 08/10/17 09:12, Nissim Derdiger wrote: >> 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 >

Re: [Numpy-discussion] converting list of int16 values to bitmask and back to bitmask and back to list of int32\float values

2017-10-08 Thread Thomas Jollans
On 08/10/17 09:12, Nissim Derdiger wrote: > 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 Pyth

Re: [Numpy-discussion] converting list of int16 values to bitmask and back to bitmask and back to list of int32\float values

2017-10-08 Thread Nissim Derdiger
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 unclearn

Re: [Numpy-discussion] converting list of int16 values to bitmask and back to list of int32\float values

2017-09-19 Thread Chris Barker
not sure what you are getting from: Modbus.read_input_registers() but if it is a binary stream then you can put it all in one numpy array (probably type uint8 (byte)). then you can manipulate the type with arr.astype() and arr.byteswap() astype will tell numpy to interpret the same block of dat

[Numpy-discussion] converting list of int16 values to bitmask and back to list of int32\float values

2017-09-14 Thread Nissim Derdiger
Hi all! I'm writing a Modbus TCP client using pymodbus3 library. When asking for some parameters, the response is always a list of int16. In order to make the values usable, I need to transfer them into 32bit bites, than put them in the correct order (big\little endian wise), and then to cast the