I need to transmit some data values.  These values will be float and long 
values.  I need them encoded into a string of bits.

The only way I found so far to do this seems rather roundabout:


np.unpackbits (np.array (memoryview(struct.pack ('d', pi))))
Out[45]: 
array([0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0,
       0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0,
       0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0], dtype=uint8)

(which I'm not certain is correct)

Also, I don't know how to reverse this process 

-- 
-- Those who don't understand recursion are doomed to repeat it

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to