-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi,
Is it possible to read an array of 12bit encoded numbers from file (or string)
using numpy ?
Thanks,
Martin
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
Raspaud
Sent: Tue 08-Jun-10 15:04
To: Discussion of Numerical Python
Subject: [Numpy-discussion] Reading 12bits numbers ?
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi,
Is it possible to read an array of 12bit encoded numbers from file (or string)
using numpy ?
Thanks,
Martin
-BEGIN PGP
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Nadav Horesh skrev:
You can. If each number occupies 2 bytes (16 bits) it is straight
forward. If it is a continues 12 bits stream you have to unpack by your
self:
data = np.fromstring(str12bits, dtype=np.uint8)
data1 = data.astype(no.uint16)